├── .dockerignore ├── .editorconfig ├── .github ├── FUNDING.yml └── workflows │ └── build.yml ├── .gitignore ├── .readthedocs.yaml ├── BotSharp.sln ├── CONTRIBUTING.md ├── Directory.Build.props ├── Directory.Packages.props ├── IFunctionExecutor.cs ├── LICENSE ├── PizzaBot.sln ├── README.md ├── arts ├── BotSharp.gif ├── Icon.png └── Logo.png ├── dockerfiles ├── .env ├── Readme.md ├── WebStarter.Dockerfile ├── appsettings.json ├── botsharp.json ├── docker-compose.infrastructure.override.yml ├── docker-compose.infrastructure.yml ├── docker-compose.yml ├── run-docker-compose.ps1 └── stop-docker-compose.ps1 ├── docs ├── Makefile ├── Name-Entity Recognition(NER) Comparation.pdf ├── README.md ├── agent │ ├── assets │ │ ├── agent-creation.png │ │ ├── agent-update.png │ │ ├── conversation-creation.png │ │ ├── conversation-send-message.png │ │ └── routing-calling-stack.png │ ├── hook.md │ ├── intro.md │ └── router.md ├── architecture │ ├── agent-utility.md │ ├── assets │ │ ├── .$routing-redirection.drawio.bkp │ │ ├── .$routing-redirection.drawio.dtmp │ │ ├── account-creation.png │ │ ├── account-token.png │ │ ├── agent-utility │ │ │ ├── add-utility.png │ │ │ ├── agent-utility-code-structure.png │ │ │ ├── agent-utility-example.png │ │ │ ├── chat-window-demo.png │ │ │ ├── dummy-http.png │ │ │ ├── register-assembly.png │ │ │ ├── router-utility-ui.png │ │ │ ├── routing-arch.png │ │ │ └── task-agent-utility-ui.png │ │ ├── architecture.drawio │ │ ├── botsharp_diagram.png │ │ ├── llm_diagram.png │ │ ├── overview.drawio │ │ ├── routing-reasoner.png │ │ ├── routing-reasoning.drawio │ │ ├── routing-redirection.drawio │ │ ├── routing-redirection.png │ │ └── routing.drawio │ ├── authentication.md │ ├── data-persistence.md │ ├── hooks.md │ ├── logging.md │ ├── plugin.md │ └── routing.md ├── channels │ ├── components.md │ ├── intro.md │ ├── messenger.rst │ └── wechat.md ├── conf.py ├── conversation │ ├── hook.md │ ├── intro.md │ └── state.md ├── index.rst ├── knowledge-base │ ├── assets │ │ ├── feed_knowledge_answer.png │ │ └── feed_knowledge_pdf.png │ ├── build-qa-bot.md │ ├── similarity-search.md │ ├── text-embedding.md │ └── vector-database.md ├── llama-sharp │ ├── assets │ │ ├── check-llamasharp-version.png │ │ ├── choose-llamasharp-as-provider.png │ │ ├── click-test-button.png │ │ ├── console-output-in-botsharp.png │ │ ├── converstaion-examples.png │ │ ├── edit-agent.png │ │ └── install-llamasharp-plugin.png │ ├── config-llamasharp.md │ └── use-llamasharp-in-ui.md ├── llm │ ├── few-shot-learning.md │ ├── function.md │ ├── prompt.md │ ├── provider.md │ └── template.md ├── make.bat ├── quick-start │ ├── assets │ │ ├── APIHome.png │ │ ├── APIPostman.png │ │ ├── BackendServiceHomeScreenshot.png │ │ ├── BotSharp-UI-Router.png │ │ ├── ChatbotUIHome.png │ │ ├── NuGet-Local-Whisper.png │ │ ├── PizzaBotSample1.png │ │ ├── PizzaBotSample2.png │ │ ├── PizzaBotSample3.png │ │ ├── PizzaBotSample4.png │ │ ├── Result-Local-Whisper.png │ │ ├── Steps-Local-Whisper.png │ │ └── overview.png │ ├── get-started.md │ ├── installation.md │ └── overview.md ├── requirements.txt ├── static │ ├── logos │ │ ├── BotSharpEngine.jpg │ │ └── Logo.png │ └── screenshots │ │ ├── BotSharp_arch.png │ │ ├── agent-builder-agents.png │ │ ├── agent-builder-conversations.png │ │ └── web-live-chat.png └── utilities │ └── local-whisper.md ├── src ├── BotSharp.AppHost │ ├── BotSharp.AppHost.csproj │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── appsettings.Development.json │ └── appsettings.json ├── BotSharp.ServiceDefaults │ ├── BotSharp.ServiceDefaults.csproj │ └── Extensions.cs ├── Infrastructure │ ├── BotSharp.Abstraction.ComputerUse │ │ ├── BotSharp.Abstraction.ComputerUse.csproj │ │ ├── MLTasks │ │ │ ├── IComputerUse.cs │ │ │ └── IScreenshot.cs │ │ ├── Models │ │ │ ├── ComputerUseArgs.cs │ │ │ └── ComputerUseOutput.cs │ │ └── Using.cs │ ├── BotSharp.Abstraction │ │ ├── Agents │ │ │ ├── AgentHookBase.cs │ │ │ ├── Constants │ │ │ │ └── LlmConstant.cs │ │ │ ├── Enums │ │ │ │ ├── AgentField.cs │ │ │ │ ├── AgentRole.cs │ │ │ │ ├── AgentType.cs │ │ │ │ └── BuiltInAgentId.cs │ │ │ ├── IAgentHook.cs │ │ │ ├── IAgentService.cs │ │ │ ├── IAgentUtilityHook.cs │ │ │ ├── Models │ │ │ │ ├── Agent.cs │ │ │ │ ├── AgentKnowledgeBase.cs │ │ │ │ ├── AgentLlmConfig.cs │ │ │ │ ├── AgentResponse.cs │ │ │ │ ├── AgentRule.cs │ │ │ │ ├── AgentTemplate.cs │ │ │ │ ├── AgentUtility.cs │ │ │ │ ├── ChannelInstruction.cs │ │ │ │ ├── MCPTool.cs │ │ │ │ └── UserAgent.cs │ │ │ └── Settings │ │ │ │ └── AgentSettings.cs │ │ ├── BotSharp.Abstraction.csproj │ │ ├── Browsing │ │ │ ├── Enums │ │ │ │ └── BroswerActionEnum.cs │ │ │ ├── IWebBrowser.cs │ │ │ ├── IWebDriverHook.cs │ │ │ ├── IWebPageResponseHook.cs │ │ │ ├── Models │ │ │ │ ├── BrowserActionArgs.cs │ │ │ │ ├── BrowserActionParams.cs │ │ │ │ ├── BrowserActionResult.cs │ │ │ │ ├── BrowsingContextIn.cs │ │ │ │ ├── ElementActionArgs.cs │ │ │ │ ├── ElementLocatingArgs.cs │ │ │ │ ├── ElementPosition.cs │ │ │ │ ├── HttpRequestParams.cs │ │ │ │ ├── MessageInfo.cs │ │ │ │ ├── PageActionArgs.cs │ │ │ │ ├── WebPageResponseData.cs │ │ │ │ └── WebPageResponseFilter.cs │ │ │ └── Settings │ │ │ │ └── WebBrowsingSettings.cs │ │ ├── Conversations │ │ │ ├── ConversationHookBase.cs │ │ │ ├── Dtos │ │ │ │ ├── ChatResponseDto.cs │ │ │ │ └── ConversationDto.cs │ │ │ ├── Enums │ │ │ │ ├── ConversationChannel.cs │ │ │ │ ├── ConversationStatus.cs │ │ │ │ ├── MessageTypeName.cs │ │ │ │ ├── StateDataType.cs │ │ │ │ └── StateSource.cs │ │ │ ├── IConversationHook.cs │ │ │ ├── IConversationProgressService.cs │ │ │ ├── IConversationService.cs │ │ │ ├── IConversationStateService.cs │ │ │ ├── IConversationStorage.cs │ │ │ ├── ITokenStatistics.cs │ │ │ ├── Models │ │ │ │ ├── Attachment.cs │ │ │ │ ├── Conversation.cs │ │ │ │ ├── ConversationBreakpoint.cs │ │ │ │ ├── ConversationContext.cs │ │ │ │ ├── ConversationSenderActionModel.cs │ │ │ │ ├── ConversationState.cs │ │ │ │ ├── IncomingMessageModel.cs │ │ │ │ ├── PostbackMessageModel.cs │ │ │ │ ├── RoleDialogModel.cs │ │ │ │ ├── StateChangeModel.cs │ │ │ │ ├── StateKeyValue.cs │ │ │ │ ├── TokenStatsModel.cs │ │ │ │ ├── TruncateMessageRequest.cs │ │ │ │ └── UpdateMessageRequest.cs │ │ │ └── Settings │ │ │ │ ├── ConversationSetting.cs │ │ │ │ └── RateLimitSetting.cs │ │ ├── Crontab │ │ │ ├── ICrontabHook.cs │ │ │ ├── ICrontabService.cs │ │ │ ├── ICrontabSource.cs │ │ │ ├── Models │ │ │ │ ├── CrontabItem.cs │ │ │ │ ├── CrontabItemFilter.cs │ │ │ │ ├── ScheduleTaskArgs.cs │ │ │ │ └── TaskWaitArgs.cs │ │ │ └── Settings │ │ │ │ └── CrontabSettings.cs │ │ ├── Evaluations │ │ │ ├── IEvaluatingService.cs │ │ │ ├── IExecutionLogger.cs │ │ │ ├── Models │ │ │ │ ├── EvaluationRequest.cs │ │ │ │ ├── EvaluationResult.cs │ │ │ │ └── SimulationResult.cs │ │ │ └── Settings │ │ │ │ └── EvaluatorSetting.cs │ │ ├── Files │ │ │ ├── Constants │ │ │ │ └── FileConstants.cs │ │ │ ├── Converters │ │ │ │ └── IPdf2ImageConverter.cs │ │ │ ├── Enums │ │ │ │ ├── FileSourceType.cs │ │ │ │ └── FileStorageEnum.cs │ │ │ ├── FileCoreSettings.cs │ │ │ ├── IFileInstructService.cs │ │ │ ├── IFileStorageService.cs │ │ │ ├── Models │ │ │ │ ├── BotSharpFile.cs │ │ │ │ ├── ExternalFileModel.cs │ │ │ │ ├── FileBase.cs │ │ │ │ ├── FileBinaryDataModel.cs │ │ │ │ ├── FileDataModel.cs │ │ │ │ ├── FileInformation.cs │ │ │ │ ├── FileSelectContext.cs │ │ │ │ ├── ImageGeneration.cs │ │ │ │ ├── InstructFileModel.cs │ │ │ │ ├── KnowledgeFileModel.cs │ │ │ │ ├── MessageFileModel.cs │ │ │ │ └── SelectFileOptions.cs │ │ │ └── Utilities │ │ │ │ └── FileUtility.cs │ │ ├── Functions │ │ │ ├── IFunctionCallback.cs │ │ │ └── Models │ │ │ │ ├── FunctionCallFromLlm.cs │ │ │ │ ├── FunctionCallingResponse.cs │ │ │ │ ├── FunctionDef.cs │ │ │ │ ├── FunctionParametersDef.cs │ │ │ │ └── ParameterPropertyDef.cs │ │ ├── Google │ │ │ ├── Models │ │ │ │ ├── GoogleAddressResult.cs │ │ │ │ └── GoogleVideoResult.cs │ │ │ └── Settings │ │ │ │ └── GoogleApiSettings.cs │ │ ├── Graph │ │ │ ├── IGraphDb.cs │ │ │ └── Models │ │ │ │ ├── GraphSearchData.cs │ │ │ │ ├── GraphSearchOptions.cs │ │ │ │ └── GraphSearchResult.cs │ │ ├── Hooks │ │ │ ├── HookProvider.cs │ │ │ └── IHookBase.cs │ │ ├── Http │ │ │ └── IHttpRequestHook.cs │ │ ├── Infrastructures │ │ │ ├── Attributes │ │ │ │ └── BotSharpAuthAttribute.cs │ │ │ ├── Enums │ │ │ │ ├── CacheType.cs │ │ │ │ ├── EventPriority.cs │ │ │ │ ├── LanguageType.cs │ │ │ │ └── StateConst.cs │ │ │ ├── Events │ │ │ │ ├── IEventPublisher.cs │ │ │ │ └── IEventSubscriber.cs │ │ │ ├── HookEmitOption.cs │ │ │ ├── HookEmittedResult.cs │ │ │ ├── ICacheKey.cs │ │ │ ├── ICacheService.cs │ │ │ ├── IDistributedLocker.cs │ │ │ ├── SharpCacheAttribute.cs │ │ │ └── SharpCacheSettings.cs │ │ ├── Instructs │ │ │ ├── IInstructHook.cs │ │ │ ├── IInstructService.cs │ │ │ ├── InstructHookBase.cs │ │ │ ├── Models │ │ │ │ ├── ExecuteTemplateArgs.cs │ │ │ │ ├── InstructOptions.cs │ │ │ │ ├── InstructResponseModel.cs │ │ │ │ └── InstructResult.cs │ │ │ └── Settings │ │ │ │ └── InstructionSettings.cs │ │ ├── Interpreters │ │ │ ├── Models │ │ │ │ └── InterpretationRequest.cs │ │ │ └── Settings │ │ │ │ └── InterpreterSettings.cs │ │ ├── Knowledges │ │ │ ├── Enums │ │ │ │ ├── KnowledgeCollectionName.cs │ │ │ │ ├── KnowledgeCollectionType.cs │ │ │ │ ├── KnowledgeDocSource.cs │ │ │ │ ├── KnowledgeDocType.cs │ │ │ │ └── KnowledgePayloadName.cs │ │ │ ├── Helpers │ │ │ │ └── TextChopper.cs │ │ │ ├── IKnowledgeHook.cs │ │ │ ├── IKnowledgeService.cs │ │ │ ├── IPaddleOcrConverter.cs │ │ │ ├── IPdf2TextConverter.cs │ │ │ ├── Models │ │ │ │ ├── ChunkOption.cs │ │ │ │ ├── ExtractedKnowledge.cs │ │ │ │ ├── KnowledgeChunk.cs │ │ │ │ ├── KnowledgeCreationModel.cs │ │ │ │ ├── KnowledgeDocMetaData.cs │ │ │ │ ├── KnowledgeFileFilter.cs │ │ │ │ └── UploadKnowledgeResponse.cs │ │ │ └── Settings │ │ │ │ └── KnowledgeBaseSettings.cs │ │ ├── Loggers │ │ │ ├── Enums │ │ │ │ └── ContentLogSource.cs │ │ │ ├── IContentGeneratingHook.cs │ │ │ ├── Models │ │ │ │ ├── AgentQueueChangedLogModel.cs │ │ │ │ ├── ContentLogInputModel.cs │ │ │ │ ├── ContentLogOutputModel.cs │ │ │ │ ├── ConversationStateLogModel.cs │ │ │ │ ├── InstructionLogModel.cs │ │ │ │ ├── LlmCompletionLog.cs │ │ │ │ └── StateChangeOutputModel.cs │ │ │ └── Services │ │ │ │ └── ILoggerService.cs │ │ ├── MCP │ │ │ ├── Models │ │ │ │ ├── McpServerConfigModel.cs │ │ │ │ └── McpServerOptionModel.cs │ │ │ └── Services │ │ │ │ └── IMcpService.cs │ │ ├── MLTasks │ │ │ ├── IAudioSynthesis.cs │ │ │ ├── IAudioTranscription.cs │ │ │ ├── IChatCompletion.cs │ │ │ ├── IImageCompletion.cs │ │ │ ├── ILlmProviderService.cs │ │ │ ├── IRealTimeCompletion.cs │ │ │ ├── ITextCompletion.cs │ │ │ ├── ITextEmbedding.cs │ │ │ └── Settings │ │ │ │ ├── LlmConfigOptions.cs │ │ │ │ ├── LlmModelSetting.cs │ │ │ │ └── LlmProviderSetting.cs │ │ ├── Messaging │ │ │ ├── BotSharpMessageParser.cs │ │ │ ├── Enums │ │ │ │ ├── EditorTypeEnum.cs │ │ │ │ ├── RichTypeEnum.cs │ │ │ │ ├── SenderActionEnum.cs │ │ │ │ └── TemplateTypeEnum.cs │ │ │ ├── IRichContentService.cs │ │ │ ├── IRichMessage.cs │ │ │ ├── ITemplateMessage.cs │ │ │ ├── JsonConverters │ │ │ │ ├── RichContentJsonConverter .cs │ │ │ │ └── TemplateMessageJsonConverter.cs │ │ │ └── Models │ │ │ │ └── RichContent │ │ │ │ ├── ElementAction.cs │ │ │ │ ├── ElementButton.cs │ │ │ │ ├── QuickReplyElement.cs │ │ │ │ ├── QuickReplyMessage.cs │ │ │ │ ├── Recipient.cs │ │ │ │ ├── RichContent.cs │ │ │ │ ├── SenderActionMessage.cs │ │ │ │ ├── Template │ │ │ │ ├── ButtonTemplateMessage.cs │ │ │ │ ├── CouponTemplateMessage.cs │ │ │ │ ├── GenericTemplateMessage.cs │ │ │ │ ├── MultiSelectTemplateMessage.cs │ │ │ │ └── ProductTemplateMessage.cs │ │ │ │ └── TextMessage.cs │ │ ├── Models │ │ │ ├── AiModel.cs │ │ │ ├── ConversationSummaryModel.cs │ │ │ ├── ITrackableMessage.cs │ │ │ ├── IdName.cs │ │ │ ├── KeyValue.cs │ │ │ ├── MessageConfig.cs │ │ │ ├── MessageState.cs │ │ │ └── NameDesc.cs │ │ ├── Options │ │ │ └── BotSharpOptions.cs │ │ ├── Planning │ │ │ ├── IExecutor.cs │ │ │ ├── IPlanningHook.cs │ │ │ └── ITaskPlanner.cs │ │ ├── Plugins │ │ │ ├── IBotSharpAppPlugin.cs │ │ │ ├── IBotSharpPlugin.cs │ │ │ ├── Models │ │ │ │ ├── PluginConfig.cs │ │ │ │ ├── PluginDef.cs │ │ │ │ ├── PluginFilter.cs │ │ │ │ └── PluginMenuDef.cs │ │ │ ├── PluginDependencyAttribute.cs │ │ │ └── PluginLoaderSettings.cs │ │ ├── Processors │ │ │ ├── IBaseProcessor.cs │ │ │ └── Models │ │ │ │ └── LlmBaseRequest.cs │ │ ├── Realtime │ │ │ ├── Enums │ │ │ │ └── StreamChannelStatus.cs │ │ │ ├── IRealtimeHook.cs │ │ │ ├── IRealtimeHub.cs │ │ │ ├── IStreamChannel.cs │ │ │ └── Models │ │ │ │ ├── ModelResponseEvent.cs │ │ │ │ ├── ModelResponseMediaEvent.cs │ │ │ │ ├── ModelTurnDetection.cs │ │ │ │ ├── RealtimeHubConnection.cs │ │ │ │ ├── RealtimeModelSettings.cs │ │ │ │ ├── RealtimeSession.cs │ │ │ │ ├── Session │ │ │ │ ├── ChatSessionOptions.cs │ │ │ │ └── ChatSessionUpdate.cs │ │ │ │ ├── StreamReceiveResult.cs │ │ │ │ └── TranscriptionData.cs │ │ ├── Repositories │ │ │ ├── Enums │ │ │ │ └── RepositoryEnum.cs │ │ │ ├── Filters │ │ │ │ ├── AgentFilter.cs │ │ │ │ ├── AgentTaskFilter.cs │ │ │ │ ├── ConversationFilter.cs │ │ │ │ ├── ConversationLogFilter.cs │ │ │ │ ├── ConversationStateKeysFilter.cs │ │ │ │ ├── InstructLogFilter.cs │ │ │ │ ├── InstructLogKeysFilter.cs │ │ │ │ ├── RoleFilter.cs │ │ │ │ └── UserFilter.cs │ │ │ ├── IBotSharpRepository.cs │ │ │ ├── IBotSharpTable.cs │ │ │ ├── Models │ │ │ │ └── DialogContentUpdateModel.cs │ │ │ ├── Records │ │ │ │ ├── AgentRecord.cs │ │ │ │ ├── ConversationRecord.cs │ │ │ │ ├── RecordBase.cs │ │ │ │ ├── RoutingItemRecord.cs │ │ │ │ ├── RoutingProfileRecord.cs │ │ │ │ ├── UserAgentRecord.cs │ │ │ │ └── UserRecord.cs │ │ │ └── Settings │ │ │ │ └── BotSharpDatabaseSettings.cs │ │ ├── Roles │ │ │ ├── IRoleService.cs │ │ │ └── Models │ │ │ │ ├── Role.cs │ │ │ │ ├── RoleAgent.cs │ │ │ │ └── RoleAgentAction.cs │ │ ├── Routing │ │ │ ├── Enums │ │ │ │ ├── RoutingMode.cs │ │ │ │ └── RuleType.cs │ │ │ ├── Executor │ │ │ │ └── IFunctionExecutor.cs │ │ │ ├── IRoutingContext.cs │ │ │ ├── IRoutingHook.cs │ │ │ ├── IRoutingService.cs │ │ │ ├── Models │ │ │ │ ├── DecomposedStep.cs │ │ │ │ ├── FallbackArgs.cs │ │ │ │ ├── ResponseUserArgs.cs │ │ │ │ ├── RoutableAgent.cs │ │ │ │ ├── RoutingArgs.cs │ │ │ │ ├── RoutingHandlerDef.cs │ │ │ │ └── RoutingRule.cs │ │ │ ├── Reasoning │ │ │ │ └── IRoutingReasoner.cs │ │ │ ├── RoutingHandlerBase.cs │ │ │ └── Settings │ │ │ │ └── RoutingSettings.cs │ │ ├── Rules │ │ │ ├── IRuleAction.cs │ │ │ ├── IRuleConfig.cs │ │ │ ├── IRuleCriteria.cs │ │ │ ├── IRuleEngine.cs │ │ │ └── IRuleTrigger.cs │ │ ├── Settings │ │ │ ├── ISettingService.cs │ │ │ └── SettingsMeta.cs │ │ ├── Shared │ │ │ └── IHaveServiceProvider.cs │ │ ├── SideCar │ │ │ ├── Attributes │ │ │ │ └── SideCarAttribute.cs │ │ │ └── IConversationSideCar.cs │ │ ├── Statistics │ │ │ ├── Enums │ │ │ │ ├── StatsInterval.cs │ │ │ │ ├── StatsMetric.cs │ │ │ │ └── StatsOperation.cs │ │ │ ├── Models │ │ │ │ ├── BotSharpStats.cs │ │ │ │ └── BotSharpStatsDelta.cs │ │ │ ├── Services │ │ │ │ └── IBotSharpStatsService.cs │ │ │ └── Settings │ │ │ │ └── StatisticsSettings.cs │ │ ├── Tasks │ │ │ ├── Enums │ │ │ │ └── TaskStatus.cs │ │ │ ├── IAgentTaskService.cs │ │ │ ├── ITaskFeeder.cs │ │ │ └── Models │ │ │ │ └── AgentTask.cs │ │ ├── Templating │ │ │ ├── Constants │ │ │ │ └── TemplateRenderConstant.cs │ │ │ ├── IResponseTemplateService.cs │ │ │ └── ITemplateRender.cs │ │ ├── Translation │ │ │ ├── Attributes │ │ │ │ └── TranslateAttribute.cs │ │ │ ├── ITranslationService.cs │ │ │ └── Models │ │ │ │ ├── TranslationInput.cs │ │ │ │ ├── TranslationMemory.cs │ │ │ │ ├── TranslationMemoryQuery.cs │ │ │ │ ├── TranslationOutput.cs │ │ │ │ ├── TranslationRequestModel.cs │ │ │ │ └── TranslationResponseModel.cs │ │ ├── Users │ │ │ ├── Dtos │ │ │ │ └── UserDto.cs │ │ │ ├── Enums │ │ │ │ ├── UserAction.cs │ │ │ │ ├── UserConstant.cs │ │ │ │ ├── UserPermission.cs │ │ │ │ ├── UserRole.cs │ │ │ │ ├── UserSource.cs │ │ │ │ └── UserType.cs │ │ │ ├── IAuthenticationHook.cs │ │ │ ├── IUserIdentity.cs │ │ │ ├── IUserService.cs │ │ │ ├── Models │ │ │ │ ├── Dashboard.cs │ │ │ │ ├── Token.cs │ │ │ │ ├── User.cs │ │ │ │ ├── UserActivationModel.cs │ │ │ │ ├── UserAgentAction.cs │ │ │ │ └── UserAuthorization.cs │ │ │ └── Settings │ │ │ │ └── AccountSetting.cs │ │ ├── Using.cs │ │ ├── Utilities │ │ │ ├── DateTimePagination.cs │ │ │ ├── EnumHelper.cs │ │ │ ├── GuidExtensitions.cs │ │ │ ├── JsonExtensions.cs │ │ │ ├── ListExtenstions.cs │ │ │ ├── MathExt.cs │ │ │ ├── Pagination.cs │ │ │ ├── StringExtensions.cs │ │ │ └── StringIdPagination.cs │ │ └── VectorStorage │ │ │ ├── Enums │ │ │ └── VectorDataSource.cs │ │ │ ├── Extensions │ │ │ └── VectorStorageExtension.cs │ │ │ ├── IVectorDb.cs │ │ │ └── Models │ │ │ ├── Snapshot │ │ │ └── VectorCollectionSnapshot.cs │ │ │ ├── VectorCollectionConfigFilter.cs │ │ │ ├── VectorCollectionConfigModel.cs │ │ │ ├── VectorCollectionData.cs │ │ │ ├── VectorCollectionDetails.cs │ │ │ ├── VectorCreateModel.cs │ │ │ ├── VectorFilter.cs │ │ │ ├── VectorSearchOptions.cs │ │ │ ├── VectorSearchResult.cs │ │ │ └── VectorUpdateModel.cs │ ├── BotSharp.Core.Crontab │ │ ├── BotSharp.Core.Crontab.csproj │ │ ├── CrontabPlugin.cs │ │ ├── Enum │ │ │ └── UtilityName.cs │ │ ├── Functions │ │ │ ├── ScheduleTaskFn.cs │ │ │ └── TaskWaitFn.cs │ │ ├── Hooks │ │ │ └── CrontabUtilityHook.cs │ │ ├── Services │ │ │ ├── CrontabEventSubscription.cs │ │ │ ├── CrontabService.cs │ │ │ └── CrontabWatcher.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ ├── util-crontab-schedule_task.json │ │ │ └── util-crontab-task_wait.json │ │ │ └── templates │ │ │ └── util-crontab-schedule_task.fn.liquid │ ├── BotSharp.Core.Realtime │ │ ├── BotSharp.Core.Realtime.csproj │ │ ├── Hooks │ │ │ └── RealtimeConversationHook.cs │ │ ├── RealtimePlugin.cs │ │ ├── Services │ │ │ ├── RealtimeHub.cs │ │ │ └── WaveStreamChannel.cs │ │ └── Using.cs │ ├── BotSharp.Core.Rules │ │ ├── BotSharp.Core.Rules.csproj │ │ ├── Engines │ │ │ └── RuleEngine.cs │ │ ├── RulesPlugin.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── 201e49a2-40b3-4ccd-b8cc-2476565a1b40 │ │ │ ├── agent.json │ │ │ ├── instructions │ │ │ └── instruction.liquid │ │ │ └── templates │ │ │ └── criteria_check.liquid │ ├── BotSharp.Core.SideCar │ │ ├── BotSharp.Core.SideCar.csproj │ │ ├── BotSharpSideCarPlugin.cs │ │ ├── Services │ │ │ └── BotSharpConversationSideCar.cs │ │ ├── Settings │ │ │ └── SideCarSettings.cs │ │ └── Using.cs │ ├── BotSharp.Core │ │ ├── Agents │ │ │ ├── AgentPlugin.cs │ │ │ ├── Hooks │ │ │ │ └── BasicAgentHook.cs │ │ │ └── Services │ │ │ │ ├── AgentService.CreateAgent.cs │ │ │ │ ├── AgentService.DeleteAgent.cs │ │ │ │ ├── AgentService.GetAgents.cs │ │ │ │ ├── AgentService.GetPlugin.cs │ │ │ │ ├── AgentService.LoadAgent.cs │ │ │ │ ├── AgentService.RefreshAgents.cs │ │ │ │ ├── AgentService.Rendering.cs │ │ │ │ ├── AgentService.UpdateAgent.cs │ │ │ │ └── AgentService.cs │ │ ├── BotSharp.Core.csproj │ │ ├── BotSharp.Core.csproj.user │ │ ├── BotSharpCoreExtensions.cs │ │ ├── Conversations │ │ │ ├── ConversationPlugin.cs │ │ │ └── Services │ │ │ │ ├── ConversationProgressService.cs │ │ │ │ ├── ConversationService.Migration.cs │ │ │ │ ├── ConversationService.SendMessage.cs │ │ │ │ ├── ConversationService.Summary.cs │ │ │ │ ├── ConversationService.TruncateMessage.cs │ │ │ │ ├── ConversationService.UpdateBreakpoint.cs │ │ │ │ ├── ConversationService.cs │ │ │ │ ├── ConversationStateService.cs │ │ │ │ ├── ConversationStorage.cs │ │ │ │ └── TokenStatistics.cs │ │ ├── Demo │ │ │ └── Functions │ │ │ │ └── GetWeatherFn.cs │ │ ├── Evaluations │ │ │ ├── EvaluationConversationHook.cs │ │ │ ├── EvaluationPlugin.cs │ │ │ ├── ExecutionLogger.cs │ │ │ └── Services │ │ │ │ ├── EvaluatingService.Evaluate.cs │ │ │ │ └── EvaluatingService.cs │ │ ├── Files │ │ │ ├── FileCorePlugin.cs │ │ │ └── Services │ │ │ │ ├── Instruct │ │ │ │ ├── FileInstructService.Audio.cs │ │ │ │ ├── FileInstructService.Image.cs │ │ │ │ ├── FileInstructService.Pdf.cs │ │ │ │ ├── FileInstructService.SelectFile.cs │ │ │ │ └── FileInstructService.cs │ │ │ │ └── Storage │ │ │ │ ├── LocalFileStorageService.Audio.cs │ │ │ │ ├── LocalFileStorageService.Common.cs │ │ │ │ ├── LocalFileStorageService.Conversation.cs │ │ │ │ ├── LocalFileStorageService.KnowledgeBase.cs │ │ │ │ ├── LocalFileStorageService.User.cs │ │ │ │ └── LocalFileStorageService.cs │ │ ├── Infrastructures │ │ │ ├── Cache │ │ │ │ ├── MemoryCacheService.cs │ │ │ │ └── RedisCacheService.cs │ │ │ ├── CompletionProvider.cs │ │ │ ├── DistributedLocker.cs │ │ │ ├── Events │ │ │ │ ├── RedisPublisher.cs │ │ │ │ └── RedisSubscriber.cs │ │ │ ├── HookEmitter.cs │ │ │ ├── LlmProviderPlugin.cs │ │ │ ├── LlmProviderService.cs │ │ │ ├── SettingService.cs │ │ │ ├── Utilities.cs │ │ │ └── Websocket │ │ │ │ ├── AsyncWebsocketDataCollectionResult.cs │ │ │ │ ├── AsyncWebsocketDataResultEnumerator.cs │ │ │ │ └── WebsocketPipelineResponse.cs │ │ ├── Instructs │ │ │ ├── Functions │ │ │ │ └── ExecuteTemplateFn.cs │ │ │ ├── Hooks │ │ │ │ └── InstructUtilityHook.cs │ │ │ ├── InsturctionPlugin.cs │ │ │ └── Services │ │ │ │ ├── InstructService.Execute.cs │ │ │ │ ├── InstructService.Instruct.cs │ │ │ │ └── InstructService.cs │ │ ├── Loggers │ │ │ ├── LoggerPlugin.cs │ │ │ └── Services │ │ │ │ ├── LoggerService.Conversation.cs │ │ │ │ ├── LoggerService.Instruction.cs │ │ │ │ └── LoggerService.cs │ │ ├── MCP │ │ │ ├── BotSharpMCPExtensions.cs │ │ │ ├── Helpers │ │ │ │ └── AiFunctionHelper.cs │ │ │ ├── Hooks │ │ │ │ └── MCPToolAgentHook.cs │ │ │ ├── Managers │ │ │ │ └── McpClientManager.cs │ │ │ ├── Services │ │ │ │ └── McpService.cs │ │ │ └── Settings │ │ │ │ └── MCPSettings.cs │ │ ├── Messaging │ │ │ └── RichContentService.cs │ │ ├── Plugins │ │ │ └── PluginLoader.cs │ │ ├── Processors │ │ │ └── ProcessorFactory.cs │ │ ├── Repository │ │ │ ├── BotSharpDbContext.cs │ │ │ ├── DataContextHelper.cs │ │ │ ├── FileRepository │ │ │ │ ├── FileRepository.Agent.cs │ │ │ │ ├── FileRepository.AgentTask.cs │ │ │ │ ├── FileRepository.Conversation.cs │ │ │ │ ├── FileRepository.Crontab.cs │ │ │ │ ├── FileRepository.KnowledgeBase.cs │ │ │ │ ├── FileRepository.Log.cs │ │ │ │ ├── FileRepository.Plugin.cs │ │ │ │ ├── FileRepository.Role.cs │ │ │ │ ├── FileRepository.Stats.cs │ │ │ │ ├── FileRepository.Translation.cs │ │ │ │ ├── FileRepository.User.cs │ │ │ │ └── FileRepository.cs │ │ │ └── RepositoryPlugin.cs │ │ ├── Roles │ │ │ └── Services │ │ │ │ └── RoleService.cs │ │ ├── Routing │ │ │ ├── Executor │ │ │ │ ├── DummyFunctionExecutor.cs │ │ │ │ ├── FunctionCallbackExecutor.cs │ │ │ │ ├── FunctionExecutorFactory.cs │ │ │ │ └── MCPToolExecutor.cs │ │ │ ├── Functions │ │ │ │ ├── FallbackToRouterFn.cs │ │ │ │ ├── HumanInterventionNeededFn.cs │ │ │ │ ├── ResponseToUserFn.cs │ │ │ │ └── RouteToAgentFn.cs │ │ │ ├── Hooks │ │ │ │ ├── RoutingAgentHook.cs │ │ │ │ └── RoutingUtilityHook.cs │ │ │ ├── Reasoning │ │ │ │ ├── HFReasoner.cs │ │ │ │ ├── InstructExecutor.cs │ │ │ │ ├── NaiveReasoner.cs │ │ │ │ ├── OneStepForwardReasoner.cs │ │ │ │ └── ReasonerHelper.cs │ │ │ ├── RoutingContext.cs │ │ │ ├── RoutingPlugin.cs │ │ │ ├── RoutingService.GetConversationContent.cs │ │ │ ├── RoutingService.HasMissingRequiredField.cs │ │ │ ├── RoutingService.InstructLoop.cs │ │ │ ├── RoutingService.InvokeAgent.cs │ │ │ ├── RoutingService.InvokeFunction.cs │ │ │ └── RoutingService.cs │ │ ├── Session │ │ │ ├── BotSharpRealtimeSession.cs │ │ │ └── LlmRealtimeSession.cs │ │ ├── Statistics │ │ │ └── Services │ │ │ │ └── BotSharpStatsService.cs │ │ ├── Tasks │ │ │ ├── Services │ │ │ │ └── AgentTaskService.cs │ │ │ └── TaskPlugin.cs │ │ ├── Templating │ │ │ ├── ResponseTemplateService.cs │ │ │ └── TemplateRender.cs │ │ ├── Translation │ │ │ ├── TranslationPlugin.cs │ │ │ ├── TranslationResponseHook.cs │ │ │ └── TranslationService.cs │ │ ├── Users │ │ │ └── Services │ │ │ │ ├── UserIdentity.cs │ │ │ │ └── UserService.cs │ │ ├── Using.cs │ │ ├── build │ │ │ └── BotSharp.Core.targets │ │ └── data │ │ │ ├── agents │ │ │ ├── 01dcc3e5-0af7-49e6-ad7a-a760bd12dc4b │ │ │ │ ├── agent.json │ │ │ │ ├── functions │ │ │ │ │ └── human_intervention_needed.json │ │ │ │ └── instructions │ │ │ │ │ └── instruction.liquid │ │ │ ├── 01e2fc5c-2c89-4ec7-8470-7688608b496c │ │ │ │ ├── agent.json │ │ │ │ ├── functions │ │ │ │ │ └── get_weather.json │ │ │ │ └── instructions │ │ │ │ │ └── instruction.liquid │ │ │ ├── 01fcc3e5-0af7-49e6-ad7a-a760bd12dc4d │ │ │ │ ├── agent.json │ │ │ │ └── instructions │ │ │ │ │ └── instruction.liquid │ │ │ ├── 01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a │ │ │ │ ├── agent.json │ │ │ │ ├── functions │ │ │ │ │ ├── response_to_user.json │ │ │ │ │ └── route_to_agent.json │ │ │ │ ├── instructions │ │ │ │ │ └── instruction.liquid │ │ │ │ └── templates │ │ │ │ │ ├── .welcome.liquid │ │ │ │ │ ├── conversation.summary.liquid │ │ │ │ │ ├── database_knowledge.liquid │ │ │ │ │ ├── reasoner.hf.liquid │ │ │ │ │ ├── reasoner.naive.liquid │ │ │ │ │ ├── reasoner.one-step-forward.liquid │ │ │ │ │ ├── reasoner.sequential.get_remaining_task.liquid │ │ │ │ │ ├── reasoner.sequential.liquid │ │ │ │ │ ├── response_with_function.liquid │ │ │ │ │ └── translation_prompt.liquid │ │ │ ├── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ │ ├── agent.json │ │ │ │ ├── functions │ │ │ │ │ ├── util-instruct-execute_template.json │ │ │ │ │ └── util-routing-fallback_to_router.json │ │ │ │ ├── instructions │ │ │ │ │ └── instruction.liquid │ │ │ │ └── templates │ │ │ │ │ ├── select_file_prompt.liquid │ │ │ │ │ ├── util-instruct-execute_template.fn.liquid │ │ │ │ │ └── util-routing-fallback_to_router.fn.liquid │ │ │ └── dfd9b46d-d00c-40af-8a75-3fbdc2b89869 │ │ │ │ ├── agent.json │ │ │ │ ├── instructions │ │ │ │ └── instruction.liquid │ │ │ │ └── templates │ │ │ │ ├── instruction.executor.liquid │ │ │ │ ├── instruction.metrics.liquid │ │ │ │ ├── instruction.reviewer.liquid │ │ │ │ └── instruction.simulator.liquid │ │ │ └── plugins │ │ │ └── config.json │ ├── BotSharp.Logger │ │ ├── BotSharp.Logger.csproj │ │ ├── BotSharpLoggerExtensions.cs │ │ ├── Hooks │ │ │ ├── CommonContentGeneratingHook.cs │ │ │ ├── GlobalStatsConversationHook.cs │ │ │ ├── InstructionLogHook.cs │ │ │ ├── RateLimitConversationHook.cs │ │ │ ├── TokenStatsConversationHook.cs │ │ │ └── VerboseLogHook.cs │ │ └── Using.cs │ └── BotSharp.OpenAPI │ │ ├── BackgroundServices │ │ └── ConversationTimeoutService.cs │ │ ├── BotSharp.OpenAPI.csproj │ │ ├── BotSharpOpenApiExtensions.cs │ │ ├── Controllers │ │ ├── AgentController.cs │ │ ├── AgentTaskController.cs │ │ ├── ApplicationController.cs │ │ ├── ConversationController.cs │ │ ├── DashboardController.cs │ │ ├── EvaluatorController.cs │ │ ├── FileController.cs │ │ ├── GoogleController.cs │ │ ├── InstructModeController.cs │ │ ├── KnowledgeBaseController.cs │ │ ├── LlmProviderController.cs │ │ ├── LoggerController.cs │ │ ├── McpController.cs │ │ ├── PluginController.cs │ │ ├── RealtimeController.cs │ │ ├── RoleController.cs │ │ ├── RouterController.cs │ │ ├── RulesController.cs │ │ ├── SettingController.cs │ │ ├── TextEmbeddingController.cs │ │ ├── TranslationController.cs │ │ └── UserController.cs │ │ ├── ServiceBuilder.cs │ │ ├── Using.cs │ │ └── ViewModels │ │ ├── Agents │ │ ├── Request │ │ │ ├── AgentCreationModel.cs │ │ │ ├── AgentTaskCreateModel.cs │ │ │ ├── AgentTaskUpdateModel.cs │ │ │ ├── AgentTemplatePatchModel.cs │ │ │ ├── AgentUpdateModel.cs │ │ │ └── RoutingRuleUpdateModel.cs │ │ └── View │ │ │ ├── AgentTaskViewModel.cs │ │ │ └── AgentViewModel.cs │ │ ├── Conversations │ │ ├── Request │ │ │ ├── ConversationCreationModel.cs │ │ │ ├── InputMessageFiles.cs │ │ │ ├── MigrateLatestStateRequest.cs │ │ │ ├── NewMessageModel.cs │ │ │ ├── UpdateConversationRequest.cs │ │ │ ├── UpdateConversationTitleAliasModel.cs │ │ │ ├── UpdateConversationTitleModel.cs │ │ │ └── UpdateMessageModel.cs │ │ ├── Response │ │ │ └── ChatResponseModel.cs │ │ └── View │ │ │ └── ConversationViewModel.cs │ │ ├── Embeddings │ │ └── Request │ │ │ └── EmbeddingInputModel.cs │ │ ├── Files │ │ └── View │ │ │ └── MessageFileViewModel.cs │ │ ├── Instructs │ │ ├── Request │ │ │ ├── InstructBaseRequest.cs │ │ │ └── InstructMessageModel.cs │ │ └── View │ │ │ ├── ImageGenerationViewModel.cs │ │ │ ├── InstructBaseViewModel.cs │ │ │ ├── InstructionLogViewModel.cs │ │ │ ├── MultiModalViewModel.cs │ │ │ ├── PdfCompletionViewModel.cs │ │ │ └── SpeechToTextViewModel.cs │ │ ├── Knowledges │ │ ├── Request │ │ │ ├── CreateVectorCollectionRequest.cs │ │ │ ├── DeleteVectorCollectionSnapshotRequest.cs │ │ │ ├── GetKnowledgeDocsRequest.cs │ │ │ ├── SearchGraphKnowledgeRequest.cs │ │ │ ├── SearchVectorKnowledgeRequest.cs │ │ │ ├── VectorKnowledgeCreateRequest.cs │ │ │ ├── VectorKnowledgeUpdateRequest.cs │ │ │ └── VectorKnowledgeUploadRequest.cs │ │ └── View │ │ │ ├── GraphKnowledgeViewModel.cs │ │ │ ├── KnowledgeFileViewModel.cs │ │ │ ├── VectorCollectionConfigViewModel.cs │ │ │ ├── VectorCollectionDetailsViewModel.cs │ │ │ ├── VectorCollectionSnapshotViewModel.cs │ │ │ └── VectorKnowledgeViewModel.cs │ │ ├── Roles │ │ ├── Request │ │ │ ├── RoleAgentActionViewModel.cs │ │ │ └── RoleViewModel.cs │ │ └── View │ │ │ └── RoleUpdateModel.cs │ │ └── Users │ │ ├── Request │ │ ├── UserAvatarModel.cs │ │ ├── UserCreationModel.cs │ │ ├── UserResetPasswordModel.cs │ │ └── UserUpdateModel.cs │ │ └── View │ │ ├── UserAgentActionViewModel.cs │ │ ├── UserDashboardConversationViewModel.cs │ │ └── UserViewModel.cs ├── Plugins │ ├── BotSharp.Plugin.AnthropicAI │ │ ├── AnthropicPlugin.cs │ │ ├── BotSharp.Plugin.AnthropicAI.csproj │ │ ├── Providers │ │ │ └── ChatCompletionProvider.cs │ │ ├── Settings │ │ │ ├── AnthropicSettings.cs │ │ │ └── ClaudeSetting.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.AudioHandler │ │ ├── AudioHandlerPlugin.cs │ │ ├── BotSharp.Plugin.AudioHandler.csproj │ │ ├── Enums │ │ │ ├── AudioType.cs │ │ │ └── UtilityName.cs │ │ ├── Functions │ │ │ └── HandleAudioRequestFn.cs │ │ ├── Helpers │ │ │ └── AudioHelper.cs │ │ ├── Hooks │ │ │ └── AudioHandlerUtilityHook.cs │ │ ├── LlmContexts │ │ │ ├── LlmContextIn.cs │ │ │ └── LlmContextOut.cs │ │ ├── Models │ │ │ └── AudioOutput.cs │ │ ├── Provider │ │ │ └── NativeWhisperProvider.cs │ │ ├── Settings │ │ │ └── AudioHandlerSettings.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ └── util-audio-handle_audio_request.json │ │ │ └── templates │ │ │ └── util-audio-handle_audio_request.fn.liquid │ ├── BotSharp.Plugin.AzureOpenAI │ │ ├── AzureOpenAiPlugin.cs │ │ ├── BotSharp.Plugin.AzureOpenAI.csproj │ │ ├── Models │ │ │ ├── TextCompletionRequest.cs │ │ │ └── TextCompletionResponse.cs │ │ ├── Providers │ │ │ ├── Audio │ │ │ │ ├── AudioCompletionProvider.SpeechToText.cs │ │ │ │ ├── AudioCompletionProvider.TextToSpeech.cs │ │ │ │ └── AudioCompletionProvider.cs │ │ │ ├── Chat │ │ │ │ └── ChatCompletionProvider.cs │ │ │ ├── Embedding │ │ │ │ └── TextEmbeddingProvider.cs │ │ │ ├── Image │ │ │ │ ├── ImageCompletionProvider.Edit.cs │ │ │ │ ├── ImageCompletionProvider.Generation.cs │ │ │ │ ├── ImageCompletionProvider.Variation.cs │ │ │ │ └── ImageCompletionProvider.cs │ │ │ ├── ProviderHelper.cs │ │ │ └── Text │ │ │ │ └── TextCompletionProvider.cs │ │ ├── Settings │ │ │ └── AzureOpenAiSettings.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.ChatHub │ │ ├── BotSharp.Plugin.ChatHub.csproj │ │ ├── ChatHubMiddleware.cs │ │ ├── ChatHubPlugin.cs │ │ ├── ChatStreamMiddleware.cs │ │ ├── Controllers │ │ │ └── ChatHubController.cs │ │ ├── Enums │ │ │ └── EventDispatchType.cs │ │ ├── Hooks │ │ │ ├── ChatHubConversationHook.cs │ │ │ ├── ChatHubCrontabHook.cs │ │ │ ├── StreamingLogHook.cs │ │ │ └── WelcomeHook.cs │ │ ├── Models │ │ │ └── Stream │ │ │ │ └── ChatStreamEventResponse.cs │ │ ├── Settings │ │ │ └── ChatHubSettings.cs │ │ ├── SignalRHub.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.ChatbotUI │ │ ├── BotSharp.Plugin.ChatbotUI.csproj │ │ ├── Chatbot-UI.md │ │ ├── ChatbotUiController.cs │ │ └── ViewModels │ │ │ ├── OpenAiChatOutput.cs │ │ │ ├── OpenAiChoice.cs │ │ │ ├── OpenAiMessageBody.cs │ │ │ ├── OpenAiMessageInput.cs │ │ │ └── OpenAiModels.cs │ ├── BotSharp.Plugin.CodeDriver │ │ ├── BotSharp.Plugin.CodeDriver.csproj │ │ ├── CodeDriverPlugin.cs │ │ ├── Functions │ │ │ └── SaveSourceCodeFn.cs │ │ ├── Models │ │ │ └── SaveSourceCodeArgs.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── c0ded7d9-3f9d-4ef6-b7ce-56a892dcef62 │ │ │ ├── agent.json │ │ │ ├── functions │ │ │ └── save_source_code.json │ │ │ └── instructions │ │ │ └── instruction.liquid │ ├── BotSharp.Plugin.Dashboard │ │ ├── BotSharp.Plugin.Dashboard.csproj │ │ ├── DashboardPlugin.cs │ │ ├── Hooks │ │ │ └── StatsConversationHook.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.DeepSeekAI │ │ ├── BotSharp.Plugin.DeepSeekAI.csproj │ │ ├── DeepSeekAiPlugin.cs │ │ ├── Providers │ │ │ ├── Chat │ │ │ │ └── ChatCompletionProvider.cs │ │ │ ├── ProviderHelper.cs │ │ │ └── Text │ │ │ │ └── TextCompletionProvider.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.EmailHandler │ │ ├── BotSharp.Plugin.EmailHandler.csproj │ │ ├── EmailHandlerPlugin.cs │ │ ├── Enums │ │ │ └── UtilityName.cs │ │ ├── Functions │ │ │ ├── HandleEmailReaderFn.cs │ │ │ └── HandleEmailSenderFn.cs │ │ ├── Hooks │ │ │ └── EmailHandlerUtilityHook.cs │ │ ├── LlmContexts │ │ │ ├── LlmContextIn.cs │ │ │ ├── LlmContextOut.cs │ │ │ └── LlmContextReader.cs │ │ ├── Models │ │ │ ├── EmailModel.cs │ │ │ └── EmailSubjectElement.cs │ │ ├── Providers │ │ │ ├── DefaultEmailReader.cs │ │ │ └── IEmailReader.cs │ │ ├── Settings │ │ │ ├── EmailReaderSettings.cs │ │ │ └── EmailSenderSettings.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ ├── util-email-handle_email_reader.json │ │ │ └── util-email-handle_email_sender.json │ │ │ └── templates │ │ │ ├── util-email-handle_email_reader.fn.liquid │ │ │ └── util-email-handle_email_sender.fn.liquid │ ├── BotSharp.Plugin.ExcelHandler │ │ ├── BotSharp.Plugin.ExcelHandler.csproj │ │ ├── Enums │ │ │ └── UtilityName.cs │ │ ├── ExcelHandlerPlugin.cs │ │ ├── Functions │ │ │ └── HandleExcelRequestFn.cs │ │ ├── Helpers │ │ │ ├── MySql │ │ │ │ ├── IMySqlDbHelper.cs │ │ │ │ └── MySqlDbHelpers.cs │ │ │ └── Sqlite │ │ │ │ ├── ISqliteDbHelpers.cs │ │ │ │ └── SqliteDbHelpers.cs │ │ ├── Hooks │ │ │ └── ExcelHandlerUtilityHook.cs │ │ ├── LlmContexts │ │ │ ├── LlmContextIn.cs │ │ │ └── LlmContextOut.cs │ │ ├── Models │ │ │ └── SqlContextOut.cs │ │ ├── Services │ │ │ ├── IDbService.cs │ │ │ ├── IMySqlService.cs │ │ │ ├── ISqliteService.cs │ │ │ ├── MySqlService.cs │ │ │ └── SqliteService.cs │ │ ├── Settings │ │ │ └── ExcelHandlerSettings.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ └── util-excel-handle_excel_request.json │ │ │ └── templates │ │ │ └── util-excel-handle_excel_request.fn.liquid │ ├── BotSharp.Plugin.FileHandler │ │ ├── BotSharp.Plugin.FileHandler.csproj │ │ ├── Enums │ │ │ └── UtilityName.cs │ │ ├── FileHandlerPlugin.cs │ │ ├── Functions │ │ │ ├── EditImageFn.cs │ │ │ ├── GenerateImageFn.cs │ │ │ ├── ReadImageFn.cs │ │ │ └── ReadPdfFn.cs │ │ ├── Hooks │ │ │ └── FileHandlerUtilityHook.cs │ │ ├── LlmContexts │ │ │ ├── LlmContextIn.cs │ │ │ └── LlmContextOut.cs │ │ ├── Settings │ │ │ └── FileHandlerSettings.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ ├── util-file-edit_image.json │ │ │ ├── util-file-generate_image.json │ │ │ ├── util-file-read_image.json │ │ │ └── util-file-read_pdf.json │ │ │ └── templates │ │ │ ├── util-file-edit_image.fn.liquid │ │ │ ├── util-file-generate_image.fn.liquid │ │ │ ├── util-file-read_image.fn.liquid │ │ │ └── util-file-read_pdf.fn.liquid │ ├── BotSharp.Plugin.GoogleAI │ │ ├── BotSharp.Plugin.GoogleAI.csproj │ │ ├── GoogleAiPlugin.cs │ │ ├── Models │ │ │ └── Realtime │ │ │ │ ├── RealtimeClientPayload.cs │ │ │ │ ├── RealtimeGenerateContentSetup.cs │ │ │ │ ├── RealtimeServerResponse.cs │ │ │ │ └── RealtimeTranscriptionResponse.cs │ │ ├── Providers │ │ │ ├── Chat │ │ │ │ ├── GeminiChatCompletionProvider.cs │ │ │ │ └── PalmChatCompletionProvider.cs │ │ │ ├── Embedding │ │ │ │ └── TextEmbeddingProvider.cs │ │ │ ├── ProviderHelper.cs │ │ │ ├── Realtime │ │ │ │ └── RealTimeCompletionProvider.cs │ │ │ └── Text │ │ │ │ ├── GeminiTextCompletionProvider.cs │ │ │ │ └── PalmTextCompletionProvider.cs │ │ ├── Settings │ │ │ └── GoogleAiSettings.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.Graph │ │ ├── BotSharp.Plugin.Graph.csproj │ │ ├── GraphDb.cs │ │ ├── GraphDbSettings.cs │ │ ├── GraphPlugin.cs │ │ ├── Models │ │ │ └── GraphQueryRequest.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.HttpHandler │ │ ├── BotSharp.Plugin.HttpHandler.csproj │ │ ├── Enums │ │ │ └── UtilityName.cs │ │ ├── Functions │ │ │ └── HandleHttpRequestFn.cs │ │ ├── Hooks │ │ │ ├── BasicHttpRequestHook.cs │ │ │ └── HttpHandlerUtilityHook.cs │ │ ├── HttpHandlerPlugin.cs │ │ ├── LlmContexts │ │ │ └── LlmContextIn.cs │ │ ├── Settings │ │ │ └── HttpHandlerSettings.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ ├── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ │ └── util-http-handle_http_request.json │ │ │ └── templates │ │ │ │ └── util-http-handle_http_request.fn.liquid │ │ │ └── 87c458fc-ec5f-40ae-8ed6-05dda8a07523 │ │ │ ├── agent.json │ │ │ └── instructions │ │ │ └── instruction.liquid │ ├── BotSharp.Plugin.HuggingFace │ │ ├── BotSharp.Plugin.HuggingFace.csproj │ │ ├── DataModels │ │ │ ├── InferenceInput.cs │ │ │ ├── InferenceInputOptions.cs │ │ │ ├── InferenceInputParameters.cs │ │ │ └── TextGenResponse.cs │ │ ├── HuggingChat-UI.md │ │ ├── HuggingChat │ │ │ ├── HuggingChatController.cs │ │ │ ├── TextToken.cs │ │ │ └── ViewModels │ │ │ │ ├── ChatInput.cs │ │ │ │ ├── ChatResponse.cs │ │ │ │ ├── ConversationCreationModel.cs │ │ │ │ └── ConversationViewModel.cs │ │ ├── HuggingFacePlugin.cs │ │ ├── Providers │ │ │ └── ChatCompletionProvider.cs │ │ ├── Services │ │ │ ├── AuthHeaderHandler.cs │ │ │ └── IInferenceApi.cs │ │ ├── Settings │ │ │ └── HuggingFaceSettings.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.JavaScriptInterpreter │ │ ├── BotSharp.Plugin.JavaScriptInterpreter.csproj │ │ └── JsInterpreterPlugin.cs │ ├── BotSharp.Plugin.KnowledgeBase │ │ ├── BotSharp.Plugin.KnowledgeBase.csproj │ │ ├── Converters │ │ │ └── PigPdf2TextConverter.cs │ │ ├── Enum │ │ │ └── UtilityName.cs │ │ ├── Functions │ │ │ ├── ConfirmKnowledgePersistenceFn.cs │ │ │ ├── KnowledgeRetrievalFn.cs │ │ │ └── MemorizeKnowledgeFn.cs │ │ ├── Helpers │ │ │ ├── KnowledgeSettingHelper.cs │ │ │ └── VectorHelper.cs │ │ ├── Hooks │ │ │ ├── KnowledgeBaseUtilityHook.cs │ │ │ └── KnowledgeHook.cs │ │ ├── KnowledgeBasePlugin.cs │ │ ├── MemVecDb │ │ │ ├── MemVecDbPlugin.cs │ │ │ ├── MemoryVectorDb.cs │ │ │ └── VecRecord.cs │ │ ├── Services │ │ │ ├── KnowledgeService.Common.cs │ │ │ ├── KnowledgeService.Document.cs │ │ │ ├── KnowledgeService.Graph.cs │ │ │ ├── KnowledgeService.Snapshot.cs │ │ │ ├── KnowledgeService.Vector.cs │ │ │ └── KnowledgeService.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ ├── 01acc3e5-0af7-49e6-ad7a-a760bd12dc40 │ │ │ ├── agent.json │ │ │ ├── functions │ │ │ │ ├── confirm_knowledge_persistence.json │ │ │ │ └── memorize_knowledge.json │ │ │ ├── instructions │ │ │ │ └── instruction.liquid │ │ │ └── templates │ │ │ │ ├── knowledge.generation.plain.liquid │ │ │ │ └── knowledge.generation.refine.liquid │ │ │ └── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ └── util-kg-knowledge_retrieval.json │ │ │ └── templates │ │ │ └── util-kg-knowledge_retrieval.fn.liquid │ ├── BotSharp.Plugin.LLamaSharp │ │ ├── BotSharp.Plugin.LLamaSharp.csproj │ │ ├── LLamaSharpPlugin.cs │ │ ├── LlamaAiModel.cs │ │ ├── Providers │ │ │ ├── ChatCompletionProvider.cs │ │ │ ├── TextCompletionProvider.cs │ │ │ └── TextEmbeddingProvider.cs │ │ ├── Settings │ │ │ └── LlamaSharpSettings.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.LangChain │ │ ├── BotSharp.Plugin.VertexAI.csproj │ │ ├── Providers │ │ │ ├── ChatCompletionProvider.cs │ │ │ └── TextCompletionProvider.cs │ │ └── VertexAiPlugin.cs │ ├── BotSharp.Plugin.MetaAI │ │ ├── BotSharp.Plugin.MetaAI.csproj │ │ ├── MetaAiPlugin.cs │ │ ├── Providers │ │ │ └── fastTextEmbeddingProvider.cs │ │ └── Settings │ │ │ ├── MetaAiSettings.cs │ │ │ └── fastTextSetting.cs │ ├── BotSharp.Plugin.MetaGLM │ │ ├── AuthenicationUtils.cs │ │ ├── BotSharp.Plugin.MetaGLM.csproj │ │ ├── MessageItemConverter.cs │ │ ├── MetaGLMClient.cs │ │ ├── MetaGLMPlugin.cs │ │ ├── Models │ │ │ ├── RequestModels │ │ │ │ ├── EmbeddingRequestBase.cs │ │ │ │ ├── FunctionModels │ │ │ │ │ ├── FunctionParameterDescriptor.cs │ │ │ │ │ ├── FunctionParameters.cs │ │ │ │ │ └── FunctionTool.cs │ │ │ │ ├── ImageRequestBase.cs │ │ │ │ ├── ImageToTextModels │ │ │ │ │ ├── ContentType.cs │ │ │ │ │ ├── ImageToTextMessageItem.cs │ │ │ │ │ └── ImageUrlType.cs │ │ │ │ ├── MessageItem.cs │ │ │ │ └── TextRequestBase.cs │ │ │ └── ResponseModels │ │ │ │ ├── EmbeddingModels │ │ │ │ ├── EmbeddingDataItem.cs │ │ │ │ └── EmbeddingResponseBase.cs │ │ │ │ ├── ImageGenerationModels │ │ │ │ ├── ImageResponseBase.cs │ │ │ │ └── ImageResponseDataItem.cs │ │ │ │ ├── ResponseBase.cs │ │ │ │ ├── ResponseChoiceDelta.cs │ │ │ │ ├── ResponseChoiceItem.cs │ │ │ │ └── ToolModels │ │ │ │ ├── FunctionDescriptor.cs │ │ │ │ └── ToolCallItem.cs │ │ ├── Modules │ │ │ ├── Chat.cs │ │ │ ├── Embeddings.cs │ │ │ └── Images.cs │ │ ├── Providers │ │ │ ├── ChatCompletionProvider.cs │ │ │ └── ProviderHelper.cs │ │ ├── Settings │ │ │ └── MetaGLMSettings.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.MetaMessenger │ │ ├── BotSharp.Plugin.MetaMessenger.csproj │ │ ├── Controllers │ │ │ └── WebhookController.cs │ │ ├── GraphAPIs │ │ │ ├── AuthHeaderHandler.cs │ │ │ └── IMessengerGraphAPI.cs │ │ ├── MessagingModels │ │ │ ├── AttachmentBody.cs │ │ │ ├── AttachmentMessage.cs │ │ │ ├── ButtonItem.cs │ │ │ ├── SendingMessageRequest.cs │ │ │ └── SendingMessageResponse.cs │ │ ├── MetaMessengerPlugin.cs │ │ ├── Services │ │ │ ├── ConditionalSerialization.cs │ │ │ └── MessageHandleService.cs │ │ ├── Settings │ │ │ └── MetaMessengerSetting.cs │ │ ├── Using.cs │ │ └── WebhookModels │ │ │ ├── WebhookMessage.cs │ │ │ ├── WebhookMessageBody.cs │ │ │ ├── WebhookMessagePostback.cs │ │ │ ├── WebhookMessageUser.cs │ │ │ ├── WebhookObject.cs │ │ │ ├── WebhookRequest.cs │ │ │ └── WebhookResponse.cs │ ├── BotSharp.Plugin.MicrosoftExtensionsAI │ │ ├── BotSharp.Plugin.MicrosoftExtensionsAI.csproj │ │ ├── MicrosoftExtensionsAIChatCompletionProvider.cs │ │ ├── MicrosoftExtensionsAIPlugin.cs │ │ ├── MicrosoftExtensionsAITextCompletionProvider.cs │ │ ├── MicrosoftExtensionsAITextEmbeddingProvider.cs │ │ └── ProviderHelper.cs │ ├── BotSharp.Plugin.MongoStorage │ │ ├── BotSharp.Plugin.MongoStorage.csproj │ │ ├── Collections │ │ │ ├── AgentDocument.cs │ │ │ ├── AgentTaskDocument.cs │ │ │ ├── ConversationContentLogDocument.cs │ │ │ ├── ConversationDialogDocument.cs │ │ │ ├── ConversationDocument.cs │ │ │ ├── ConversationStateDocument.cs │ │ │ ├── ConversationStateLogDocument.cs │ │ │ ├── CrontabItemDocument.cs │ │ │ ├── GlobalStatisticsDocument.cs │ │ │ ├── InstructionLogDocument.cs │ │ │ ├── KnowledgeCollectionConfigDocument.cs │ │ │ ├── KnowledgeCollectionFileMetaDocument.cs │ │ │ ├── LlmCompletionLogDocument.cs │ │ │ ├── PluginDocument.cs │ │ │ ├── RoleAgentDocument.cs │ │ │ ├── RoleDocument.cs │ │ │ ├── TranslationMemoryDocument.cs │ │ │ ├── UserAgentDocument.cs │ │ │ └── UserDocument.cs │ │ ├── Models │ │ │ ├── AgentKnowledgeBaseMongoElement.cs │ │ │ ├── AgentLlmConfigMongoElement.cs │ │ │ ├── AgentMCPToolMongoElement.cs │ │ │ ├── AgentResponseMongoElement.cs │ │ │ ├── AgentRuleMongoElement.cs │ │ │ ├── AgentTemplateMongoElement.cs │ │ │ ├── AgentUtilityMongoElement.cs │ │ │ ├── BreakpointMongoElement.cs │ │ │ ├── ChannelInstructionMongoElement.cs │ │ │ ├── CronTaskMongoElement.cs │ │ │ ├── DialogMongoElement.cs │ │ │ ├── FunctionDefMongoElement.cs │ │ │ ├── GlobalStatsMongoElement.cs │ │ │ ├── KnowledgeEmbeddingConfigMongoModel.cs │ │ │ ├── KnowledgeFileMetaRefMongoModel.cs │ │ │ ├── KnowledgeVectorStoreConfigMongoModel.cs │ │ │ ├── RoutingRuleMongoElement.cs │ │ │ ├── StateMongoElement.cs │ │ │ └── TranslationMemoryMongoElement.cs │ │ ├── MongoBase.cs │ │ ├── MongoDbContext.cs │ │ ├── MongoStoragePlugin.cs │ │ ├── Repository │ │ │ ├── MongoRepository.Agent.cs │ │ │ ├── MongoRepository.AgentTask.cs │ │ │ ├── MongoRepository.Conversation.cs │ │ │ ├── MongoRepository.Crontab.cs │ │ │ ├── MongoRepository.KnowledgeBase.cs │ │ │ ├── MongoRepository.Log.cs │ │ │ ├── MongoRepository.Plugin.cs │ │ │ ├── MongoRepository.Role.cs │ │ │ ├── MongoRepository.Stats.cs │ │ │ ├── MongoRepository.Translation.cs │ │ │ ├── MongoRepository.User.cs │ │ │ └── MongoRepository.cs │ │ ├── StringGuidIdGenerator.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.OpenAI │ │ ├── BotSharp.Plugin.OpenAI.csproj │ │ ├── Models │ │ │ ├── Realtime │ │ │ │ ├── ConversationItemCreated.cs │ │ │ │ ├── RealtimeSessionBody.cs │ │ │ │ ├── RealtimeSessionRequest.cs │ │ │ │ ├── RealtimeSessionUpdate.cs │ │ │ │ ├── ResponseAudioDelta.cs │ │ │ │ ├── ResponseAudioTranscript.cs │ │ │ │ ├── ResponseDone.cs │ │ │ │ ├── ServerEventErrorResponse.cs │ │ │ │ ├── ServerEventResponse.cs │ │ │ │ └── SessionServerEventResponse.cs │ │ │ ├── SpeechToTextRequest.cs │ │ │ ├── TextCompletionRequest.cs │ │ │ └── TextCompletionResponse.cs │ │ ├── OpenAiPlugin.cs │ │ ├── Providers │ │ │ ├── Audio │ │ │ │ ├── AudioSynthesisProvider.cs │ │ │ │ └── AudioTranscriptionProvider.cs │ │ │ ├── Chat │ │ │ │ └── ChatCompletionProvider.cs │ │ │ ├── Embedding │ │ │ │ └── TextEmbeddingProvider.cs │ │ │ ├── Image │ │ │ │ ├── ImageCompletionProvider.Edit.cs │ │ │ │ ├── ImageCompletionProvider.Generation.cs │ │ │ │ ├── ImageCompletionProvider.Variation.cs │ │ │ │ └── ImageCompletionProvider.cs │ │ │ ├── ProviderHelper.cs │ │ │ ├── Realtime │ │ │ │ └── RealTimeCompletionProvider.cs │ │ │ └── Text │ │ │ │ └── TextCompletionProvider.cs │ │ ├── Settings │ │ │ └── OpenAiSettings.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.OsDriver │ │ ├── BotSharp.Plugin.OsDriver.csproj │ │ ├── CoordinateScaler.cs │ │ ├── KeyboardSimulator.cs │ │ ├── OsDriverPlugin.cs │ │ ├── ScreenshotWinOS.cs │ │ ├── Using.cs │ │ ├── WinOSDriver.cs │ │ └── WindowsMouseController.cs │ ├── BotSharp.Plugin.PaddleSharp │ │ ├── BotSharp.Plugin.PaddleSharp.csproj │ │ ├── PaddleSharpPlugin.cs │ │ ├── Providers │ │ │ ├── PaddleOcrConverter.cs │ │ │ └── Pdf2TextConverter.cs │ │ └── Settings │ │ │ └── PaddleSharpSettings.cs │ ├── BotSharp.Plugin.Planner │ │ ├── BotSharp.Plugin.Planner.csproj │ │ ├── Enums │ │ │ ├── PlannerAgentId.cs │ │ │ └── UtilityName.cs │ │ ├── PlannerPlugin.cs │ │ ├── Sequential │ │ │ └── SequentialPlanner.cs │ │ ├── SqlGeneration │ │ │ ├── Functions │ │ │ │ ├── SqlGenerationFn.cs │ │ │ │ ├── SqlPrimaryStageFn.cs │ │ │ │ ├── SqlReviewFn.cs │ │ │ │ └── SqlSecondaryStageFn.cs │ │ │ ├── Hooks │ │ │ │ └── SqlPlannerAgentHook.cs │ │ │ ├── Models │ │ │ │ ├── SqlPrimaryStagePlan.cs │ │ │ │ ├── SqlReviewArgs.cs │ │ │ │ └── SqlSecondStagePlan.cs │ │ │ └── SqlGenerationPlanner.cs │ │ ├── TwoStaging │ │ │ ├── Functions │ │ │ │ ├── PrimaryStagePlanFn.cs │ │ │ │ ├── SecondaryStagePlanFn.cs │ │ │ │ └── SummaryPlanFn.cs │ │ │ ├── Hooks │ │ │ │ └── TwoStagingPlannerUtilityHook.cs │ │ │ ├── Models │ │ │ │ ├── FirstStagePlan.cs │ │ │ │ ├── PrimaryRequirementRequest.cs │ │ │ │ ├── SecondStagePlan.cs │ │ │ │ ├── SecondaryBreakdownTask.cs │ │ │ │ └── SummaryPlan.cs │ │ │ └── TwoStageTaskPlanner.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ ├── 282a7128-69a1-44b0-878c-a9159b88f3b9 │ │ │ ├── agent.json │ │ │ ├── functions │ │ │ │ ├── plan_primary_stage.json │ │ │ │ ├── plan_secondary_stage.json │ │ │ │ └── plan_summary.json │ │ │ ├── instructions │ │ │ │ └── instruction.liquid │ │ │ └── templates │ │ │ │ ├── two_stage.1st.plan.liquid │ │ │ │ ├── two_stage.2nd.plan.liquid │ │ │ │ ├── two_stage.next.liquid │ │ │ │ └── two_stage.summarize.liquid │ │ │ ├── 3e75e818-a139-48a8-9e22-4662548c13a3 │ │ │ ├── agent.json │ │ │ └── instructions │ │ │ │ └── instruction.liquid │ │ │ ├── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ └── templates │ │ │ │ ├── util-planner-plan_primary_stage.fn.liquid │ │ │ │ ├── util-planner-plan_secondary_stage.fn.liquid │ │ │ │ └── util-planner-plan_summary.fn.liquid │ │ │ └── da7aad2c-8112-48a2-ab7b-1f87da524741 │ │ │ ├── agent.json │ │ │ ├── functions │ │ │ ├── sql_generation.json │ │ │ ├── sql_primary_stage.json │ │ │ ├── sql_review.json │ │ │ └── sql_secondary_stage.json │ │ │ ├── instructions │ │ │ └── instruction.liquid │ │ │ └── templates │ │ │ ├── sql.generation.liquid │ │ │ ├── sql.next.liquid │ │ │ ├── sql.primary.plan.liquid │ │ │ └── sql.secondary.plan.liquid │ ├── BotSharp.Plugin.PythonInterpreter │ │ ├── BotSharp.Plugin.PythonInterpreter.csproj │ │ ├── Enums │ │ │ └── UtilityName.cs │ │ ├── Functions │ │ │ └── InterpretationFn.cs │ │ ├── Hooks │ │ │ └── InterpreterUtilityHook.cs │ │ ├── InterpreterPlugin.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ └── python_interpreter.json │ │ │ └── templates │ │ │ └── python_interpreter.fn.liquid │ ├── BotSharp.Plugin.Qdrant │ │ ├── BotSharp.Plugin.Qdrant.csproj │ │ ├── Models │ │ │ └── RecoverFromSnapshotResponse.cs │ │ ├── QdrantDb.cs │ │ ├── QdrantPlugin.cs │ │ ├── QdrantSetting.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.RoutingSpeeder │ │ ├── BotSharp.Plugin.RoutingSpeeder.csproj │ │ ├── Controllers │ │ │ └── RoutingSpeederController.cs │ │ ├── Providers │ │ │ ├── IntentClassifier.cs │ │ │ └── Models │ │ │ │ ├── DialoguePredictionModel.cs │ │ │ │ └── TrainingParams.cs │ │ ├── RoutingConversationHook.cs │ │ ├── RoutingSpeederPlugin.cs │ │ ├── Settings │ │ │ ├── classifierSetting.cs │ │ │ └── routerSpeedSettings.cs │ │ └── data │ │ │ └── models │ │ │ ├── dbpedia.ftz │ │ │ ├── intent-classifier.h5 │ │ │ └── label.txt │ ├── BotSharp.Plugin.Selenium │ │ ├── BotSharp.Plugin.Selenium.csproj │ │ ├── Drivers │ │ │ ├── SeleniumInstance.cs │ │ │ ├── SeleniumWebDriver.DoAction.cs │ │ │ ├── SeleniumWebDriver.EvaluateScript.cs │ │ │ ├── SeleniumWebDriver.GetAttributeValue.cs │ │ │ ├── SeleniumWebDriver.GoToPage.cs │ │ │ ├── SeleniumWebDriver.HttpRequest.cs │ │ │ ├── SeleniumWebDriver.LaunchBrowser.cs │ │ │ ├── SeleniumWebDriver.LocateElement.cs │ │ │ └── SeleniumWebDriver.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.SemanticKernel │ │ ├── BotSharp.Plugin.SemanticKernel.csproj │ │ ├── SemanticKernelChatCompletionProvider.cs │ │ ├── SemanticKernelMemoryStoreProvider.cs │ │ ├── SemanticKernelPlugin.cs │ │ ├── SemanticKernelTextCompletionProvider.cs │ │ ├── SemanticKernelTextEmbeddingProvider.cs │ │ └── readme.md │ ├── BotSharp.Plugin.SparkDesk │ │ ├── BotSharp.Plugin.SparkDesk.csproj │ │ ├── Providers │ │ │ ├── ChatCompletionProvider.cs │ │ │ └── ProviderHelper.cs │ │ ├── Settings │ │ │ └── SparkDeskSettings.cs │ │ ├── SparkDeskPlugin.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.SqlDriver │ │ ├── BotSharp.Plugin.SqlDriver.csproj │ │ ├── Functions │ │ │ ├── ExecuteQueryFn.cs │ │ │ ├── GetTableDefinitionFn.cs │ │ │ ├── SqlInsertFn.cs │ │ │ ├── SqlSelect.cs │ │ │ ├── SqlValidateFn.cs │ │ │ └── VerifyDictionaryTerm.cs │ │ ├── Helpers │ │ │ └── SqlDriverHelper.cs │ │ ├── Hooks │ │ │ ├── SqlDriverAgentHook.cs │ │ │ ├── SqlDriverConversationHook.cs │ │ │ ├── SqlDriverCrontabHook.cs │ │ │ ├── SqlDriverKnowledgeHook.cs │ │ │ ├── SqlDriverPlanningHook.cs │ │ │ └── SqlUtilityHook.cs │ │ ├── Interfaces │ │ │ └── ISqlDriverHook.cs │ │ ├── Models │ │ │ ├── ExecuteQueryArgs.cs │ │ │ ├── GetTableColumnsArgs.cs │ │ │ ├── LookupDictionary.cs │ │ │ ├── RequestBase.cs │ │ │ ├── SqlParameter.cs │ │ │ ├── SqlReturn.cs │ │ │ └── SqlStatement.cs │ │ ├── Services │ │ │ ├── DbKnowledgeService.cs │ │ │ └── SqlDriverService.cs │ │ ├── Settings │ │ │ └── SqlDriverSetting.cs │ │ ├── SqlDriverPlugin.cs │ │ ├── Using.cs │ │ ├── UtilFunctions │ │ │ ├── GetTableDefinitionFn.cs │ │ │ ├── SqlSelect.cs │ │ │ └── VerifyDictionaryTerm.cs │ │ └── data │ │ │ └── agents │ │ │ ├── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ ├── functions │ │ │ │ ├── util-db-sql_select.json │ │ │ │ ├── util-db-sql_table_definition.json │ │ │ │ └── util-db-verify_dictionary_term.json │ │ │ └── templates │ │ │ │ ├── util-db-sql_executor.fn.liquid │ │ │ │ ├── util-db-sql_table_definition.fn.liquid │ │ │ │ └── util-db-verify_dictionary_term.fn.liquid │ │ │ └── beda4c12-e1ec-4b4b-b328-3df4a6687c4f │ │ │ ├── agent.json │ │ │ ├── functions │ │ │ ├── execute_sql.json │ │ │ ├── sql_insert.json │ │ │ ├── sql_select.json │ │ │ └── sql_table_definition.json │ │ │ ├── instructions │ │ │ └── instruction.liquid │ │ │ └── templates │ │ │ ├── database.dictionary.sql.liquid │ │ │ ├── database.summarize.mysql.liquid │ │ │ ├── database.summarize.redshift.liquid │ │ │ ├── database.summarize.sqlserver.liquid │ │ │ ├── query_result_formatting.liquid │ │ │ ├── render_buttons.liquid │ │ │ └── sql_statement_correctness.liquid │ ├── BotSharp.Plugin.TelegramBots │ │ ├── BotSharp.Plugin.TelegramBots.csproj │ │ └── TelegramBotsPlugin.cs │ ├── BotSharp.Plugin.TencentCos │ │ ├── BotSharp.Plugin.TencentCos.csproj │ │ ├── Modules │ │ │ └── BucketClient.cs │ │ ├── Services │ │ │ ├── TencentCosService.Audio.cs │ │ │ ├── TencentCosService.Common.cs │ │ │ ├── TencentCosService.Conversation.cs │ │ │ ├── TencentCosService.KnowledgeBase.cs │ │ │ ├── TencentCosService.User.cs │ │ │ └── TencentCosService.cs │ │ ├── Settings │ │ │ └── TencentCosSettings.cs │ │ ├── TencentCosClient.cs │ │ ├── TencentCosPlugin.cs │ │ └── Using.cs │ ├── BotSharp.Plugin.Twilio │ │ ├── BotSharp.Plugin.Twilio.csproj │ │ ├── Controllers │ │ │ ├── TwilioEmailController.cs │ │ │ ├── TwilioInboundController.cs │ │ │ ├── TwilioOutboundController.cs │ │ │ ├── TwilioReconnectController.cs │ │ │ ├── TwilioRecordController.cs │ │ │ ├── TwilioTranscribeController.cs │ │ │ └── TwilioVoiceController.cs │ │ ├── Hooks │ │ │ └── TwilioConversationHook.cs │ │ ├── Interfaces │ │ │ ├── ITwilioCallStatusHook.cs │ │ │ ├── ITwilioSessionHook.cs │ │ │ └── ITwilioSessionManager.cs │ │ ├── Models │ │ │ ├── AssistantMessage.cs │ │ │ ├── CallerMessage.cs │ │ │ ├── ConversationalVoiceRequest.cs │ │ │ ├── ConversationalVoiceResponse.cs │ │ │ └── Stream │ │ │ │ ├── StreamEventDtmfResponse.cs │ │ │ │ ├── StreamEventMediaResponse.cs │ │ │ │ ├── StreamEventResponse.cs │ │ │ │ ├── StreamEventStartResponse.cs │ │ │ │ ├── StreamEventStopResponse.cs │ │ │ │ └── TwilioHubCallerContext.cs │ │ ├── OutboundPhoneCallHandler │ │ │ ├── Enums │ │ │ │ └── UtilityName.cs │ │ │ ├── Functions │ │ │ │ ├── HangupPhoneCallFn.cs │ │ │ │ ├── LeaveVoicemailFn.cs │ │ │ │ ├── OutboundPhoneCallFn.cs │ │ │ │ ├── TextMessageFn.cs │ │ │ │ └── TransferPhoneCallFn.cs │ │ │ ├── Hooks │ │ │ │ └── OutboundPhoneCallHandlerUtilityHook.cs │ │ │ └── LlmContexts │ │ │ │ ├── ForwardPhoneCallArgs.cs │ │ │ │ ├── HangupPhoneCallArgs.cs │ │ │ │ ├── LeaveVoicemailArgs.cs │ │ │ │ ├── LlmContextIn.cs │ │ │ │ └── LlmContextOut.cs │ │ ├── Services │ │ │ ├── TwilioMessageQueue.cs │ │ │ ├── TwilioMessageQueueService.cs │ │ │ ├── TwilioService.cs │ │ │ └── TwilioSessionManager.cs │ │ ├── Settings │ │ │ └── TwilioSetting.cs │ │ ├── TwilioPlugin.cs │ │ ├── TwilioStreamMiddleware.cs │ │ ├── Using.cs │ │ └── data │ │ │ └── agents │ │ │ └── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ │ └── functions │ │ │ ├── util-twilio-hangup_phone_call.json │ │ │ ├── util-twilio-leave_voicemail.json │ │ │ ├── util-twilio-outbound_phone_call.json │ │ │ ├── util-twilio-text_message.json │ │ │ └── util-twilio-transfer_phone_call.json │ ├── BotSharp.Plugin.WeChat │ │ ├── BotSharp.Plugin.WeChat.csproj │ │ ├── BotSharpMessageHandler.cs │ │ ├── IMessageQueue.cs │ │ ├── README.md │ │ ├── Users │ │ │ ├── IWeChatAccountUserService.cs │ │ │ └── WeChatAccountUserService.cs │ │ ├── WeChatBackgroundService.cs │ │ ├── WeChatMessage.cs │ │ └── WeChatPlugin.cs │ └── BotSharp.Plugin.WebDriver │ │ ├── BotSharp.Plugin.WebDriver.csproj │ │ ├── Drivers │ │ └── PlaywrightDriver │ │ │ ├── PlaywrightInstance.cs │ │ │ ├── PlaywrightWebDriver.ActionOnElement.cs │ │ │ ├── PlaywrightWebDriver.ChangeCheckbox.cs │ │ │ ├── PlaywrightWebDriver.ChangeListValue.cs │ │ │ ├── PlaywrightWebDriver.CheckRadioButton.cs │ │ │ ├── PlaywrightWebDriver.ClickButton.cs │ │ │ ├── PlaywrightWebDriver.ClickElement.cs │ │ │ ├── PlaywrightWebDriver.CloseBrowser.cs │ │ │ ├── PlaywrightWebDriver.CloseCurrentPage.cs │ │ │ ├── PlaywrightWebDriver.DoAction.cs │ │ │ ├── PlaywrightWebDriver.EvaluateScript.cs │ │ │ ├── PlaywrightWebDriver.ExtractData.cs │ │ │ ├── PlaywrightWebDriver.GetAttributeValue.cs │ │ │ ├── PlaywrightWebDriver.GoToPage.cs │ │ │ ├── PlaywrightWebDriver.HttpRequest.cs │ │ │ ├── PlaywrightWebDriver.InputUserPassword.cs │ │ │ ├── PlaywrightWebDriver.InputUserText.cs │ │ │ ├── PlaywrightWebDriver.LaunchBrowser.cs │ │ │ ├── PlaywrightWebDriver.LocateElement.cs │ │ │ ├── PlaywrightWebDriver.Screenshot.cs │ │ │ ├── PlaywrightWebDriver.ScrollPage.cs │ │ │ └── PlaywrightWebDriver.cs │ │ ├── Functions │ │ ├── ChangeCheckboxFn.cs │ │ ├── ChangeListValueFn.cs │ │ ├── CheckRadioButtonFn.cs │ │ ├── ClickButtonFn.cs │ │ ├── ClickElementFn.cs │ │ ├── CloseBrowserFn.cs │ │ ├── EvaluateScriptFn.cs │ │ ├── ExtractDataFn.cs │ │ ├── GoToPageFn.cs │ │ ├── HttpRequestFn.cs │ │ ├── InputUserPasswordFn.cs │ │ ├── InputUserTextFn.cs │ │ ├── OpenBrowserFn.cs │ │ ├── ScreenshotFn.cs │ │ └── ScrollPageFn.cs │ │ ├── Hooks │ │ ├── WebDriverConversationHook.cs │ │ └── WebUtilityHook.cs │ │ ├── LlmContexts │ │ └── HtmlElementContextOut.cs │ │ ├── Models │ │ └── MarkupProperties.cs │ │ ├── README.md │ │ ├── Services │ │ ├── WebDriverService.AssembleMarkup.cs │ │ ├── WebDriverService.ExtraData.cs │ │ ├── WebDriverService.GetMessageContext.cs │ │ ├── WebDriverService.InferElement.cs │ │ ├── WebDriverService.ReplaceToken.cs │ │ ├── WebDriverService.Screenshot.cs │ │ └── WebDriverService.cs │ │ ├── Using.cs │ │ ├── UtilFunctions │ │ ├── UtilWebActionOnElementFn.cs │ │ ├── UtilWebCloseBrowserFn.cs │ │ ├── UtilWebGoToPageFn.cs │ │ └── UtilWebLocateElementFn.cs │ │ ├── WebDriverPlugin.cs │ │ ├── WebPageHelper.cs │ │ └── data │ │ └── agents │ │ ├── 6745151e-6d46-4a02-8de4-1c4f21c7da95 │ │ ├── functions │ │ │ ├── util-web-action_on_element.json │ │ │ ├── util-web-close_browser.json │ │ │ ├── util-web-go_to_page.json │ │ │ └── util-web-locate_element.json │ │ └── templates │ │ │ ├── util-web-action_on_element.fn.liquid │ │ │ └── util-web-go_to_page.fn.liquid │ │ └── f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b │ │ ├── agent.json │ │ ├── functions │ │ ├── change_checkbox.json │ │ ├── change_list_value.json │ │ ├── check_radio_button.json │ │ ├── click_button.json │ │ ├── click_element.json │ │ ├── close_browser.json │ │ ├── extract_data_from_page.json │ │ ├── go_to_page.json │ │ ├── input_user_password.json │ │ ├── input_user_text.json │ │ ├── open_browser.json │ │ ├── scroll_page.json │ │ ├── send_http_request.json │ │ └── take_screenshot.json │ │ ├── instructions │ │ └── instruction.liquid │ │ └── templates │ │ ├── extract_data.liquid │ │ └── html_parser.liquid └── WebStarter │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── WebStarter.csproj │ ├── WebStarter.sln │ ├── appsettings.Development.json │ ├── appsettings.json │ └── wwwroot │ └── favicon.ico └── tests ├── BotSharp.LLM.Tests ├── BotSharp.LLM.Tests.csproj ├── ChatCompletionTests.cs ├── Core │ ├── LLMProvider.cs │ ├── NullConversationStateService.cs │ ├── NullFileStorageService.cs │ └── TestAgentService.cs ├── EmbeddingTests.cs ├── FunctionCallingTests.cs ├── GoogleRealTimeTests.cs ├── TestBase.cs ├── appsettings.Development.json └── appsettings.json ├── BotSharp.PizzaBot.MCPServer ├── BotSharp.PizzaBot.MCPServer.csproj ├── Program.cs ├── Properties │ └── launchSettings.json └── Tools │ ├── MakePayment.cs │ ├── PizzaPrices.cs │ └── PlaceOrder.cs ├── BotSharp.Plugin.PizzaBot ├── BotSharp.Plugin.PizzaBot.csproj ├── Functions │ ├── GetOrderStatusFn.cs │ ├── GetPizzaPricesFn.cs │ ├── GetPizzaTypesFn.cs │ ├── MakePaymentFn.cs │ └── PlaceOrderFn.cs ├── Hooks │ ├── CommonAgentHook.cs │ ├── PizzaBotAgentHook.cs │ └── PizzaBotConversationHook.cs ├── PizzaBotPlugin.cs ├── Using.cs ├── data │ ├── agents │ │ ├── 8970b1e5-d260-4e2c-90b1-f1415a257c18 │ │ │ ├── agent.json │ │ │ └── templates │ │ │ │ └── task.place_pizza_order.liquid │ │ ├── b284db86-e9c2-4c25-a59e-4649797dd130 │ │ │ ├── agent.json │ │ │ ├── functions │ │ │ │ └── get_order_status.json │ │ │ └── instructions │ │ │ │ └── instruction.liquid │ │ ├── c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd │ │ │ ├── agent.json │ │ │ ├── functions │ │ │ │ ├── get_pizza_price.json │ │ │ │ ├── get_pizza_types.json │ │ │ │ └── place_order.json │ │ │ └── instructions │ │ │ │ └── instruction.liquid │ │ └── fe8c60aa-b114-4ef3-93cb-a8efeac80f75 │ │ │ ├── agent.json │ │ │ ├── functions │ │ │ └── make_payment.json │ │ │ └── instructions │ │ │ └── instruction.liquid │ └── users │ │ ├── 10d12798-08fb-4aa6-977b-5dd94d82dbfe │ │ └── user.json │ │ ├── 456e35c5-caf0-4d45-9084-b44a8ca717e4 │ │ └── user.json │ │ ├── d0e6680d-03d5-4ed8-bdcd-aa7d86f2a1bc │ │ └── user.json │ │ └── e465af5f-044f-414b-b670-92834929b96c │ │ └── user.json └── documents │ ├── RDD-ChicagoThinCrust.pdf │ └── pizza-recipebooklet-1.pdf ├── BotSharp.Plugin.SemanticKernel.UnitTests ├── BotSharp.Plugin.SemanticKernel.UnitTests.csproj ├── Helpers │ ├── ResultHelper.cs │ └── SemanticKernelHelper.cs ├── SemanticKernelChatCompletionProviderTests.cs ├── SemanticKernelPluginTests.cs ├── SemanticKernelTextCompletionProviderTests.cs └── Usings.cs ├── BotSharp.Test.BrowserUse ├── BotSharp.Test.BrowserUse.csproj └── Program.cs ├── BotSharp.Test.ComputerUse ├── BotSharp.Test.ComputerUse.csproj └── Program.cs ├── BotSharp.Test.RealtimeVoice ├── Audio │ ├── AudioInStream.cs │ └── AudioOut.cs ├── BotSharp.Test.RealtimeVoice.csproj ├── Enums │ └── SessionMode.cs ├── Program.cs ├── Session │ ├── ConsoleChatSession.CustomStream.cs │ ├── ConsoleChatSession.StreamChannel.cs │ └── ConsoleChatSession.cs ├── Using.cs └── appsettings.json └── UnitTest ├── MainTest.cs ├── UnitTest.csproj └── Usings.cs /.dockerignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | node_modules/ -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | If you are a .NET developer and want to use C# for natural language processing, or build an AI Bot platform to automate your business processes, please fork this project and submit a Pull Request. 2 | We would be very grateful if you star the project. Join us on Gitter (https://gitter.im/botsharpcore/Lobby). 3 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | 12.0 5 | 5.0.0 6 | true 7 | false 8 | 9 | -------------------------------------------------------------------------------- /IFunctionExecutor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BotSharp.Core.Routing 8 | { 9 | public interface IFunctionExecutor 10 | { 11 | public Task Execute(RoleDialogModel message); 12 | 13 | public Task GetIndication(RoleDialogModel message); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /arts/BotSharp.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/arts/BotSharp.gif -------------------------------------------------------------------------------- /arts/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/arts/Icon.png -------------------------------------------------------------------------------- /arts/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/arts/Logo.png -------------------------------------------------------------------------------- /dockerfiles/.env: -------------------------------------------------------------------------------- 1 | # MongoDB Configuration 2 | ENV_MONGO_DB_HOST=botsharp_mongo 3 | ENV_MONGO_DB_PORT=27017 4 | ENV_MONGO_DB_DATABASE=botsharp 5 | ENV_MONGO_INITDB_ROOT_USERNAME=root 6 | ENV_MONGO_INITDB_ROOT_PASSWORD=admin 7 | ASPNETCORE_HTTP_PORTS=5500 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dockerfiles/Readme.md: -------------------------------------------------------------------------------- 1 | ## Run Container 2 | 3 | # Prerequisites: 4 | 1. Install Powershell 5 | 2. Install Docker Environment 6 | 7 | # start container 8 | 9 | ``` 10 | run-docker-compose.ps1 11 | ``` 12 | 13 | # stop container 14 | ``` 15 | stop-docker-compose.ps1 16 | ``` 17 | -------------------------------------------------------------------------------- /dockerfiles/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.0' 2 | 3 | services: 4 | botsharp: 5 | image: botsharpdocker/botsharp-core:latest 6 | build: 7 | context: ../ 8 | dockerfile: dockerfiles/WebStarter.Dockerfile 9 | ports: 10 | - 5500:5500 11 | env_file: 12 | - ./.env 13 | volumes: 14 | - ./appsettings.json:/app/appsettings.json 15 | networks: 16 | - botsharp-network 17 | -------------------------------------------------------------------------------- /dockerfiles/run-docker-compose.ps1: -------------------------------------------------------------------------------- 1 | docker network create botsharp-network 2 | docker-compose -f docker-compose.yml -f docker-compose.infrastructure.yml -f docker-compose.infrastructure.override.yml up -d -------------------------------------------------------------------------------- /dockerfiles/stop-docker-compose.ps1: -------------------------------------------------------------------------------- 1 | docker-compose -f docker-compose.yml -f docker-compose.infrastructure.yml -f docker-compose.infrastructure.override.yml down 2 | docker network rm botsharp-network -------------------------------------------------------------------------------- /docs/Name-Entity Recognition(NER) Comparation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/Name-Entity Recognition(NER) Comparation.pdf -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # How to contribute docs 2 | 3 | We use [Sphinx](https://www.sphinx-doc.org/en/master/) to build document, please make sure you installed the appropriate Sphinx plugins before making the docs. 4 | 5 | ```shell 6 | pip install -U sphinx 7 | pip install recommonmark 8 | pip install sphinx_rtd_theme 9 | pip install myst-parser 10 | cd docs 11 | ./make html 12 | ``` -------------------------------------------------------------------------------- /docs/agent/assets/agent-creation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/agent/assets/agent-creation.png -------------------------------------------------------------------------------- /docs/agent/assets/agent-update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/agent/assets/agent-update.png -------------------------------------------------------------------------------- /docs/agent/assets/conversation-creation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/agent/assets/conversation-creation.png -------------------------------------------------------------------------------- /docs/agent/assets/conversation-send-message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/agent/assets/conversation-send-message.png -------------------------------------------------------------------------------- /docs/agent/assets/routing-calling-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/agent/assets/routing-calling-stack.png -------------------------------------------------------------------------------- /docs/architecture/assets/account-creation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/account-creation.png -------------------------------------------------------------------------------- /docs/architecture/assets/account-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/account-token.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/add-utility.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/add-utility.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/agent-utility-code-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/agent-utility-code-structure.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/agent-utility-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/agent-utility-example.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/chat-window-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/chat-window-demo.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/dummy-http.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/dummy-http.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/register-assembly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/register-assembly.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/router-utility-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/router-utility-ui.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/routing-arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/routing-arch.png -------------------------------------------------------------------------------- /docs/architecture/assets/agent-utility/task-agent-utility-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/agent-utility/task-agent-utility-ui.png -------------------------------------------------------------------------------- /docs/architecture/assets/botsharp_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/botsharp_diagram.png -------------------------------------------------------------------------------- /docs/architecture/assets/llm_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/llm_diagram.png -------------------------------------------------------------------------------- /docs/architecture/assets/routing-reasoner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/routing-reasoner.png -------------------------------------------------------------------------------- /docs/architecture/assets/routing-redirection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/architecture/assets/routing-redirection.png -------------------------------------------------------------------------------- /docs/architecture/data-persistence.md: -------------------------------------------------------------------------------- 1 | # Data Storage -------------------------------------------------------------------------------- /docs/channels/wechat.md: -------------------------------------------------------------------------------- 1 | # WeChat -------------------------------------------------------------------------------- /docs/conversation/hook.md: -------------------------------------------------------------------------------- 1 | # Conversation Hook -------------------------------------------------------------------------------- /docs/conversation/state.md: -------------------------------------------------------------------------------- 1 | # Conversation State 2 | 3 | BotSharp has a built-in dialogue state management function, which automatically saves the input parameters of the function to the dialogue state by default, and is valid throughout the life cycle of the dialogue. If the parameter name is repeated, it will be overwritten. -------------------------------------------------------------------------------- /docs/knowledge-base/assets/feed_knowledge_answer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/knowledge-base/assets/feed_knowledge_answer.png -------------------------------------------------------------------------------- /docs/knowledge-base/assets/feed_knowledge_pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/knowledge-base/assets/feed_knowledge_pdf.png -------------------------------------------------------------------------------- /docs/knowledge-base/similarity-search.md: -------------------------------------------------------------------------------- 1 | # Similarity Search 2 | 3 | After we have learned the concepts of `Text Embedding` and `Vector Database`, we can start to use BotSharp to actually build an LLM-based knowledge base question system. 4 | Below we will walk through how to use an existing PDF document to make a Q&A chatbot. 5 | -------------------------------------------------------------------------------- /docs/knowledge-base/vector-database.md: -------------------------------------------------------------------------------- 1 | # Vector Database 2 | 3 | In order to use your own private data to build a knowledge base question answering system, you must first convert your documents into plain text, and then embed the text into the Vector database for indexing to improve subsequent search efficiency. 4 | 5 | ## Memory vector datbase 6 | `MemVecDb` is a lightweight memory vector database provided by BotSharp for rapid development and testing. It is not recommended to be used in the actual production environment. -------------------------------------------------------------------------------- /docs/llama-sharp/assets/check-llamasharp-version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/llama-sharp/assets/check-llamasharp-version.png -------------------------------------------------------------------------------- /docs/llama-sharp/assets/choose-llamasharp-as-provider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/llama-sharp/assets/choose-llamasharp-as-provider.png -------------------------------------------------------------------------------- /docs/llama-sharp/assets/click-test-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/llama-sharp/assets/click-test-button.png -------------------------------------------------------------------------------- /docs/llama-sharp/assets/console-output-in-botsharp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/llama-sharp/assets/console-output-in-botsharp.png -------------------------------------------------------------------------------- /docs/llama-sharp/assets/converstaion-examples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/llama-sharp/assets/converstaion-examples.png -------------------------------------------------------------------------------- /docs/llama-sharp/assets/edit-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/llama-sharp/assets/edit-agent.png -------------------------------------------------------------------------------- /docs/llama-sharp/assets/install-llamasharp-plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/llama-sharp/assets/install-llamasharp-plugin.png -------------------------------------------------------------------------------- /docs/llm/few-shot-learning.md: -------------------------------------------------------------------------------- 1 | # Few-Shot Learning -------------------------------------------------------------------------------- /docs/llm/prompt.md: -------------------------------------------------------------------------------- 1 | # Prompt Engineering 2 | 3 | LLM uses prompt as input, and the model produces different outputs according to the input. 4 | -------------------------------------------------------------------------------- /docs/llm/template.md: -------------------------------------------------------------------------------- 1 | # Template 2 | 3 | We can define the prompt as a template, and the template can be changed according to variables, so that a instruction file can be used to generate a dynamic prompt. 4 | `BotSharp` uses [liquid](https://shopify.github.io/liquid/) templates to support various complex dynamic prompt engineering. 5 | 6 | `ITemplateRender` 7 | ```csharp 8 | bool Render(Agent agent, Dictionary dict) 9 | ``` -------------------------------------------------------------------------------- /docs/quick-start/assets/APIHome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/APIHome.png -------------------------------------------------------------------------------- /docs/quick-start/assets/APIPostman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/APIPostman.png -------------------------------------------------------------------------------- /docs/quick-start/assets/BackendServiceHomeScreenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/BackendServiceHomeScreenshot.png -------------------------------------------------------------------------------- /docs/quick-start/assets/BotSharp-UI-Router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/BotSharp-UI-Router.png -------------------------------------------------------------------------------- /docs/quick-start/assets/ChatbotUIHome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/ChatbotUIHome.png -------------------------------------------------------------------------------- /docs/quick-start/assets/NuGet-Local-Whisper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/NuGet-Local-Whisper.png -------------------------------------------------------------------------------- /docs/quick-start/assets/PizzaBotSample1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/PizzaBotSample1.png -------------------------------------------------------------------------------- /docs/quick-start/assets/PizzaBotSample2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/PizzaBotSample2.png -------------------------------------------------------------------------------- /docs/quick-start/assets/PizzaBotSample3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/PizzaBotSample3.png -------------------------------------------------------------------------------- /docs/quick-start/assets/PizzaBotSample4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/PizzaBotSample4.png -------------------------------------------------------------------------------- /docs/quick-start/assets/Result-Local-Whisper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/Result-Local-Whisper.png -------------------------------------------------------------------------------- /docs/quick-start/assets/Steps-Local-Whisper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/Steps-Local-Whisper.png -------------------------------------------------------------------------------- /docs/quick-start/assets/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/quick-start/assets/overview.png -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx == 6.2.1 2 | recommonmark == 0.7.1 3 | sphinx-rtd-theme == 1.2.2 4 | myst-parser -------------------------------------------------------------------------------- /docs/static/logos/BotSharpEngine.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/static/logos/BotSharpEngine.jpg -------------------------------------------------------------------------------- /docs/static/logos/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/static/logos/Logo.png -------------------------------------------------------------------------------- /docs/static/screenshots/BotSharp_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/static/screenshots/BotSharp_arch.png -------------------------------------------------------------------------------- /docs/static/screenshots/agent-builder-agents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/static/screenshots/agent-builder-agents.png -------------------------------------------------------------------------------- /docs/static/screenshots/agent-builder-conversations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/static/screenshots/agent-builder-conversations.png -------------------------------------------------------------------------------- /docs/static/screenshots/web-live-chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/docs/static/screenshots/web-live-chat.png -------------------------------------------------------------------------------- /src/BotSharp.AppHost/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BotSharp.AppHost/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning", 6 | "Aspire.Hosting.Dcp": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction.ComputerUse/MLTasks/IScreenshot.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.ComputerUse.MLTasks; 2 | 3 | public interface IScreenshot 4 | { 5 | (int x, int y) GetScreenSize(int screenIndex); 6 | byte[] CaptureScreen(int displayId); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction.ComputerUse/Models/ComputerUseArgs.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.ComputerUse.Models; 2 | 3 | public class ComputerUseArgs 4 | { 5 | /// 6 | /// Number of multi-screens 7 | /// 8 | public int DisplayId { get; set; } 9 | public int X { get; set; } 10 | public int Y { get; set; } 11 | public string Text { get; set; } = string.Empty; 12 | public MouseButton MouseButton { get; set; } 13 | public KeyCode KeyCode { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction.ComputerUse/Models/ComputerUseOutput.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.ComputerUse.Models; 2 | 3 | public class ComputerUseOutput 4 | { 5 | /// 6 | /// Base64 encoded image 7 | /// 8 | public string? Screenshot { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction.ComputerUse/Using.cs: -------------------------------------------------------------------------------- 1 | global using System.Threading.Tasks; 2 | global using BotSharp.Abstraction.ComputerUse.Models; 3 | 4 | global using SharpHook.Native; -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Agents/Constants/LlmConstant.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Agents.Constants; 2 | 3 | public static class LlmConstant 4 | { 5 | public const int DEFAULT_MAX_OUTPUT_TOKEN = 1024; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Agents/Enums/AgentRole.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Agents.Enums; 2 | 3 | public class AgentRole 4 | { 5 | public const string System = "system"; 6 | public const string Assistant = "assistant"; 7 | public const string User = "user"; 8 | public const string Function = "function"; 9 | public const string Model = "model"; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Agents/IAgentUtilityHook.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Agents; 2 | 3 | public interface IAgentUtilityHook 4 | { 5 | void AddUtilities(List utilities); 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentRule.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Agents.Models; 2 | 3 | public class AgentRule 4 | { 5 | [JsonPropertyName("trigger_name")] 6 | public string TriggerName { get; set; } 7 | 8 | [JsonPropertyName("disabled")] 9 | public bool Disabled { get; set; } 10 | 11 | [JsonPropertyName("criteria")] 12 | public string Criteria { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Agents.Models; 2 | 3 | public class AgentTemplate 4 | { 5 | public string Name { get; set; } 6 | public string Content { get; set; } 7 | 8 | public AgentTemplate() 9 | { 10 | } 11 | 12 | public AgentTemplate(string name, string content) 13 | { 14 | Name = name; 15 | Content = content; 16 | } 17 | 18 | public override string ToString() 19 | { 20 | return Name; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Agents/Models/ChannelInstruction.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Agents.Models; 2 | 3 | public class ChannelInstruction 4 | { 5 | public string Channel { get; set; } 6 | public string Instruction { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Browsing/Enums/BroswerActionEnum.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Browsing.Enums; 2 | 3 | public enum BroswerActionEnum 4 | { 5 | Click = 1, 6 | InputText = 2, 7 | Typing = 3, 8 | Hover = 4, 9 | Scroll = 5, 10 | DragAndDrop = 6, 11 | DropDown = 7, 12 | FileUpload = 8 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Browsing/IWebDriverHook.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Browsing.Models; 2 | 3 | namespace BotSharp.Abstraction.Browsing; 4 | 5 | public interface IWebDriverHook 6 | { 7 | Task> GetUploadFiles(MessageInfo message); 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Browsing/IWebPageResponseHook.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Browsing.Models; 2 | 3 | namespace BotSharp.Abstraction.Browsing; 4 | 5 | public interface IWebPageResponseHook 6 | { 7 | void OnDataFetched(MessageInfo message, WebPageResponseData response); 8 | T? GetResponse(MessageInfo message, WebPageResponseFilter filter); 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Browsing/Models/BrowserActionArgs.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Browsing.Models; 2 | 3 | public class BrowserActionArgs 4 | { 5 | public bool Headless { get; set; } 6 | public string? UserDataDir { get; set; } 7 | public string? RemoteHostUrl { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Browsing/Models/ElementPosition.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Browsing.Models; 2 | 3 | public class ElementPosition 4 | { 5 | public float X { get; set; } = default!; 6 | 7 | public float Y { get; set; } = default!; 8 | 9 | public override string ToString() 10 | { 11 | return $"[{X}, {Y}]"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Enums/ConversationStatus.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Enums; 2 | 3 | public class ConversationStatus 4 | { 5 | public const string Open = "open"; 6 | public const string Closed = "closed"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Enums/MessageTypeName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Enums; 2 | 3 | public static class MessageTypeName 4 | { 5 | public const string Plain = "plain"; 6 | public const string Notification = "notification"; 7 | public const string FunctionCall = "function"; 8 | public const string Audio = "audio"; 9 | public const string Error = "error"; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Enums/StateDataType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Enums; 2 | 3 | public class StateDataType 4 | { 5 | public const string String = "string"; 6 | public const string Boolean = "boolean"; 7 | public const string Number = "number"; 8 | public const string Currency = "currency"; 9 | public const string Date = "date"; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Enums/StateSource.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Enums; 2 | 3 | public class StateSource 4 | { 5 | public const string External = "external"; 6 | public const string Application = "application"; 7 | public const string User = "user"; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationProgressService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations; 2 | 3 | public delegate Task FunctionExecuting(RoleDialogModel msg); 4 | public delegate Task FunctionExecuted(RoleDialogModel msg); 5 | 6 | public interface IConversationProgressService 7 | { 8 | FunctionExecuted OnFunctionExecuted { get; set; } 9 | FunctionExecuting OnFunctionExecuting { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationStorage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations; 2 | 3 | public interface IConversationStorage 4 | { 5 | void Append(string conversationId, RoleDialogModel dialog); 6 | void Append(string conversationId, IEnumerable dialogs); 7 | List GetDialogs(string conversationId); 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/ITokenStatistics.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations; 2 | 3 | public interface ITokenStatistics 4 | { 5 | int Total { get; } 6 | float AccumulatedCost { get; } 7 | float Cost { get; } 8 | void StartTimer(); 9 | void StopTimer(); 10 | void AddToken(TokenStatsModel stats, RoleDialogModel message); 11 | void PrintStatistics(); 12 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Models/ConversationState.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Models; 2 | 3 | public class ConversationState : Dictionary 4 | { 5 | public ConversationState() 6 | { 7 | 8 | } 9 | 10 | public ConversationState(List pairs) 11 | { 12 | foreach (var pair in pairs) 13 | { 14 | this[pair.Key] = pair; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Models/PostbackMessageModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Models; 2 | 3 | public class PostbackMessageModel 4 | { 5 | public string FunctionName { get; set; } = string.Empty; 6 | public string Payload { get; set; } = string.Empty; 7 | /// 8 | /// Parent message id 9 | /// 10 | public string ParentId { get; set; } = string.Empty; 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Models/TruncateMessageRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Models; 2 | 3 | public class TruncateMessageRequest 4 | { 5 | [JsonPropertyName("is_new_message")] 6 | public bool isNewMessage { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Models/UpdateMessageRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Models; 2 | 3 | public class UpdateMessageRequest 4 | { 5 | public DialogElement Message { get; set; } = null!; 6 | public int InnderIndex { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Conversations/Settings/RateLimitSetting.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Conversations.Settings; 2 | 3 | public class RateLimitSetting 4 | { 5 | public int MaxConversationPerDay { get; set; } = 100; 6 | public int MaxInputLengthPerRequest { get; set; } = 1024; 7 | public int MinTimeSecondsBetweenMessages { get; set; } = 2; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Crontab; 2 | 3 | public interface ICrontabService 4 | { 5 | Task> GetCrontable(); 6 | Task ScheduledTimeArrived(CrontabItem item); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabSource.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Crontab; 2 | 3 | /// 4 | /// Provide a cron source for the crontab service. 5 | /// 6 | public interface ICrontabSource 7 | { 8 | /// 9 | /// Set to true if the cron is real-time like Change Data Capture (CDC). 10 | /// 11 | bool IsRealTime => false; 12 | 13 | CrontabItem GetCrontabItem(); 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Crontab/Models/TaskWaitArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BotSharp.Abstraction.Crontab.Models; 8 | 9 | public class TaskWaitArgs 10 | { 11 | 12 | [JsonPropertyName("delay_time")] 13 | public int DelayTime { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Crontab/Settings/CrontabSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Crontab.Settings; 2 | 3 | public class CrontabSettings 4 | { 5 | public CrontabBaseSetting EventSubscriber { get; set; } = new(); 6 | public CrontabBaseSetting Watcher { get; set; } = new(); 7 | } 8 | 9 | public class CrontabBaseSetting 10 | { 11 | public bool Enabled { get; set; } = true; 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Evaluations/IExecutionLogger.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Evaluations; 2 | 3 | public interface IExecutionLogger 4 | { 5 | void Append(string conversationId, string context); 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Evaluations/Models/EvaluationResult.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Evaluations.Models; 2 | 3 | public class EvaluationResult 4 | { 5 | public List Dialogs { get; set; } 6 | public string TaskInstruction { get; set; } 7 | public string SystemPrompt { get; set; } 8 | public string GeneratedConversationId { get; set; } 9 | public string? MetricResult { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Evaluations/Models/SimulationResult.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Evaluations.Models; 2 | 3 | public class SimulationResult 4 | { 5 | [JsonPropertyName("generated_message")] 6 | public string GeneratedMessage { get; set; } 7 | 8 | [JsonPropertyName("stop_conversation")] 9 | public bool Stop { get; set; } 10 | 11 | [JsonPropertyName("reason")] 12 | public string? Reason { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Evaluations/Settings/EvaluatorSetting.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Evaluations.Settings; 2 | 3 | public class EvaluatorSetting 4 | { 5 | public string AgentId { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/Constants/FileConstants.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Files.Constants; 2 | 3 | public class FileConstants 4 | { 5 | public static readonly IEnumerable AudioExtensions = new List 6 | { 7 | ".mp3", ".wav", ".flac", ".aac", ".ogg", ".wma" 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/Enums/FileSourceType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Files.Enums; 2 | 3 | public static class FileSourceType 4 | { 5 | public const string User = "user"; 6 | public const string Bot = "bot"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/Enums/FileStorageEnum.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Repositories.Enums; 2 | 3 | public static class FileStorageEnum 4 | { 5 | public const string LocalFileStorage = nameof(LocalFileStorage); 6 | public const string AmazonS3Storage = nameof(AmazonS3Storage); 7 | public const string AzureBlobStorage = nameof(AzureBlobStorage); 8 | public const string TencentCosStorage = nameof(TencentCosStorage); 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/FileCoreSettings.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Repositories.Enums; 2 | 3 | namespace BotSharp.Abstraction.Files; 4 | 5 | public class FileCoreSettings 6 | { 7 | public string Storage { get; set; } = FileStorageEnum.LocalFileStorage; 8 | public SettingBase Pdf2TextConverter { get; set; } 9 | public SettingBase Pdf2ImageConverter { get; set; } 10 | } 11 | 12 | public class SettingBase 13 | { 14 | public string Provider { get; set; } 15 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/Models/BotSharpFile.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace BotSharp.Abstraction.Files.Models; 3 | 4 | public class BotSharpFile : FileInformation 5 | { 6 | /// 7 | /// File data => format: "data:image/png;base64,aaaaaaaa" 8 | /// 9 | [JsonPropertyName("file_data")] 10 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 11 | public string? FileData { get; set; } = string.Empty; 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/Models/FileBinaryDataModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Files.Models; 2 | 3 | public class FileBinaryDataModel 4 | { 5 | public string FileName { get; set; } 6 | public string ContentType { get; set; } 7 | public BinaryData FileBinaryData { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/Models/FileSelectContext.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Files.Models; 2 | 3 | public class FileSelectContext 4 | { 5 | [JsonPropertyName("selected_ids")] 6 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 7 | public IEnumerable? Selecteds { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/Models/ImageGeneration.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Files.Models; 2 | 3 | public class ImageGeneration 4 | { 5 | [JsonPropertyName("image_url")] 6 | public string? ImageUrl { get; set; } 7 | 8 | [JsonPropertyName("image_data")] 9 | public string? ImageData { get; set; } 10 | 11 | [JsonPropertyName("description")] 12 | public string Description { get; set; } = string.Empty; 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Files/Models/KnowledgeFileModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Files.Models; 2 | 3 | public class KnowledgeFileModel 4 | { 5 | public Guid FileId { get; set; } 6 | public string FileName { get; set; } 7 | public string FileExtension { get; set; } 8 | public string FileSource { get; set; } 9 | public string ContentType { get; set; } 10 | public string FileUrl { get; set; } 11 | public DocMetaRefData? RefData { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Google/Models/GoogleAddressResult.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Google.Models; 2 | 3 | public class GoogleAddressResult 4 | { 5 | public IList Results { get; set; } = new List(); 6 | public string Status { get; set; } 7 | } 8 | 9 | 10 | public class GoogleAddress 11 | { 12 | [JsonPropertyName("formatted_address")] 13 | public string FormatedAddress { get; set; } 14 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Graph/IGraphDb.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Graph.Models; 2 | 3 | namespace BotSharp.Abstraction.Graph; 4 | 5 | public interface IGraphDb 6 | { 7 | public string Provider { get; } 8 | 9 | Task Search(string query, GraphSearchOptions options); 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Graph/Models/GraphSearchData.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Graph.Models; 2 | 3 | public class GraphSearchData 4 | { 5 | public string Result { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Graph/Models/GraphSearchOptions.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Graph.Models; 2 | 3 | public class GraphSearchOptions 4 | { 5 | public string Method { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Graph/Models/GraphSearchResult.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Graph.Models; 2 | 3 | public class GraphSearchResult 4 | { 5 | public string Result { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Hooks/IHookBase.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Hooks; 2 | 3 | public interface IHookBase 4 | { 5 | /// 6 | /// Agent Id 7 | /// 8 | string SelfId => string.Empty; 9 | bool IsMatch(string agentId) => string.IsNullOrEmpty(SelfId) || SelfId == agentId; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Http/IHttpRequestHook.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http.Headers; 2 | 3 | namespace BotSharp.Abstraction.Http; 4 | 5 | public interface IHttpRequestHook 6 | { 7 | void OnAddHttpHeaders(HttpHeaders headers, Uri uri); 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/Enums/CacheType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures.Enums; 2 | 3 | public enum CacheType 4 | { 5 | MemoryCache = 1, 6 | RedisCache = 2 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/Enums/EventPriority.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures.Enums; 2 | 3 | public enum EventPriority 4 | { 5 | Low = 1, 6 | Medium = 2, 7 | High = 3 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/Enums/LanguageType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures.Enums; 2 | 3 | public class LanguageType 4 | { 5 | public const string UNKNOWN = "Unknown"; 6 | public const string ENGLISH = "English"; 7 | public const string SPANISH = "Spanish"; 8 | public const string CHINESE = "Chinese"; 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/Events/IEventSubscriber.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | 3 | namespace BotSharp.Abstraction.Infrastructures.Events; 4 | 5 | public interface IEventSubscriber 6 | { 7 | Task SubscribeAsync(string channel, Func received); 8 | 9 | Task SubscribeAsync(string channel, string group, int? port, bool priorityEnabled, 10 | Func received, 11 | CancellationToken? stoppingToken = null); 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/HookEmitOption.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures; 2 | 3 | public class HookEmitOption 4 | { 5 | public bool OnlyOnce { get; set; } 6 | 7 | /// 8 | /// Optional predicate to determine if the hook action should be executed for a specific hook instance. 9 | /// 10 | public Func? ShouldExecute { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/HookEmittedResult.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures; 2 | 3 | public class HookEmittedResult 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/ICacheKey.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures; 2 | 3 | public interface ICacheKey 4 | { 5 | string GetCacheKey(); 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/ICacheService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures; 2 | 3 | public interface ICacheService 4 | { 5 | Task GetAsync(string key); 6 | Task GetAsync(string key, Type type); 7 | Task SetAsync(string key, T value, TimeSpan? expiry); 8 | Task RemoveAsync(string key); 9 | Task ClearCacheAsync(string prefix); 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/IDistributedLocker.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures; 2 | 3 | public interface IDistributedLocker 4 | { 5 | bool Lock(string resource, Action action, int timeout = 30); 6 | Task LockAsync(string resource, Func action, int timeout = 30); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Infrastructures; 2 | 3 | public class SharpCacheSettings 4 | { 5 | public bool Enabled { get; set; } = true; 6 | public CacheType CacheType { get; set; } = CacheType.MemoryCache; 7 | public string Prefix { get; set; } = "cache"; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Instructs/IInstructHook.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Hooks; 2 | using BotSharp.Abstraction.Instructs.Models; 3 | 4 | namespace BotSharp.Abstraction.Instructs; 5 | 6 | public interface IInstructHook : IHookBase 7 | { 8 | Task BeforeCompletion(Agent agent, RoleDialogModel message); 9 | Task AfterCompletion(Agent agent, InstructResult result); 10 | Task OnResponseGenerated(InstructResponseModel response); 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Instructs/Models/ExecuteTemplateArgs.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Instructs.Models; 2 | 3 | public class ExecuteTemplateArgs 4 | { 5 | [JsonPropertyName("template_name")] 6 | public string? TemplateName { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Instructs/Models/InstructResult.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Instructs.Models; 2 | 3 | public class InstructResult : ITrackableMessage 4 | { 5 | [JsonPropertyName("message_id")] 6 | public string MessageId { get; set; } 7 | public string Text { get; set; } 8 | public object? Data { get; set; } 9 | public Dictionary? States { get; set; } = new(); 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Instructs/Settings/InstructionSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Instructs.Settings; 2 | 3 | public class InstructionSettings 4 | { 5 | public InstructionLogSetting Logging { get; set; } = new(); 6 | } 7 | 8 | public class InstructionLogSetting 9 | { 10 | public bool Enabled { get; set; } = true; 11 | public List ExcludedAgentIds { get; set; } = []; 12 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Interpreters/Models/InterpretationRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Interpreters.Models; 2 | 3 | public class InterpretationRequest 4 | { 5 | [JsonPropertyName("script")] 6 | public string Script { get; set; } = null!; 7 | 8 | [JsonPropertyName("language")] 9 | public string Language { get; set; } = null!; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Interpreters/Settings/InterpreterSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Interpreters.Settings; 2 | 3 | public class InterpreterSettings 4 | { 5 | public PythonInterpreterSetting Python { get; set; } 6 | } 7 | 8 | public class PythonInterpreterSetting 9 | { 10 | public string PythonDLL { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/Enums/KnowledgeCollectionName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges.Enums; 2 | 3 | public static class KnowledgeCollectionName 4 | { 5 | public static string BotSharp = nameof(BotSharp); 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/Enums/KnowledgeCollectionType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges.Enums; 2 | 3 | public static class KnowledgeCollectionType 4 | { 5 | public static string QuestionAnswer = "question-answer"; 6 | public static string Document = "document"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/Enums/KnowledgeDocSource.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges.Enums; 2 | 3 | public static class KnowledgeDocSource 4 | { 5 | public const string Api = "api"; 6 | public const string User = "user"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/Enums/KnowledgeDocType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges.Enums; 2 | 3 | public class KnowledgeDocType 4 | { 5 | public const string File = "file"; 6 | public const string Http = "http"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/IPaddleOcrConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BotSharp.Abstraction.Knowledges 6 | { 7 | public interface IPaddleOcrConverter 8 | { 9 | // void LoadModel(); 10 | Task ConvertImageToText(string loadPath); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/IPdf2TextConverter.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges 2 | { 3 | public interface IPdf2TextConverter 4 | { 5 | public string Provider { get; } 6 | Task ConvertPdfToText(string filePath, int? startPageNum, int? endPageNum); 7 | } 8 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/ExtractedKnowledge.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges.Models; 2 | 3 | public class ExtractedKnowledge 4 | { 5 | [JsonPropertyName("question")] 6 | public string Question { get; set; } = string.Empty; 7 | 8 | [JsonPropertyName("answer")] 9 | public string Answer { get; set; } = string.Empty; 10 | 11 | [JsonPropertyName("refined_collection")] 12 | public string RefinedCollection { get; set; } = string.Empty; 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/KnowledgeChunk.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges.Models; 2 | 3 | public class KnowledgeChunk 4 | { 5 | public string Id { get; set; } 6 | public string Name { get; set; } 7 | public string Content { get; set; } 8 | public string SourceAgentId { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/KnowledgeCreationModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges.Models; 2 | 3 | public class KnowledgeCreationModel 4 | { 5 | public string Content { get; set; } = string.Empty; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/KnowledgeFileFilter.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Knowledges.Models; 2 | 3 | public class KnowledgeFileFilter : Pagination 4 | { 5 | public IEnumerable? FileIds { get; set; } 6 | 7 | public IEnumerable? FileNames { get; set; } 8 | 9 | public IEnumerable? ContentTypes { get; set; } 10 | 11 | public IEnumerable? FileSources { get; set; } 12 | 13 | public KnowledgeFileFilter() 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Loggers/Enums/ContentLogSource.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Loggers.Enums; 2 | 3 | public static class ContentLogSource 4 | { 5 | public const string UserInput = "user input"; 6 | public const string Prompt = "prompt"; 7 | public const string FunctionCall = "function call"; 8 | public const string AgentResponse = "agent response"; 9 | public const string HardRule = "hard rule"; 10 | public const string Notification = "notification"; 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Loggers/Models/AgentQueueChangedLogModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Loggers.Models; 2 | 3 | public class AgentQueueChangedLogModel 4 | { 5 | [JsonPropertyName("conversation_id")] 6 | public string ConversationId { get; set; } = default!; 7 | 8 | [JsonPropertyName("log")] 9 | public string Log { get; set; } = default!; 10 | 11 | [JsonPropertyName("created_at")] 12 | public DateTime CreatedTime { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Loggers/Models/LlmCompletionLog.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Loggers.Models; 2 | 3 | public class LlmCompletionLog 4 | { 5 | public string ConversationId { get; set; } = string.Empty; 6 | public string MessageId { get; set; } = string.Empty; 7 | public string AgentId { get; set; } = string.Empty; 8 | public string Prompt { get; set; } = string.Empty; 9 | public string? Response { get; set; } 10 | public DateTime CreatedTime { get; set; } = DateTime.UtcNow; 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Loggers/Models/StateChangeOutputModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Loggers.Models; 2 | 3 | public class StateChangeOutputModel : StateChangeModel 4 | { 5 | [JsonPropertyName("created_at")] 6 | public DateTime CreateTime { get; set; } = DateTime.UtcNow; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/MCP/Models/McpServerOptionModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.MCP.Models; 2 | 3 | public class McpServerOptionModel : IdName 4 | { 5 | public IEnumerable Tools { get; set; } = []; 6 | 7 | public McpServerOptionModel() : base() 8 | { 9 | 10 | } 11 | 12 | public McpServerOptionModel( 13 | string id, 14 | string name, 15 | IEnumerable tools) : base(id, name) 16 | { 17 | Tools = tools ?? []; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/MCP/Services/IMcpService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.MCP.Services; 2 | 3 | public interface IMcpService 4 | { 5 | Task> GetServerConfigsAsync() => Task.FromResult>([]); 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/MLTasks/IAudioSynthesis.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.MLTasks; 2 | 3 | /// 4 | /// Text to speech synthesis 5 | /// 6 | public interface IAudioSynthesis 7 | { 8 | string Provider { get; } 9 | 10 | string Model { get; } 11 | 12 | void SetModelName(string model); 13 | 14 | Task GenerateAudioAsync(string text, string? voice = "alloy", string? format = "mp3", string? instructions = null); 15 | } 16 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/MLTasks/IAudioTranscription.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace BotSharp.Abstraction.MLTasks; 4 | 5 | /// 6 | /// Audio transcription service 7 | /// 8 | public interface IAudioTranscription 9 | { 10 | string Provider { get; } 11 | 12 | string Model { get; } 13 | 14 | Task TranscriptTextAsync(Stream audio, string audioFileName, string? text = null); 15 | 16 | void SetModelName(string model); 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmConfigOptions.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.MLTasks.Settings; 2 | 3 | public class LlmConfigOptions 4 | { 5 | public LlmModelType? Type { get; set; } 6 | public bool? MultiModal { get; set; } 7 | public bool? ImageGeneration { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmProviderSetting.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.MLTasks.Settings; 2 | 3 | public class LlmProviderSetting 4 | { 5 | public string Provider { get; set; } = "azure-openai"; 6 | 7 | public List Models { get; set; } = []; 8 | 9 | public override string ToString() 10 | { 11 | return $"{Provider} with {Models.Count} models"; 12 | } 13 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/SenderActionEnum.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace BotSharp.Abstraction.Messaging.Enums; 4 | 5 | public enum SenderActionEnum 6 | { 7 | [EnumMember(Value = "typing_on")] 8 | TypingOn = 1, 9 | [EnumMember(Value = "typing_off")] 10 | TypingOff, 11 | [EnumMember(Value = "mark_seen")] 12 | MarkSeen 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/TemplateTypeEnum.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Messaging.Enums; 2 | 3 | public static class TemplateTypeEnum 4 | { 5 | public const string Button = "button"; 6 | public const string Coupon = "coupon"; 7 | public const string Generic = "generic"; 8 | public const string MultiSelect = "multi-select"; 9 | public const string Product = "product"; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Messaging/IRichContentService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Messaging; 2 | 3 | public interface IRichContentService 4 | { 5 | List ConvertToMessages(string content); 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Messaging/IRichMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Messaging; 2 | 3 | public interface IRichMessage 4 | { 5 | [JsonPropertyName("text")] 6 | string Text { get; set; } 7 | 8 | [JsonPropertyName("rich_type")] 9 | string RichType => RichTypeEnum.Text; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Messaging/ITemplateMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Messaging; 2 | 3 | public interface ITemplateMessage 4 | { 5 | [JsonPropertyName("template_type")] 6 | string TemplateType => string.Empty; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/QuickReplyMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Messaging.Models.RichContent; 2 | 3 | public class QuickReplyMessage : IRichMessage 4 | { 5 | [JsonPropertyName("rich_type")] 6 | public string RichType => RichTypeEnum.QuickReply; 7 | public string Text { get; set; } = string.Empty; 8 | 9 | [JsonPropertyName("quick_replies")] 10 | public List QuickReplies { get; set; } = new List(); 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Recipient.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Messaging.Models.RichContent; 2 | 3 | public class Recipient 4 | { 5 | public string Id { get; set; } = string.Empty; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/TextMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Messaging.Models.RichContent; 2 | 3 | public class TextMessage : IRichMessage 4 | { 5 | [JsonPropertyName("rich_type")] 6 | public string RichType => RichTypeEnum.Text; 7 | 8 | [Translate] 9 | public string Text { get; set; } = string.Empty; 10 | 11 | public TextMessage(string text) 12 | { 13 | Text = text; 14 | } 15 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Models/AiModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Models; 2 | 3 | public class AiModel 4 | { 5 | public string Id { get; set; } = string.Empty; 6 | public string Model { get; set; } = string.Empty; 7 | public string Name { get; set; } = string.Empty; 8 | public int MaxLength { get; set; } 9 | public int TokenLimit { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Models/ITrackableMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Models; 2 | 3 | /// 4 | /// Define a message ID to extend message-level applications, such as model fees, token usage, and data collection 5 | /// 6 | public interface ITrackableMessage 7 | { 8 | string MessageId { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Planning/IExecutor.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Functions.Models; 2 | using BotSharp.Abstraction.Routing; 3 | 4 | namespace BotSharp.Abstraction.Planning; 5 | 6 | public interface IExecutor 7 | { 8 | Task Execute(IRoutingService routing, 9 | FunctionCallFromLlm inst, 10 | RoleDialogModel message, 11 | List dialogs); 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Plugins/IBotSharpAppPlugin.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | 3 | namespace BotSharp.Abstraction.Plugins 4 | { 5 | public interface IBotSharpAppPlugin: IBotSharpPlugin 6 | { 7 | void Configure(IApplicationBuilder app); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Plugins/Models/PluginConfig.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Plugins.Models; 2 | 3 | public class PluginConfig 4 | { 5 | public List EnabledPlugins { get; set; } 6 | = new List(); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Plugins/Models/PluginFilter.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Plugins.Models 2 | { 3 | public class PluginFilter 4 | { 5 | public Pagination Pager { get; set; } = new Pagination(); 6 | public IEnumerable? Names { get; set; } 7 | public string? SimilarName { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Plugins/PluginDependencyAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Plugins; 2 | 3 | public class PluginDependencyAttribute : Attribute 4 | { 5 | public string[] PluginNames { get; set; } 6 | 7 | public PluginDependencyAttribute(params string[] pluginNames) 8 | { 9 | PluginNames = pluginNames; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Plugins/PluginLoaderSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Plugins; 2 | 3 | public class PluginSettings 4 | { 5 | public string[] Assemblies { get; set; } = new string[0]; 6 | 7 | public string[] ExcludedFunctions { get; set; } = new string[0]; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Processors/IBaseProcessor.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Processors.Models; 2 | 3 | namespace BotSharp.Abstraction.Processors; 4 | 5 | public interface IBaseProcessor where TInput : LlmBaseRequest where TOutput : class 6 | { 7 | string Provider { get; } 8 | string Name => string.Empty; 9 | int Order { get; } 10 | 11 | Task Execute(TInput input); 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Processors/Models/LlmBaseRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Processors.Models; 2 | 3 | public class LlmBaseRequest 4 | { 5 | [JsonPropertyName("provider")] 6 | public string Provider { get; set; } 7 | 8 | [JsonPropertyName("model")] 9 | public string Model { get; set; } 10 | 11 | [JsonPropertyName("agent_id")] 12 | public string? AgentId { get; set; } 13 | 14 | [JsonPropertyName("template_name")] 15 | public string? TemplateName { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Realtime/Enums/StreamChannelStatus.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Realtime.Enums; 2 | 3 | public enum StreamChannelStatus 4 | { 5 | Open = 1, 6 | Closed = 2 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Realtime/Models/ModelResponseEvent.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Realtime.Models; 2 | 3 | public class ModelResponseEvent 4 | { 5 | [JsonPropertyName("event")] 6 | public string Event { get; set; } = string.Empty; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Realtime/Models/ModelResponseMediaEvent.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Realtime.Models; 2 | 3 | public class ModelResponseMediaEvent : ModelResponseEvent 4 | { 5 | [JsonPropertyName("media")] 6 | public string Media { get; set; } = null!; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Realtime/Models/ModelTurnDetection.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Realtime.Models; 2 | 3 | public class ModelTurnDetection 4 | { 5 | public int PrefixPadding { get; set; } = 300; 6 | 7 | public int SilenceDuration { get; set; } = 500; 8 | 9 | public float Threshold { get; set; } = 0.5f; 10 | } 11 | 12 | public class AudioTranscription 13 | { 14 | public string Model { get; set; } = "gpt-4o-mini-transcribe"; 15 | public string? Language { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Realtime/Models/Session/ChatSessionOptions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using System.Text.Json; 3 | 4 | namespace BotSharp.Abstraction.Realtime.Models.Session; 5 | 6 | public class ChatSessionOptions 7 | { 8 | public string Provider { get; set; } 9 | public int? BufferSize { get; set; } 10 | public JsonSerializerOptions? JsonOptions { get; set; } 11 | public ILogger? Logger { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Realtime/Models/Session/ChatSessionUpdate.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Realtime.Models.Session; 2 | 3 | public class ChatSessionUpdate 4 | { 5 | public string RawResponse { get; set; } 6 | 7 | public ChatSessionUpdate() 8 | { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Realtime/Models/StreamReceiveResult.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Realtime.Enums; 2 | 3 | namespace BotSharp.Abstraction.Realtime.Models; 4 | 5 | public class StreamReceiveResult 6 | { 7 | public StreamChannelStatus Status { get; set; } 8 | public int Count { get; set; } 9 | public bool EndOfMessage { get; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Realtime/Models/TranscriptionData.cs: -------------------------------------------------------------------------------- 1 | public class TranscriptionData 2 | { 3 | public string Transcript { get; set; } = null!; 4 | public float Confidence { get; set; } 5 | public string Language { get; set; } = null!; 6 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Repositories/Enums/RepositoryEnum.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Repositories.Enums; 2 | 3 | public static class RepositoryEnum 4 | { 5 | public const string FileRepository = nameof(FileRepository); 6 | public const string MongoRepository = nameof(MongoRepository); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/AgentTaskFilter.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Repositories.Filters; 2 | 3 | public class AgentTaskFilter 4 | { 5 | public Pagination Pager { get; set; } = new Pagination(); 6 | public string? AgentId { get; set; } 7 | public bool? Enabled { get; set; } 8 | public string? Status { get; set; } 9 | 10 | public static AgentTaskFilter Empty() 11 | { 12 | return new AgentTaskFilter(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Repositories/Filters/ConversationLogFilter.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Repositories.Filters; 2 | 3 | public class ConversationLogFilter 4 | { 5 | public int Size { get; set; } = 20; 6 | public DateTime StartTime { get; set; } = DateTime.UtcNow; 7 | 8 | public ConversationLogFilter() 9 | { 10 | 11 | } 12 | 13 | public static ConversationLogFilter Empty() 14 | { 15 | return new(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpTable.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Repositories; 2 | 3 | public interface IBotSharpTable 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Repositories/Models/DialogContentUpdateModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Repositories.Models 2 | { 3 | public class DialogContentUpdateModel 4 | { 5 | public int Index { get; set; } 6 | public string UpdateContent { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Repositories/Records/RecordBase.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Repositories.Records; 2 | 3 | public class RecordBase 4 | { 5 | public Guid Id { get; set; } = Guid.Empty; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Repositories/Records/RoutingProfileRecord.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Routing.Models; 2 | 3 | namespace BotSharp.Abstraction.Repositories.Records; 4 | 5 | public class RoutingProfileRecord : RecordBase 6 | { 7 | public string Name { get; set; } 8 | public List AgentIds { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Roles/Models/RoleAgentAction.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Roles.Models; 2 | 3 | public class RoleAgentAction 4 | { 5 | [JsonPropertyName("id")] 6 | public string Id { get; set; } 7 | 8 | [JsonPropertyName("agent_id")] 9 | public string AgentId { get; set; } 10 | 11 | [JsonIgnore] 12 | public Agent? Agent { get; set; } 13 | 14 | [JsonPropertyName("actions")] 15 | public IEnumerable Actions { get; set; } = []; 16 | } 17 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Routing/Enums/RoutingMode.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Routing.Enums; 2 | 3 | public class RoutingMode 4 | { 5 | public const string Eager = "eager"; 6 | public const string Lazy = "lazy"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Routing/Executor/IFunctionExecutor.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Routing.Executor; 2 | 3 | public interface IFunctionExecutor 4 | { 5 | public Task ExecuteAsync(RoleDialogModel message); 6 | public Task GetIndicatorAsync(RoleDialogModel message); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Routing/Models/DecomposedStep.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Routing.Models; 2 | 3 | public class DecomposedStep 4 | { 5 | public string Description { get; set; } 6 | 7 | [JsonPropertyName("total_remaining_steps")] 8 | public int TotalRemainingSteps { get; set; } 9 | 10 | [JsonPropertyName("should_stop")] 11 | public bool ShouldStop { get; set; } 12 | 13 | [JsonPropertyName("stop_reason")] 14 | public string? StopReason { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Routing/Models/FallbackArgs.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Routing.Models; 2 | 3 | public class FallbackArgs 4 | { 5 | [JsonPropertyName("fallback_reason")] 6 | public string Reason { get; set; } = null!; 7 | 8 | [JsonPropertyName("user_question")] 9 | public string Question { get; set; } = null; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Routing/Models/ResponseUserArgs.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Routing.Models; 2 | 3 | public class ResponseUserArgs 4 | { 5 | [JsonPropertyName("content")] 6 | public string Content { get; set; } = string.Empty; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Routing/Models/RoutingHandlerDef.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Functions.Models; 2 | 3 | namespace BotSharp.Abstraction.Routing.Models; 4 | 5 | public class RoutingHandlerDef 6 | { 7 | public string Name { get; set; } 8 | public string Description { get; set; } 9 | public List Parameters { get; set; } 10 | 11 | public override string ToString() 12 | => $"{Name}: {Description} ({Parameters.Count} Parameters)"; 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Routing/Settings/RoutingSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Routing.Settings; 2 | 3 | public class RoutingSettings 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Rules/IRuleAction.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Rules; 2 | 3 | public interface IRuleAction 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Rules/IRuleConfig.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Rules; 2 | 3 | public interface IRuleConfig 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Rules/IRuleCriteria.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Rules; 2 | 3 | public interface IRuleCriteria 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Rules/IRuleEngine.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Rules; 2 | 3 | public interface IRuleEngine 4 | { 5 | Task> Triggered(IRuleTrigger trigger, string data, List? states = null); 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Rules/IRuleTrigger.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Rules; 2 | 3 | public interface IRuleTrigger 4 | { 5 | string Channel => throw new NotImplementedException("Please set the channel of trigger"); 6 | 7 | string Name => throw new NotImplementedException("Please set the name of trigger"); 8 | 9 | string EntityType { get; set; } 10 | 11 | string EntityId { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Settings/ISettingService.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | 3 | namespace BotSharp.Abstraction.Settings; 4 | 5 | /// 6 | /// This settings service is used to cache, monitor changes and encrypt settings in the system and user level 7 | /// 8 | public interface ISettingService 9 | { 10 | T Bind(string path) where T : new(); 11 | 12 | object GetDetail(string settingName, bool mask = false); 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Settings/SettingsMeta.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Settings; 2 | 3 | public class SettingsMeta 4 | { 5 | public string Name { get; set; } 6 | 7 | public SettingsMeta(string name) 8 | { 9 | Name = name; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Shared/IHaveServiceProvider.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Shared; 2 | 3 | public interface IHaveServiceProvider 4 | { 5 | IServiceProvider ServiceProvider { get; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Statistics/Enums/StatsInterval.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Statistics.Enums; 2 | 3 | public enum StatsInterval 4 | { 5 | Minute = 1, 6 | Hour = 2, 7 | Day = 3 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Statistics/Enums/StatsMetric.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Statistics.Enums; 2 | 3 | public static class StatsMetric 4 | { 5 | public static string AgentLlmCost = "agent-llm-cost"; 6 | public static string AgentCall = "agent-call"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Statistics/Enums/StatsOperation.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Statistics.Enums; 2 | 3 | public enum StatsOperation 4 | { 5 | Add = 1, 6 | Subtract = 2, 7 | Reset = 3 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Statistics/Services/IBotSharpStatsService.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Statistics.Models; 2 | 3 | namespace BotSharp.Abstraction.Statistics.Services; 4 | 5 | public interface IBotSharpStatsService 6 | { 7 | bool UpdateStats(string @event, BotSharpStatsDelta delta); 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Statistics/Settings/StatisticsSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Statistics.Settings; 2 | 3 | public class StatisticsSettings 4 | { 5 | public bool Enabled { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Tasks/Enums/TaskStatus.cs: -------------------------------------------------------------------------------- 1 | /// 2 | /// Agent task status 3 | /// 4 | public class TaskStatus 5 | { 6 | public const string Scheduled = "scheduled"; 7 | public const string New = "new"; 8 | public const string Running = "running"; 9 | public const string Success = "success"; 10 | public const string Failed = "failed"; 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Tasks/ITaskFeeder.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Tasks.Models; 2 | 3 | namespace BotSharp.Abstraction.Tasks; 4 | 5 | public interface ITaskFeeder 6 | { 7 | Task> GetTasks(); 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Templating/Constants/TemplateRenderConstant.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Templating.Constants; 2 | 3 | public static class TemplateRenderConstant 4 | { 5 | public const string RENDER_AGENT = "render_agent"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Templating/IResponseTemplateService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Templating; 2 | 3 | public interface IResponseTemplateService 4 | { 5 | Task RenderFunctionResponse(string agentId, RoleDialogModel message); 6 | 7 | Task RenderIntentResponse(string agentId, RoleDialogModel message); 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Templating/ITemplateRender.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Templating; 2 | 3 | public interface ITemplateRender 4 | { 5 | string Render(string template, Dictionary dict); 6 | void RegisterType(Type type); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Translation/Attributes/TranslateAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Translation.Attributes; 2 | 3 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false)] 4 | public class TranslateAttribute : Attribute 5 | { 6 | public TranslateAttribute() 7 | { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Translation/ITranslationService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Translation; 2 | 3 | public interface ITranslationService 4 | { 5 | Task Translate(Agent router, string messageId, T data, string language = "Spanish", bool clone = true) where T : class; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Translation/Models/TranslationInput.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Translation.Models; 2 | 3 | public class TranslationInput 4 | { 5 | [JsonPropertyName("id")] 6 | public int Id { get; set; } = -1; 7 | 8 | [JsonPropertyName("text")] 9 | public string Text { get; set; } = null!; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Translation/Models/TranslationOutput.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Translation.Models; 2 | 3 | public class TranslationOutput 4 | { 5 | [JsonPropertyName("input_lang")] 6 | public string InputLanguage { get; set; } = null!; 7 | 8 | [JsonPropertyName("output_lang")] 9 | public string OutputLanguage { get; set; } = LanguageType.ENGLISH; 10 | 11 | [JsonPropertyName("texts")] 12 | public TranslationInput[] Texts { get; set; } = Array.Empty(); 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Translation/Models/TranslationResponseModel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Translations; 4 | 5 | public class TranslationResponseModel 6 | { 7 | public string Text { get; set; } = null!; 8 | 9 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 10 | public string FromLang { get; set; } = null!; 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Users/Enums/UserAction.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Users.Enums; 2 | 3 | /// 4 | /// User actions on agent level 5 | /// 6 | public static class UserAction 7 | { 8 | public const string Edit = "edit"; 9 | public const string Chat = "chat"; 10 | public const string Train = "train"; 11 | public const string Evaluate = "evaluate"; 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Users/Enums/UserConstant.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Users.Enums; 2 | 3 | public static class UserConstant 4 | { 5 | public static IEnumerable AdminRoles = new List 6 | { 7 | UserRole.Admin, 8 | UserRole.Root 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Users/Enums/UserPermission.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Users.Enums; 2 | 3 | /// 4 | /// User permission 5 | /// 6 | public static class UserPermission 7 | { 8 | public const string CreateAgent = "create-agent"; 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Users/Enums/UserSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BotSharp.Abstraction.Users.Enums 8 | { 9 | public static class UserSource 10 | { 11 | public const string Internal = "internal"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Users/Enums/UserType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Users.Enums; 2 | 3 | public class UserType 4 | { 5 | public const string Internal = "internal"; 6 | public const string Client = "client"; 7 | public const string Affiliate = "affiliate"; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Users/Models/UserActivationModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Users; 2 | 3 | public class UserActivationModel 4 | { 5 | public string UserName { get; set; } 6 | public string VerificationCode { get; set; } 7 | public string RegionCode { get; set; } = "CN"; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Users/Models/UserAgentAction.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Users.Models; 2 | 3 | public class UserAgentAction 4 | { 5 | [JsonPropertyName("id")] 6 | public string Id { get; set; } 7 | 8 | [JsonPropertyName("agent_id")] 9 | public string AgentId { get; set; } 10 | 11 | [JsonIgnore] 12 | public Agent? Agent { get; set; } 13 | 14 | [JsonPropertyName("actions")] 15 | public IEnumerable Actions { get; set; } = []; 16 | } 17 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Users/Settings/AccountSetting.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Users.Settings; 2 | 3 | public class AccountSetting 4 | { 5 | /// 6 | /// Whether to enable verification code to verify the authenticity of new users 7 | /// 8 | public bool NewUserVerification { get; set; } 9 | public string[] AllowMultipleDeviceLoginUserIds { get; set; } = []; 10 | public bool CreateUserAutomatically { get; set; } = true; 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Utilities/DateTimePagination.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Utilities; 2 | 3 | public class DateTimePagination : PagedItems 4 | { 5 | public DateTime? NextTime { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Utilities/GuidExtensitions.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Utilities; 2 | 3 | public static class GuidExtensitions 4 | { 5 | public static Guid IfNullOrEmptyAsDefault(this string str) 6 | => string.IsNullOrEmpty(str) ? Guid.Empty : Guid.Parse(str); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Utilities/ListExtenstions.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Utilities; 2 | 3 | public static class ListExtenstions 4 | { 5 | public static bool IsNullOrEmpty(this IEnumerable? list) 6 | { 7 | return list == null || !list.Any(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/Utilities/StringIdPagination.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.Utilities; 2 | 3 | public class StringIdPagination : Pagination 4 | { 5 | [JsonPropertyName("start_id")] 6 | public string? StartId { get; set; } 7 | } 8 | 9 | public class StringIdPagedItems : PagedItems 10 | { 11 | public new ulong Count { get; set; } 12 | 13 | [JsonPropertyName("next_id")] 14 | public string? NextId { get; set; } 15 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/VectorStorage/Enums/VectorDataSource.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.VectorStorage.Enums; 2 | 3 | public static class VectorDataSource 4 | { 5 | public const string Api = "api"; 6 | public const string User = "user"; 7 | public const string File = "file"; 8 | } 9 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/Snapshot/VectorCollectionSnapshot.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.VectorStorage.Models; 2 | 3 | public class VectorCollectionSnapshot 4 | { 5 | public string Name { get; set; } = default!; 6 | public long Size { get; set; } 7 | public DateTime CreatedTime { get; set; } 8 | public string? CheckSum { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/VectorCollectionData.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.VectorStorage.Models; 2 | 3 | public class VectorCollectionData 4 | { 5 | public string Id { get; set; } 6 | public Dictionary Data { get; set; } = new(); 7 | public double? Score { get; set; } 8 | 9 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 10 | public float[]? Vector { get; set; } 11 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/VectorCreateModel.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.VectorStorage.Enums; 2 | 3 | namespace BotSharp.Abstraction.VectorStorage.Models; 4 | 5 | public class VectorCreateModel 6 | { 7 | public string Text { get; set; } 8 | public string DataSource { get; set; } = VectorDataSource.Api; 9 | public Dictionary? Payload { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/VectorSearchOptions.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Knowledges.Enums; 2 | 3 | namespace BotSharp.Abstraction.VectorStorage.Models; 4 | 5 | public class VectorSearchOptions 6 | { 7 | public IEnumerable? Fields { get; set; } = new List { KnowledgePayloadName.Text, KnowledgePayloadName.Answer }; 8 | public int? Limit { get; set; } = 5; 9 | public float? Confidence { get; set; } = 0.5f; 10 | public bool WithVector { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/VectorUpdateModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.VectorStorage.Models; 2 | 3 | public class VectorUpdateModel : VectorCreateModel 4 | { 5 | public string Id { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core.Crontab/Enum/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Core.Crontab.Enum; 2 | 3 | public class UtilityName 4 | { 5 | public const string ScheduleTask = "schedule-task"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core.Crontab/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-crontab-task_wait.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "util-crontab-task_wait", 3 | "description": "wait for a peroid of time then process", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "delay_time": { 8 | "type": "number", 9 | "description": "delay time in seconds" 10 | } 11 | }, 12 | "required": [ 13 | "delay_time" 14 | ] 15 | } 16 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core.Crontab/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-crontab-schedule_task.fn.liquid: -------------------------------------------------------------------------------- 1 | Call util-crontab-schedule_task if user needs to set up a scheduled task with appropriate programming script and language type. 2 | Set cron_expression as empty if user wants to cancel schedule. -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core.Rules/Using.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.Extensions.Configuration; 2 | global using Microsoft.Extensions.DependencyInjection; 3 | 4 | global using BotSharp.Abstraction.Agents.Enums; 5 | global using BotSharp.Abstraction.Plugins; 6 | global using BotSharp.Abstraction.Agents; 7 | global using BotSharp.Abstraction.Conversations.Models; 8 | global using BotSharp.Abstraction.Instructs; 9 | global using BotSharp.Abstraction.Instructs.Models; 10 | 11 | global using BotSharp.Abstraction.Rules; -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core.Rules/data/agents/201e49a2-40b3-4ccd-b8cc-2476565a1b40/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are a rule interpreter, analyze and respond according to the following steps: 2 | 1. Understand the rules customized by the user; 3 | 2. Determine whether the input data meets the user's action execution conditions; 4 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core.Rules/data/agents/201e49a2-40b3-4ccd-b8cc-2476565a1b40/templates/criteria_check.liquid: -------------------------------------------------------------------------------- 1 | You are a rule interpreter, analyze and respond according to the following steps: 2 | 1. Understand the rules customized by the user; 3 | 2. Determine whether the input data meets the user's action execution conditions; 4 | 3. If it meets the conditions, output number "1", otherwise output "0" -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core.SideCar/Settings/SideCarSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Core.SideCar.Settings; 2 | 3 | public class SideCarSettings 4 | { 5 | public BaseSetting Conversation { get; set; } 6 | } 7 | 8 | public class BaseSetting 9 | { 10 | public string Provider { get; set; } 11 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | false 5 | 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationProgressService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Core.Conversations.Services 2 | { 3 | public class ConversationProgressService : IConversationProgressService 4 | { 5 | 6 | public FunctionExecuting OnFunctionExecuting { get; set; } 7 | 8 | 9 | public FunctionExecuted OnFunctionExecuted { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Instructs; 2 | 3 | namespace BotSharp.Core.Instructs; 4 | 5 | public partial class InstructService : IInstructService 6 | { 7 | private readonly IServiceProvider _services; 8 | private readonly ILogger _logger; 9 | 10 | public InstructService( 11 | IServiceProvider services, 12 | ILogger logger) 13 | { 14 | _services = services; 15 | _logger = logger; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/Loggers/LoggerPlugin.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | 3 | namespace BotSharp.Core.Loggers; 4 | 5 | public class LoggerPlugin : IBotSharpPlugin 6 | { 7 | public string Id => "ea1aade7-7e29-4f13-a78b-2b1835aa4fea"; 8 | public string Name => "Logger"; 9 | public string Description => "Provide log service"; 10 | 11 | public void RegisterDI(IServiceCollection services, IConfiguration config) 12 | { 13 | services.AddScoped(); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/MCP/Settings/MCPSettings.cs: -------------------------------------------------------------------------------- 1 | using ModelContextProtocol.Client; 2 | 3 | namespace BotSharp.Core.MCP.Settings; 4 | 5 | public class McpSettings 6 | { 7 | public bool Enabled { get; set; } = true; 8 | public McpClientOptions McpClientOptions { get; set; } 9 | public List McpServerConfigs { get; set; } = []; 10 | } 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/build/BotSharp.Core.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01dcc3e5-0af7-49e6-ad7a-a760bd12dc4b/agent.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "01dcc3e5-0af7-49e6-ad7a-a760bd12dc4b", 3 | "name": "Human Support", 4 | "description": "Reach out to human customer service.", 5 | "type": "task", 6 | "createdDateTime": "2024-04-22T10:00:00Z", 7 | "updatedDateTime": "2024-04-22T10:00:00Z", 8 | "disabled": false, 9 | "isPublic": true, 10 | "profiles": [ "human" ] 11 | } 12 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01dcc3e5-0af7-49e6-ad7a-a760bd12dc4b/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are a human customer service connection program. 2 | When other AI customer service agents cannot solve user problems, you know how to call the API to transfer users to human customer service for answers. 3 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/functions/get_weather.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get_weather", 3 | "description": "Get weather information for user.", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "city": { 8 | "type": "string", 9 | "description": "The city where the user wants to get weather information." 10 | } 11 | }, 12 | "required": [ "city" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are a AI Assistant. You can answer user's question. -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-0af7-49e6-ad7a-a760bd12dc4d/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are a smart AI Assistant. 2 | {% if agent_redirection_reason %} 3 | You've been reached out because: {{ agent_redirection_reason }} 4 | {% endif %} -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/functions/response_to_user.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "response_to_user", 3 | "description": "Response to user without routing to any other agent, user has no specific request.", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "content": { 8 | "type": "string", 9 | "description": "Response content" 10 | } 11 | }, 12 | "required": [ "content" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/reasoner.hf.liquid: -------------------------------------------------------------------------------- 1 | Break down the user’s most recent needs and figure out the instruction of next step without explanation. -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/reasoner.one-step-forward.liquid: -------------------------------------------------------------------------------- 1 | Analyze the user's problem. Which prerequisite task needs to be completed? Output the next step of routing instructions. 2 | Check the job responsibilities of the routable Agent and do not transfer to an Agent that exceeds the scope of responsibility. 3 | If the user request may require other tools or services, route to the planner agent. 4 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/reasoner.sequential.liquid: -------------------------------------------------------------------------------- 1 | In order to sequentially execute user tasks, 2 | What is the next step based on the CONVERSATION? -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are a utility agent. -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-instruct-execute_template.fn.liquid: -------------------------------------------------------------------------------- 1 | please call function util-routing-execute_template if user wants to use a template to fulfill a specific task. 2 | Please ensure each template is executed only once. 3 | Please output the template response directly without changing anthything. -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-routing-fallback_to_router.fn.liquid: -------------------------------------------------------------------------------- 1 | Carefully consider whether the current user request is related to your responsibilities. Only when it is not relevant should you consider Return to the Router. -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/agent.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "dfd9b46d-d00c-40af-8a75-3fbdc2b89869", 3 | "name": "Evaluator", 4 | "description": "Evaluate the performance of the LLM agents", 5 | "createdDateTime": "2023-08-18T00:00:00Z", 6 | "updatedDateTime": "2023-08-18T00:00:00Z", 7 | "disabled": true, 8 | "llmConfig": { 9 | "model": "gpt-35-turbo-instruct" 10 | } 11 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | This is a model evaluation program, which interacts with model to complete a certain task based on the background information given to you. 2 | 3 | {{ task_prompt }} 4 | 5 | user: Hi! 6 | assistant: Hello, How can I help you? 7 | user: 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/templates/instruction.executor.liquid: -------------------------------------------------------------------------------- 1 | This is a model executing program, which interactive with model to complete a certain task based on the background information given to you. 2 | 3 | {{ task_prompt }} 4 | 5 | user: Hi! 6 | assistant: Hello, How can I help you? 7 | user: -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.Core/data/plugins/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "Comment": "User can change this configuration dynamically and reflect updates to UI.", 3 | "EnabledPlugins": [ 4 | "6e52d42d-1e23-406b-8599-36af36c83209", 5 | "d42a0c21-b461-44f6-ada2-499510d260af" 6 | ] 7 | } -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/Controllers/FileController.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.Controllers; 2 | 3 | [Authorize] 4 | [ApiController] 5 | public class FileController : ControllerBase 6 | { 7 | private readonly IServiceProvider _services; 8 | 9 | public FileController(IServiceProvider services) 10 | { 11 | _services = services; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/ConversationCreationModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 2 | 3 | public class ConversationCreationModel 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/InputMessageFiles.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 2 | 3 | public class InputMessageFiles 4 | { 5 | public List States { get; set; } = new(); 6 | public List Files { get; set; } = new(); 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/MigrateLatestStateRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 2 | 3 | public class MigrateLatestStateRequest 4 | { 5 | public int BatchSize { get; set; } = 1000; 6 | public int ErrorLimit { get; set; } = 10; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/NewMessageModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 2 | 3 | public class NewMessageModel : IncomingMessageModel 4 | { 5 | public override string Channel { get; set; } = ConversationChannel.OpenAPI; 6 | } 7 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/UpdateConversationRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 2 | 3 | public class UpdateConversationRequest 4 | { 5 | public List ToAddTags { get; set; } = []; 6 | public List ToDeleteTags { get; set; } = []; 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/UpdateConversationTitleAliasModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 4 | 5 | public class UpdateConversationTitleAliasModel 6 | { 7 | [Required] 8 | public string NewTitleAlias { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/UpdateConversationTitleModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 4 | 5 | public class UpdateConversationTitleModel 6 | { 7 | [Required] 8 | public string NewTitle { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/UpdateMessageModel.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Conversations.Dtos; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 5 | 6 | public class UpdateMessageModel 7 | { 8 | [JsonPropertyName("message")] 9 | public ChatResponseModel Message { get; set; } = null!; 10 | 11 | [JsonPropertyName("inner_index")] 12 | public int InnerIndex { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Response/ChatResponseModel.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Conversations.Dtos; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Conversations; 4 | 5 | public class ChatResponseModel : ChatResponseDto 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Embeddings/Request/EmbeddingInputModel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Embeddings; 4 | 5 | public class EmbeddingInputModel : MessageConfig 6 | { 7 | [JsonPropertyName("texts")] 8 | public IEnumerable Texts { get; set; } = new List(); 9 | 10 | [JsonPropertyName("dimension")] 11 | public int? Dimension { get; set; } = 3072; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Instructs/View/InstructBaseViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Instructs; 4 | 5 | public class InstructBaseViewModel 6 | { 7 | [JsonPropertyName("content")] 8 | public string Content { get; set; } = string.Empty; 9 | 10 | [JsonPropertyName("message")] 11 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 12 | public string? Message { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Instructs/View/MultiModalViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Instructs; 2 | 3 | public class MultiModalViewModel : InstructBaseViewModel 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Instructs/View/PdfCompletionViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Instructs; 2 | 3 | public class PdfCompletionViewModel : InstructBaseViewModel 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Instructs/View/SpeechToTextViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Instructs; 2 | 3 | public class SpeechToTextViewModel : InstructBaseViewModel 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/DeleteVectorCollectionSnapshotRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Knowledges; 4 | 5 | public class DeleteVectorCollectionSnapshotRequest 6 | { 7 | [JsonPropertyName("snapshot_name")] 8 | public string SnapshotName { get; set; } = default!; 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/GetKnowledgeDocsRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.OpenAPI.ViewModels.Knowledges; 2 | 3 | public class GetKnowledgeDocsRequest : KnowledgeFileFilter 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/SearchGraphKnowledgeRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Knowledges; 4 | 5 | public class SearchGraphKnowledgeRequest 6 | { 7 | [JsonPropertyName("query")] 8 | public string Query { get; set; } = string.Empty; 9 | 10 | [JsonPropertyName("method")] 11 | public string Method { get; set; } = string.Empty; 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/VectorKnowledgeUpdateRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Knowledges; 4 | 5 | public class VectorKnowledgeUpdateRequest : VectorKnowledgeCreateRequest 6 | { 7 | [JsonPropertyName("id")] 8 | public string Id { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/VectorKnowledgeUploadRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Knowledges; 4 | 5 | public class VectorKnowledgeUploadRequest 6 | { 7 | [JsonPropertyName("files")] 8 | public IEnumerable Files { get; set; } = new List(); 9 | 10 | [JsonPropertyName("chunk_option")] 11 | public ChunkOption? ChunkOption { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/View/GraphKnowledgeViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.OpenAPI.ViewModels.Knowledges; 4 | 5 | public class GraphKnowledgeViewModel 6 | { 7 | [JsonPropertyName("result")] 8 | public string Result { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.AnthropicAI/Settings/AnthropicSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.AnthropicAI.Settings; 2 | 3 | public class AnthropicSettings 4 | { 5 | public ClaudeSetting Claude { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.AnthropicAI/Settings/ClaudeSetting.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.AnthropicAI.Settings; 2 | 3 | public class ClaudeSetting 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.AudioHandler/Enums/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.AudioHandler.Enums; 2 | 3 | public class UtilityName 4 | { 5 | public const string AudioHandler = "audio-handler"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.AudioHandler/Models/AudioOutput.cs: -------------------------------------------------------------------------------- 1 | using Whisper.net; 2 | 3 | namespace BotSharp.Plugin.AudioHandler.Models; 4 | 5 | public class AudioOutput 6 | { 7 | public List Segments { get; set; } = new(); 8 | 9 | public override string ToString() 10 | { 11 | return this.Segments.Count > 0 ? string.Join(" ", this.Segments.Select(x => x.Text)) : string.Empty; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.AudioHandler/Settings/AudioHandlerSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.AudioHandler.Settings; 2 | 3 | public class AudioHandlerSettings 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.AudioHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-audio-handle_audio_request.fn.liquid: -------------------------------------------------------------------------------- 1 | Please call util-audio-handle_audio_request if user wants to transcribe or summarize the content of a audio file. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.AzureOpenAI/Models/TextCompletionRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.AzureOpenAI.Models; 4 | 5 | public class TextCompletionRequest 6 | { 7 | [JsonPropertyName("prompt")] 8 | public string Prompt { get; set; } = string.Empty; 9 | 10 | [JsonPropertyName("max_tokens")] 11 | public int MaxTokens { get; set; } = 256; 12 | 13 | [JsonPropertyName("temperature")] 14 | public float Temperature { get; set; } = 0; 15 | } 16 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.AzureOpenAI/Settings/AzureOpenAiSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.AzureOpenAI.Settings; 2 | 3 | public class AzureOpenAiSettings 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ChatHub/Enums/EventDispatchType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.ChatHub.Enums; 2 | 3 | public static class EventDispatchType 4 | { 5 | public const string Group = "group"; 6 | public const string User = "user"; 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ChatHub/Settings/ChatHubSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.ChatHub.Settings; 2 | 3 | public class ChatHubSettings 4 | { 5 | public string EventDispatchBy { get; set; } = EventDispatchType.Group; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ChatbotUI/Chatbot-UI.md: -------------------------------------------------------------------------------- 1 | # Chatbot UI 2 | [Chatbot UI](https://github.com/SciSharp/chatbot-ui) is an open source chat UI for AI models. 3 | 4 | ```shell 5 | git clone https://github.com/SciSharp/chatbot-ui 6 | cd chatbot-ui (change dir to chatbot-ui to find the package.json) 7 | npm i 8 | npm run dev 9 | ``` 10 | 11 | * Rename `.env.local.example` to `.env.local` 12 | 13 | ```shell 14 | # Change host to BotSharp service 15 | OPENAI_API_HOST=http://localhost:5500 16 | ``` 17 | Access `http://localhost:3000` 18 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ChatbotUI/ViewModels/OpenAiChatOutput.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BotSharp.Plugin.ChatbotUI.ViewModels; 4 | 5 | public class OpenAiChatOutput 6 | { 7 | public List Choices { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ChatbotUI/ViewModels/OpenAiChoice.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Conversations.Models; 2 | using Newtonsoft.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace BotSharp.Plugin.ChatbotUI.ViewModels; 6 | 7 | public class OpenAiChoice 8 | { 9 | [JsonPropertyName("finish_reason")] 10 | [JsonProperty("finish_reason")] 11 | public string FinishReason { get; set; } 12 | public RoleDialogModel Delta { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ChatbotUI/ViewModels/OpenAiMessageBody.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.ChatbotUI.ViewModels; 2 | 3 | public class OpenAiMessageBody 4 | { 5 | public string Role { get; set; } 6 | public string Content { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ChatbotUI/ViewModels/OpenAiModels.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace BotSharp.Plugin.ChatbotUI.ViewModels; 5 | 6 | public class OpenAiModels 7 | { 8 | public List Data { get; set; } = new List(); 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.CodeDriver/Models/SaveSourceCodeArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.CodeDriver.Models; 4 | 5 | public class SaveSourceCodeArgs 6 | { 7 | [JsonPropertyName("file_path")] 8 | public string FilePath { get; set; } = string.Empty; 9 | 10 | [JsonPropertyName("source_code")] 11 | public string SourceCode { get; set; } = string.Empty; 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.CodeDriver/Using.cs: -------------------------------------------------------------------------------- 1 | global using BotSharp.Abstraction.Agents.Enums; 2 | global using BotSharp.Abstraction.Plugins; -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Dashboard/Hooks/StatsConversationHook.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Conversations; 2 | 3 | namespace BotSharp.Plugin.Dashboard.Hooks; 4 | 5 | public class StatsConversationHook : ConversationHookBase 6 | { 7 | private readonly IServiceProvider _services; 8 | public StatsConversationHook(IServiceProvider services) 9 | { 10 | _services = services; 11 | } 12 | 13 | public override async Task OnConversationInitialized(Conversation conversation) 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.EmailHandler/Enums/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.EmailHandler.Enums; 2 | 3 | public class UtilityName 4 | { 5 | public const string EmailHandler = "email-handler"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.EmailHandler/LlmContexts/LlmContextOut.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.EmailHandler.LlmContexts; 4 | 5 | public class LlmContextOut 6 | { 7 | [JsonPropertyName("selected_ids")] 8 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 9 | public IEnumerable Selecteds { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.EmailHandler/Models/EmailSubjectElement.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Messaging.Models.RichContent.Template; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace BotSharp.Plugin.EmailHandler.Models 9 | { 10 | public class EmailSubjectElement : GenericElement 11 | { 12 | public string Subject { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.EmailHandler/Settings/EmailReaderSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BotSharp.Plugin.EmailHandler.Settings; 8 | 9 | public class EmailReaderSettings 10 | { 11 | public string Username { get; set; } = string.Empty; 12 | public string Password { get; set; } = string.Empty; 13 | public string IMAPServer { get; set; } = string.Empty; 14 | public int IMAPPort { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.EmailHandler/Settings/EmailSenderSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.EmailHandler.Settings; 2 | 3 | public class EmailSenderSettings 4 | { 5 | public string EmailAddress { get; set; } = string.Empty; 6 | public string Name { get; set; } = string.Empty; 7 | public string Username { get; set; } = string.Empty; 8 | public string Password { get; set; } = string.Empty; 9 | public string SMTPServer { get; set; } = string.Empty; 10 | public int SMTPPort { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-email-handle_email_reader.fn.liquid: -------------------------------------------------------------------------------- 1 | Please call util-email-handle_email_reader if user wants to read messages from email inbox. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-email-handle_email_sender.fn.liquid: -------------------------------------------------------------------------------- 1 | ** Please take a look at the conversation and decide whether user wants to send email. 2 | ** If yes, then decide whether user wants to send email with files/attachments/images or not. 3 | ** If user does not want to send email explicitly or only upload images or files, please do not respond anything email related message. 4 | ** Please call util-email-handle_email_sender if user wants to send email. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/Enums/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.ExcelHandler.Enums; 2 | 3 | public class UtilityName 4 | { 5 | public const string ExcelHandler = "excel-handler"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/Helpers/MySql/IMySqlDbHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.Data.Sqlite; 7 | using MySql.Data.MySqlClient; 8 | 9 | namespace BotSharp.Plugin.ExcelHandler.Helpers.MySql 10 | { 11 | public interface IMySqlDbHelper 12 | { 13 | MySqlConnection GetDbConnection(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/Helpers/Sqlite/ISqliteDbHelpers.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Data.Sqlite; 2 | 3 | namespace BotSharp.Plugin.ExcelHandler.Helpers.Sqlite; 4 | 5 | public interface ISqliteDbHelpers 6 | { 7 | SqliteConnection GetPhysicalDbConnection(); 8 | SqliteConnection GetInMemoryDbConnection(); 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/LlmContexts/LlmContextIn.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.ExcelHandler.LlmContexts 4 | { 5 | public class LlmContextIn 6 | { 7 | [JsonPropertyName("user_request")] 8 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] 9 | public string? UserRequest { get; set; } 10 | 11 | [JsonPropertyName("is_need_processing")] 12 | public bool IsNeedProcessing { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/LlmContexts/LlmContextOut.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.ExcelHandler.LlmContexts; 2 | 3 | public class LlmContextOut 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/Models/SqlContextOut.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.ExcelHandler.Models; 2 | 3 | public class SqlContextOut 4 | { 5 | public bool isSuccessful { get; set; } 6 | public string Message { get; set; } 7 | public string FileName { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/Services/IDbService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BotSharp.Plugin.ExcelHandler.Models; 7 | using NPOI.SS.UserModel; 8 | 9 | namespace BotSharp.Plugin.ExcelHandler.Services 10 | { 11 | public interface IDbService 12 | { 13 | IEnumerable WriteExcelDataToDB(IWorkbook workbook); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/Services/IMySqlService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.ExcelHandler.Services; 2 | 3 | public interface IMySqlService : IDbService 4 | { 5 | public bool DeleteTableSqlQuery(); 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/Services/ISqliteService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BotSharp.Plugin.ExcelHandler.Models; 7 | using NPOI.SS.UserModel; 8 | 9 | namespace BotSharp.Plugin.ExcelHandler.Services 10 | { 11 | public interface ISqliteService : IDbService 12 | { 13 | public void DeleteTableSqlQuery(); 14 | public string GenerateTableSchema(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/Settings/ExcelHandlerSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace BotSharp.Plugin.ExcelHandler.Settings; 8 | 9 | public class ExcelHandlerSettings 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.ExcelHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-excel-handle_excel_request.fn.liquid: -------------------------------------------------------------------------------- 1 | Please call util-excel-handle_excel_request if user wants to load the data from a excel/csv file. 2 | util-excel-handle_excel_request can NOT generate excel/csv. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.FileHandler/Enums/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.FileHandler.Enums; 2 | 3 | public class UtilityName 4 | { 5 | public const string ImageGenerator = "image-generator"; 6 | public const string ImageReader = "image-reader"; 7 | public const string ImageEditor = "image-editor"; 8 | public const string PdfReader = "pdf-reader"; 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.FileHandler/LlmContexts/LlmContextOut.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.FileHandler.LlmContexts; 4 | 5 | public class LlmContextOut 6 | { 7 | [JsonPropertyName("selected_id")] 8 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 9 | public int? Selected { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.FileHandler/Settings/FileHandlerSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.FileHandler.Settings; 2 | 3 | public class FileHandlerSettings 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.FileHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-edit_image.fn.liquid: -------------------------------------------------------------------------------- 1 | Please call util-file-edit_image if user wants to edit or change an image in the conversation. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.FileHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-generate_image.fn.liquid: -------------------------------------------------------------------------------- 1 | ** Please call util-file-generate_image if user wants you to provide or generate an image or picture. 2 | ** If user does not generate image explicitly, please do not call generate_image. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.FileHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-read_image.fn.liquid: -------------------------------------------------------------------------------- 1 | Please call function util-file-read_image if user wants to describe an image or images. 2 | You can also call function util-file-read_image to access the image or images that user uploaded. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.FileHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-read_pdf.fn.liquid: -------------------------------------------------------------------------------- 1 | Please call function util-file-read_pdf if user wants to describe an pdf file or pdf files. 2 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Graph/GraphDbSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Graph; 2 | 3 | public class GraphDbSettings 4 | { 5 | public string BaseUrl { get; set; } 6 | public string SearchPath { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Graph/Models/GraphQueryRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.Graph.Models; 4 | 5 | public class GraphQueryRequest 6 | { 7 | [JsonPropertyName("query")] 8 | public string Query { get; set; } 9 | 10 | [JsonPropertyName("method")] 11 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 12 | public string? Method { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Graph/Using.cs: -------------------------------------------------------------------------------- 1 | global using System; 2 | global using System.Collections.Generic; 3 | global using System.Linq; 4 | global using System.Threading.Tasks; 5 | global using Microsoft.Extensions.Logging; 6 | global using BotSharp.Abstraction.Graph; 7 | global using BotSharp.Abstraction.Graph.Models; -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HttpHandler/Enums/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.HttpHandler.Enums; 2 | 3 | public class UtilityName 4 | { 5 | public const string HttpHandler = "http-handler"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HttpHandler/LlmContexts/LlmContextIn.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.HttpHandler.LlmContexts; 4 | 5 | public class LlmContextIn 6 | { 7 | [JsonPropertyName("request_url")] 8 | public string? RequestUrl { get; set; } 9 | 10 | [JsonPropertyName("http_method")] 11 | public string? HttpMethod { get; set; } 12 | 13 | [JsonPropertyName("request_content")] 14 | public string? RequestContent { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HttpHandler/Settings/HttpHandlerSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.HttpHandler.Settings; 2 | 3 | public class HttpHandlerSettings 4 | { 5 | public string BaseAddress { get; set; } = string.Empty; 6 | public string Origin { get; set; } = string.Empty; 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HttpHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-http-handle_http_request.fn.liquid: -------------------------------------------------------------------------------- 1 | Please call util-http-handle_http_request if user wants to send an http request. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HttpHandler/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/agent.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "87c458fc-ec5f-40ae-8ed6-05dda8a07523", 3 | "name": "HTTP Handler", 4 | "description": "Use Web Open API to interact with 3rd system.", 5 | "type": "task", 6 | "createdDateTime": "2024-01-06T00:00:00Z", 7 | "updatedDateTime": "2024-01-06T00:00:00Z", 8 | "disabled": false, 9 | "isPublic": true, 10 | "profiles": [ "tool", "webapi" ], 11 | "llmConfig": { 12 | "max_recursion_depth": 1 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HttpHandler/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are an HTTP handler and know how to use Open API to interact with other systems. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/DataModels/InferenceInputOptions.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.HuggingFace.DataModels; 2 | 3 | public class InferenceInputOptions 4 | { 5 | [JsonPropertyName("use_cache")] 6 | public bool UseCache { get; set; } = true; 7 | 8 | [JsonPropertyName("wait_for_model")] 9 | public bool WaitForModel { get; set; } = true; 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/DataModels/TextGenResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.HuggingFace.DataModels; 2 | 3 | public class TextGenResponse 4 | { 5 | [JsonPropertyName("generated_text")] 6 | public string GeneratedText { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/HuggingChat/TextToken.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Abstraction.TextGeneratives; 2 | 3 | public class TextToken 4 | { 5 | public int Id { get; set; } 6 | public string Text { get; set; } = string.Empty; 7 | public float Logprob { get;set; } 8 | public bool Special { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/HuggingChat/ViewModels/ChatInput.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.HuggingFace.HuggingChat.ViewModels; 2 | 3 | public class ChatInput 4 | { 5 | public string Inputs { get; set; } 6 | public bool Stream { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/HuggingChat/ViewModels/ChatResponse.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.TextGeneratives; 2 | using Newtonsoft.Json; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace BotSharp.Plugin.HuggingFace.HuggingChat.ViewModels; 6 | 7 | public class ChatResponse 8 | { 9 | public TextToken Token { get; set; } 10 | [JsonPropertyName("generated_text")] 11 | [JsonProperty("generated_text")] 12 | public string GeneratedText { get; set; } 13 | public string Details { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/HuggingChat/ViewModels/ConversationCreationModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.HuggingFace.HuggingChat.ViewModels; 2 | 3 | public class ConversationCreationModel 4 | { 5 | public string Model { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/HuggingChat/ViewModels/ConversationViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.HuggingFace.HuggingChat.ViewModels; 2 | 3 | public class ConversationViewModel 4 | { 5 | public string ConversationId { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/Services/IInferenceApi.cs: -------------------------------------------------------------------------------- 1 | using Refit; 2 | 3 | namespace BotSharp.Plugin.HuggingFace.Services; 4 | 5 | /// 6 | /// https://huggingface.co/docs/api-inference/quicktour 7 | /// 8 | public interface IInferenceApi 9 | { 10 | [Post("/models/{space}/{model}")] 11 | Task> TextGenerate(string space, string model, [Body] InferenceInput input); 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.HuggingFace/Settings/HuggingFaceSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.HuggingFace.Settings; 2 | 3 | public class HuggingFaceSettings 4 | { 5 | public string EndPoint { get; set; } 6 | public string Model { get; set; } 7 | public string Token { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.KnowledgeBase/Enum/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.KnowledgeBase.Enum; 2 | 3 | public class UtilityName 4 | { 5 | public const string KnowledgeRetrieval = "knowledge-base"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.KnowledgeBase/MemVecDb/VecRecord.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.KnowledgeBase.MemVecDb; 2 | 3 | public class VecRecord 4 | { 5 | public string Id { get; set; } 6 | public float[] Vector { get; set; } 7 | public string Text { get; set; } 8 | 9 | public override string ToString() 10 | { 11 | return Text; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.KnowledgeBase/data/agents/01acc3e5-0af7-49e6-ad7a-a760bd12dc40/functions/confirm_knowledge_persistence.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "confirm_knowledge_persistence", 3 | "description": "Confirm with user whether need to save this knowledge to memory", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "question": { 8 | "type": "string", 9 | "description": "knowledge topic" 10 | } 11 | }, 12 | "required": [ "question" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.KnowledgeBase/data/agents/01acc3e5-0af7-49e6-ad7a-a760bd12dc40/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are an avid learner who is eager to learn and acquire knowledge from the conversation. 2 | You're good at learning useful domain knowledge and experience by interacting with user. 3 | Summarize the answer or solution in a concise steps. 4 | Confirm with user if you're going to save the knowledge to memory. 5 | If user confirmed, use tool of memorize_knowledge to save it. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.KnowledgeBase/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-kg-knowledge_retrieval.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "util-kg-knowledge_retrieval", 3 | "description": "Retrieve related domain knowledge to handle user request", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "question": { 8 | "type": "string", 9 | "description": "Knowledge topic with scenario detail" 10 | } 11 | }, 12 | "required": [ "question" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.KnowledgeBase/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-kg-knowledge_retrieval.fn.liquid: -------------------------------------------------------------------------------- 1 | Call function util-kg-knowledge_retrieval to retrieve related domain knowledge to handle user request. 2 | You must retrieve existing KnowledgeBase to get prerequisite informations before you writing SQL query; 3 | You must retrieve existing API specification from KnowledgeBase before calling a Web API; 4 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaAI/Settings/MetaAiSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaAI.Settings; 2 | 3 | public class MetaAiSettings 4 | { 5 | public fastTextSetting fastText { get; set; } = new(); 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaAI/Settings/fastTextSetting.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaAI.Settings; 2 | 3 | public class fastTextSetting 4 | { 5 | public string ModelPath { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaGLM/Models/RequestModels/ImageToTextModels/ImageUrlType.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaGLM.Models.RequestModels.ImageToTextModels 2 | { 3 | public class ImageUrlType 4 | { 5 | public string url { get; set; } 6 | 7 | public ImageUrlType(string url) 8 | { 9 | this.url = url; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaGLM/Models/RequestModels/MessageItem.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaGLM.Models.RequestModels; 2 | 3 | public class MessageItem 4 | { 5 | public string role { get; set; } 6 | public string content { get; set; } 7 | 8 | public MessageItem(string role, string content) 9 | { 10 | this.role = role; 11 | this.content = content; 12 | } 13 | 14 | public MessageItem() 15 | { 16 | } 17 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaGLM/Models/ResponseModels/EmbeddingModels/EmbeddingDataItem.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaGLM.Models.ResponseModels.EmbeddingModels; 2 | 3 | public class EmbeddingDataItem 4 | { 5 | public int index { get; set; } 6 | public string _object { get; set; } 7 | public double[] embedding { get; set; } 8 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaGLM/Models/ResponseModels/ImageGenerationModels/ImageResponseDataItem.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaGLM.Models.ResponseModels.ImageGenerationModels; 2 | 3 | public class ImageResponseDataItem 4 | { 5 | public string url { get; set; } 6 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaGLM/Models/ResponseModels/ResponseChoiceDelta.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaGLM.Models.ResponseModels; 2 | 3 | public class ResponseChoiceDelta 4 | { 5 | public string role { get; set; } 6 | public string content { get; set; } 7 | public ToolCallItem[] tool_calls { get; set; } 8 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaGLM/Models/ResponseModels/ResponseChoiceItem.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaGLM.Models.ResponseModels; 2 | 3 | public class ResponseChoiceItem 4 | { 5 | public string finish_reason { get; set; } 6 | public int index { get; set; } 7 | public ResponseChoiceDelta message { get; set; } 8 | public ResponseChoiceDelta delta { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaGLM/Models/ResponseModels/ToolModels/FunctionDescriptor.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaGLM.Models.ResponseModels.ToolModels; 2 | 3 | public class FunctionDescriptor 4 | { 5 | public string name { get; set; } 6 | public string arguments { get; set; } 7 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaGLM/Models/ResponseModels/ToolModels/ToolCallItem.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaGLM.Models.ResponseModels.ToolModels; 2 | 3 | public class ToolCallItem 4 | { 5 | public string id { get; set; } 6 | public FunctionDescriptor function { get; set; } 7 | public int index { get; set; } 8 | public string type { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/MessagingModels/AttachmentBody.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.MessagingModels; 2 | 3 | public class AttachmentBody 4 | { 5 | [JsonPropertyName("type")] 6 | public string Type { get; set; } = "template"; 7 | public ITemplateMessage Payload { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/MessagingModels/ButtonItem.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.MessagingModels; 2 | 3 | public class ButtonItem 4 | { 5 | public string Type { get; set; } 6 | public string Title { get; set; } 7 | public string Url { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/MessagingModels/SendingMessageResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.MessagingModels; 2 | 3 | public class SendingMessageResponse 4 | { 5 | [JsonPropertyName("recipient_id")] 6 | public string RecipientId { get; set; } 7 | 8 | [JsonPropertyName("message_id")] 9 | public string MessageId { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/Settings/MetaMessengerSetting.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.Settings; 2 | 3 | public class MetaMessengerSetting 4 | { 5 | public string Endpoint { get; set; } 6 | public string ApiVersion { get; set; } 7 | public string PageId { get; set; } 8 | public string PageAccessToken { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/WebhookModels/WebhookMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.WebhookModels; 2 | 3 | public class WebhookMessage 4 | { 5 | public WebhookMessageUser Sender { get; set; } 6 | public WebhookMessageUser Recipient { get; set; } 7 | public WebhookMessageBody Message { get; set; } 8 | public WebhookMessagePostback Postback { get; set; } 9 | public long TimeStamp { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/WebhookModels/WebhookMessagePostback.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.WebhookModels; 2 | 3 | public class WebhookMessagePostback 4 | { 5 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 6 | public string Title { get; set; } 7 | 8 | public string Payload { get; set; } 9 | 10 | [JsonPropertyName("mid")] 11 | public string Id { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/WebhookModels/WebhookMessageUser.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.WebhookModels; 2 | 3 | public class WebhookMessageUser 4 | { 5 | public string Id { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/WebhookModels/WebhookObject.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.WebhookModels; 2 | 3 | public class WebhookObject 4 | { 5 | public string Id { get; set; } 6 | public long Time { get; set; } 7 | public List Messaging { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/WebhookModels/WebhookRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.WebhookModels; 2 | 3 | public class WebhookRequest 4 | { 5 | public string Object { get;set; } 6 | public List Entry { get;set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MetaMessenger/WebhookModels/WebhookResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MetaMessenger.WebhookModels; 2 | 3 | public class WebhookResponse 4 | { 5 | public bool Success { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/Collections/ConversationDialogDocument.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage.Collections; 2 | 3 | public class ConversationDialogDocument : MongoBase 4 | { 5 | public string ConversationId { get; set; } = default!; 6 | public string AgentId { get; set; } = default!; 7 | public string UserId { get; set; } = default!; 8 | public DateTime UpdatedTime { get; set; } 9 | public List Dialogs { get; set; } = []; 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/Collections/ConversationStateLogDocument.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage.Collections; 2 | 3 | public class ConversationStateLogDocument : MongoBase 4 | { 5 | public string ConversationId { get; set; } = default!; 6 | public string AgentId { get; set; } = default!; 7 | public string MessageId { get; set; } = default!; 8 | public Dictionary States { get; set; } = []; 9 | public DateTime CreatedTime { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/Collections/KnowledgeCollectionConfigDocument.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage.Collections; 2 | 3 | public class KnowledgeCollectionConfigDocument : MongoBase 4 | { 5 | public string Name { get; set; } = default!; 6 | public string Type { get; set; } = default!; 7 | public KnowledgeVectorStoreConfigMongoModel VectorStore { get; set; } = new(); 8 | public KnowledgeEmbeddingConfigMongoModel TextEmbedding { get; set; } = new(); 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/Collections/LlmCompletionLogDocument.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage.Collections; 2 | 3 | public class LlmCompletionLogDocument : MongoBase 4 | { 5 | public string ConversationId { get; set; } = default!; 6 | public string MessageId { get; set; } = default!; 7 | public string AgentId { get; set; } = default!; 8 | public string Prompt { get; set; } = default!; 9 | public string? Response { get; set; } 10 | public DateTime CreatedTime { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/Collections/PluginDocument.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage.Collections; 2 | 3 | public class PluginDocument : MongoBase 4 | { 5 | public List EnabledPlugins { get; set; } = []; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/Collections/TranslationMemoryDocument.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage.Collections; 2 | 3 | public class TranslationMemoryDocument : MongoBase 4 | { 5 | public string OriginalText { get; set; } = default!; 6 | public string HashText { get; set; } = default!; 7 | public List Translations { get; set; } = []; 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/Collections/UserAgentDocument.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage.Collections; 2 | 3 | public class UserAgentDocument : MongoBase 4 | { 5 | public string UserId { get; set; } = default!; 6 | public string AgentId { get; set; } = default!; 7 | public IEnumerable Actions { get; set; } = []; 8 | public DateTime CreatedTime { get; set; } 9 | public DateTime UpdatedTime { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/Models/BreakpointMongoElement.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage.Models; 2 | 3 | [BsonIgnoreExtraElements(Inherited = true)] 4 | public class BreakpointMongoElement 5 | { 6 | public string? MessageId { get; set; } 7 | public DateTime Breakpoint { get; set; } 8 | public DateTime CreatedTime { get; set; } 9 | public string? Reason { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/MongoBase.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.MongoStorage; 2 | 3 | [BsonIgnoreExtraElements(Inherited = true)] 4 | public abstract class MongoBase 5 | { 6 | [BsonId(IdGenerator = typeof(StringGuidIdGenerator))] 7 | public string Id { get; set; } = default!; 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.MongoStorage/StringGuidIdGenerator.cs: -------------------------------------------------------------------------------- 1 | using MongoDB.Bson.Serialization; 2 | 3 | namespace BotSharp.Plugin.MongoStorage; 4 | 5 | public class StringGuidIdGenerator : IIdGenerator 6 | { 7 | public object GenerateId(object container, object document) 8 | { 9 | return Guid.NewGuid().ToString(); 10 | } 11 | 12 | public bool IsEmpty(object id) 13 | { 14 | return id == null || string.IsNullOrEmpty(id.ToString()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.OpenAI/Models/Realtime/RealtimeSessionUpdate.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.OpenAI.Models.Realtime; 2 | 3 | public class RealtimeSessionUpdate 4 | { 5 | /// 6 | /// Optional client-generated ID used to identify this event. 7 | /// 8 | public string EventId { get; set; } = null!; 9 | public string Type { get; set; } = "session.update"; 10 | public RealtimeSession Session { get; set; } = null!; 11 | } 12 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.OpenAI/Models/Realtime/ServerEventResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.OpenAI.Models.Realtime; 2 | 3 | public class ServerEventResponse 4 | { 5 | [JsonPropertyName("event_id")] 6 | public string EventId { get; set; } = null!; 7 | 8 | [JsonPropertyName("type")] 9 | public string Type { get; set; } = null!; 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.OpenAI/Models/Realtime/SessionServerEventResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.OpenAI.Models.Realtime; 2 | 3 | public class SessionServerEventResponse : ServerEventResponse 4 | { 5 | [JsonPropertyName("session")] 6 | public RealtimeSessionBody Session { get; set; } = null!; 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.OpenAI/Models/SpeechToTextRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.OpenAI.Models; 2 | 3 | public class SpeechToTextRequest 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.OpenAI/Settings/OpenAiSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.OpenAI.Settings; 2 | 3 | public class OpenAiSettings 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.OsDriver/OsDriverPlugin.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Plugins; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.DependencyInjection; 4 | 5 | namespace BotSharp.Plugin.OsDriver; 6 | 7 | public class OsDriverPlugin : IBotSharpPlugin 8 | { 9 | public string Id => "5aef4940-2f95-464b-ad37-43dbf89febf0"; 10 | 11 | public void RegisterDI(IServiceCollection services, IConfiguration config) 12 | { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.OsDriver/Using.cs: -------------------------------------------------------------------------------- 1 | global using System; 2 | global using System.Collections.Generic; 3 | global using System.IO; 4 | global using System.Threading.Tasks; -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/Enums/PlannerAgentId.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Planner.Enums; 2 | 3 | public class PlannerAgentId 4 | { 5 | public const string TwoStagePlanner = "282a7128-69a1-44b0-878c-a9159b88f3b9"; 6 | public const string SequentialPlanner = "3e75e818-a139-48a8-9e22-4662548c13a3"; 7 | public const string SqlPlanner = "da7aad2c-8112-48a2-ab7b-1f87da524741"; 8 | } 9 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/Enums/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Planner.Enums; 2 | 3 | public class UtilityName 4 | { 5 | public const string TwoStagePlanner = "two-stage-planner"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/SqlGeneration/Models/SqlReviewArgs.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Planner.SqlGeneration.Models; 2 | 3 | public class SqlReviewArgs 4 | { 5 | [JsonPropertyName("is_sql_template")] 6 | public bool IsSqlTemplate { get; set; } = false; 7 | 8 | [JsonPropertyName("contains_sql_statements")] 9 | public bool ContainsSqlStatements { get; set; } = false; 10 | 11 | [JsonPropertyName("sql_statement")] 12 | public string SqlStatement { get; set; } = string.Empty; 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/SqlGeneration/Models/SqlSecondStagePlan.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Planner.SqlGeneration.Models; 2 | 3 | public class SqlSecondStagePlan 4 | { 5 | [JsonPropertyName("related_tables")] 6 | public string[] Tables { get; set; } = []; 7 | 8 | [JsonPropertyName("need_lookup_dictionary")] 9 | public bool NeedLookupDictionary { get; set; } = false; 10 | 11 | [JsonPropertyName("description")] 12 | public string Description { get; set; } = ""; 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/TwoStaging/Models/PrimaryRequirementRequest.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Planner.TwoStaging.Models; 2 | 3 | public class PrimaryRequirementRequest 4 | { 5 | [JsonPropertyName("requirement_detail")] 6 | public string Requirements { get; set; } = null!; 7 | 8 | [JsonPropertyName("questions")] 9 | public string[] Questions { get; set; } = []; 10 | 11 | [JsonPropertyName("norm_questions")] 12 | public string[] NormQuestions { get; set; } = []; 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/TwoStaging/Models/SecondaryBreakdownTask.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Planner.TwoStaging.Models; 2 | 3 | public class SecondaryBreakdownTask 4 | { 5 | [JsonPropertyName("task_description")] 6 | public string TaskDescription { get; set; } = null!; 7 | 8 | [JsonPropertyName("solution_search_question")] 9 | public string SolutionQuestion { get; set; } = null!; 10 | 11 | [JsonPropertyName("need_lookup_dictionary")] 12 | public bool NeedLookupDictionary { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/TwoStaging/Models/SummaryPlan.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Planner.TwoStaging.Models; 2 | 3 | public class SummaryPlan 4 | { 5 | [JsonPropertyName("is_sql_template")] 6 | public bool IsSqlTemplate { get; set; } = false; 7 | 8 | [JsonPropertyName("contains_sql_statements")] 9 | public bool ContainsSqlStatements { get; set; } = false; 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-planner-plan_primary_stage.fn.liquid: -------------------------------------------------------------------------------- 1 | In order to utilize TwoStage Planning approach, please call plan_primary_stage when you need to plan the first stage steps to solve a complex task. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-planner-plan_secondary_stage.fn.liquid: -------------------------------------------------------------------------------- 1 | For every primary step, if need_breakdown_task is true, you have to call plan_secondary_stage to plan the detail steps to complete the primary step. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Planner/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-planner-plan_summary.fn.liquid: -------------------------------------------------------------------------------- 1 | Remove the unnecessary information, and output the final planning steps. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.PythonInterpreter/Enums/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.PythonInterpreter.Enums; 2 | 3 | public class UtilityName 4 | { 5 | public const string PythonInterpreter = "python-interpreter"; 6 | } 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/python_interpreter.fn.liquid: -------------------------------------------------------------------------------- 1 | Write and execute Python script in python_interpreter function, and use python function print(a) to output the result in stand output. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Qdrant/Models/RecoverFromSnapshotResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.Qdrant.Models; 4 | 5 | public class RecoverFromSnapshotResponse 6 | { 7 | [JsonPropertyName("time")] 8 | public decimal Time { get; set; } 9 | 10 | [JsonPropertyName("status")] 11 | public string Status { get; set; } 12 | 13 | [JsonPropertyName("result")] 14 | public bool Result { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Qdrant/QdrantSetting.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Qdrant; 2 | 3 | public class QdrantSetting 4 | { 5 | public string Url { get; set; } 6 | public string ApiKey { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Qdrant/Using.cs: -------------------------------------------------------------------------------- 1 | global using System; 2 | global using System.Collections.Generic; 3 | global using System.Linq; 4 | global using System.Threading.Tasks; 5 | global using BotSharp.Abstraction.VectorStorage; 6 | global using BotSharp.Abstraction.Knowledges.Enums; 7 | global using BotSharp.Abstraction.Knowledges.Models; -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.RoutingSpeeder/Providers/Models/DialoguePredictionModel.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.RoutingSpeeder.Providers.Models; 2 | 3 | public class DialoguePredictionModel 4 | { 5 | public int Id { get; set; } 6 | public string Text { get; set; } = string.Empty; 7 | public string? Label { get; set; } 8 | public string? Prediction { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.RoutingSpeeder/Providers/Models/TrainingParams.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BotSharp.Plugin.RoutingSpeeder.Providers.Models; 6 | 7 | public class TrainingParams 8 | { 9 | public int ClientId { get; set; } 10 | public int Epochs { get; set; } = 10; 11 | public int BatchSize { get; set; } = 16; 12 | public float LearningRate { get; set; } = 1.0e-4f; 13 | public bool Inference { get; set; } = false; 14 | } 15 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.RoutingSpeeder/Settings/routerSpeedSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BotSharp.Plugin.RoutingSpeeder.Settings; 6 | 7 | public class RouterSpeederSettings 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.RoutingSpeeder/data/models/dbpedia.ftz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/src/Plugins/BotSharp.Plugin.RoutingSpeeder/data/models/dbpedia.ftz -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.RoutingSpeeder/data/models/intent-classifier.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/src/Plugins/BotSharp.Plugin.RoutingSpeeder/data/models/intent-classifier.h5 -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.RoutingSpeeder/data/models/label.txt: -------------------------------------------------------------------------------- 1 | goodbye 2 | greeting 3 | other 4 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Selenium/Drivers/SeleniumWebDriver.LaunchBrowser.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Selenium.Drivers; 2 | 3 | public partial class SeleniumWebDriver 4 | { 5 | public async Task LaunchBrowser(MessageInfo message, BrowserActionArgs args) 6 | { 7 | var context = await _instance.InitInstance(message.ContextId); 8 | var result = new BrowserActionResult() 9 | { 10 | IsSuccess = true 11 | }; 12 | return result; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SemanticKernel/readme.md: -------------------------------------------------------------------------------- 1 | # Semantic Kernel For BotSharp 2 | 3 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SparkDesk/Settings/SparkDeskSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.SparkDesk; 2 | 3 | public class SparkDeskSettings 4 | { 5 | public string AppId { get; set; } 6 | 7 | public string ApiKey { get; set; } 8 | 9 | public string ApiSecret { get; set; } 10 | 11 | public ModelVersion ModelVersion { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/Hooks/SqlDriverConversationHook.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace BotSharp.Plugin.SqlDriver.Hooks; 3 | 4 | public class SqlDriverConversationHook : ConversationHookBase, IConversationHook 5 | { 6 | public override Task OnResponseGenerated(RoleDialogModel message) 7 | { 8 | // Render function buttons 9 | 10 | return base.OnResponseGenerated(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/Hooks/SqlDriverKnowledgeHook.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.SqlDriver.Hooks; 2 | 3 | public class SqlDriverKnowledgeHook : IKnowledgeHook 4 | { 5 | public async Task> CollectChunkedKnowledge() 6 | { 7 | return new List(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/Interfaces/ISqlDriverHook.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Hooks; 2 | 3 | namespace BotSharp.Plugin.SqlDriver.Interfaces; 4 | 5 | public interface ISqlDriverHook : IHookBase 6 | { 7 | // Get database type 8 | string GetDatabaseType(RoleDialogModel message); 9 | Task SqlGenerated(RoleDialogModel message); 10 | Task SqlExecuting(RoleDialogModel message); 11 | Task SqlExecuted(RoleDialogModel message); 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/Models/GetTableColumnsArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.SqlDriver.Models; 4 | 5 | public class GetTableColumnsArgs 6 | { 7 | [JsonPropertyName("table")] 8 | public string Table { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/Models/SqlParameter.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.SqlDriver.Models; 4 | 5 | public class SqlParameter 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | 10 | [JsonPropertyName("value")] 11 | public string Value { get; set; } 12 | 13 | public override string ToString() 14 | { 15 | return $"{Name}: {Value}"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/Models/SqlReturn.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.SqlDriver.Models; 4 | 5 | public class SqlReturn 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | 10 | [JsonPropertyName("alias")] 11 | public string Alias { get; set; } 12 | 13 | public string? Value { get; set; } 14 | 15 | public override string ToString() 16 | { 17 | return $"{Alias} - {Name}"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-db-sql_table_definition.fn.liquid: -------------------------------------------------------------------------------- 1 | Call util-db-sql_table_definition to get the table definition of the table. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You're a SQL driver who can execute the sql statement. 2 | 3 | Your response must meet below requirements: 4 | * You can only execute the SQL from the conversation. You can't generate one by yourself; 5 | * The return field alias should be meaningful, you can use the combination of column and value as the alias name; 6 | * Use "Unique Index" to help check record existence; 7 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/templates/database.dictionary.sql.liquid: -------------------------------------------------------------------------------- 1 | You are a sql statement corrector. You will need to refer to the table structure and rewrite the original sql statement so it's using the correct information, e.g. column name. 2 | Output the sql statement only without comments, in JSON format: {{ response_format }} 3 | 4 | ===== 5 | Original Sql: 6 | {{ original_sql }} 7 | 8 | ===== 9 | Table Structure: 10 | {{ table_structure }} 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/templates/query_result_formatting.liquid: -------------------------------------------------------------------------------- 1 | Output in human readable format. If there is large amount of rows, shape it in tabular, otherwise, output in plain text. Keep all the query data results. 2 | Put user task description in the first line in the same language, for example, if user is using Chinese, you have to output the result in Chinese. Otherwise, use English. 3 | 4 | User Task Description: 5 | {{ requirement_detail }} -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.SqlDriver/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/templates/render_buttons.liquid: -------------------------------------------------------------------------------- 1 | Determine whether to render the following button based on the text. 2 | sql_executable: When the text contains an executable sql statement, set it to true 3 | contains_tmp_table: When the text contains a table named tmp, set it to true 4 | is_sql_template 5 | 6 | Output should be json format 7 | { 8 | "sql_executable": false, 9 | "contains_tmp_table": false, 10 | "is_sql_template": false 11 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.TencentCos/Settings/TencentCosSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.TencentCos.Settings 2 | { 3 | public class TencentCosSettings 4 | { 5 | public string AppId { get; set; } 6 | public string SecretId { get; set; } 7 | public string SecretKey { get; set; } 8 | public string Region { get; set; } 9 | public string BucketName { get; set; } 10 | public int KeyDurationSecond { get; set; } = 600; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Twilio/Models/AssistantMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Twilio.Models 2 | { 3 | public class AssistantMessage 4 | { 5 | public bool ConversationEnd { get; set; } 6 | public bool HumanIntervationNeeded { get; set; } 7 | public string Content { get; set; } 8 | public string MessageId { get; set; } 9 | public string? SpeechFileName { get; set; } 10 | public string Hints { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Twilio/Models/Stream/StreamEventDtmfResponse.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Plugin.Twilio.Models.Stream; 2 | using System.Text.Json.Serialization; 3 | 4 | public class StreamEventDtmfResponse : StreamEventResponse 5 | { 6 | [JsonPropertyName("dtmf")] 7 | public StreamEventDtmfBody Body { get; set; } 8 | } 9 | 10 | public class StreamEventDtmfBody 11 | { 12 | [JsonPropertyName("track")] 13 | public string Track { get; set; } 14 | 15 | [JsonPropertyName("digit")] 16 | public string Digit { get; set; } 17 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Enums/UtilityName.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.Twilio.OutboundPhoneCallHandler.Enums 2 | { 3 | public class UtilityName 4 | { 5 | public const string OutboundPhoneCall = "twilio-phone-call"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/LlmContexts/ForwardPhoneCallArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.Twilio.OutboundPhoneCallHandler.LlmContexts; 4 | 5 | public class ForwardPhoneCallArgs 6 | { 7 | [JsonPropertyName("phone_number")] 8 | public string PhoneNumber { get; set; } = null!; 9 | 10 | [JsonPropertyName("transition_message")] 11 | public string TransitionMessage { get; set; } = null!; 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/LlmContexts/HangupPhoneCallArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.Twilio.OutboundPhoneCallHandler.LlmContexts; 4 | 5 | public class HangupPhoneCallArgs 6 | { 7 | [JsonPropertyName("reason")] 8 | public string Reason { get; set; } = null!; 9 | 10 | [JsonPropertyName("response_content")] 11 | public string ResponseContent { get; set; } = null!; 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/LlmContexts/LeaveVoicemailArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.Twilio.OutboundPhoneCallHandler.LlmContexts; 4 | 5 | public class LeaveVoicemailArgs 6 | { 7 | [JsonPropertyName("voicemail_message")] 8 | public string VoicemailMessage { get; set; } = null!; 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/LlmContexts/LlmContextIn.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.Twilio.OutboundPhoneCallHandler.LlmContexts; 4 | 5 | public class LlmContextIn 6 | { 7 | [JsonPropertyName("phone_number")] 8 | public string PhoneNumber { get; set; } = null!; 9 | 10 | [JsonPropertyName("initial_message")] 11 | public string? InitialMessage { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/LlmContexts/LlmContextOut.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace BotSharp.Plugin.Twilio.OutboundPhoneCallHandler.LlmContexts; 4 | 5 | public class LlmContextOut 6 | { 7 | [JsonPropertyName("conversation_id")] 8 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 9 | public string ConversationId { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WeChat/IMessageQueue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | 6 | namespace BotSharp.Plugin.WeChat 7 | { 8 | public interface IMessageQueue 9 | { 10 | Task EnqueueAsync(WeChatMessage message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WeChat/Users/IWeChatAccountUserService.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Users; 2 | using BotSharp.Abstraction.Users.Models; 3 | using System.Threading.Tasks; 4 | 5 | namespace BotSharp.Plugin.WeChat.Users 6 | { 7 | public interface IWeChatAccountUserService 8 | { 9 | Task GetOrCreateWeChatAccountUserAsync(string appId, string openId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WeChat/WeChatMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BotSharp.Plugin.WeChat 6 | { 7 | public class WeChatMessage 8 | { 9 | public string OpenId { get; set; } 10 | public string Type { get; set; } 11 | public string Message { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.CloseBrowser.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.WebDriver.Drivers.PlaywrightDriver; 2 | 3 | public partial class PlaywrightWebDriver 4 | { 5 | public async Task CloseBrowser(string contextId) 6 | { 7 | await _instance.Close(contextId); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.CloseCurrentPage.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.WebDriver.Drivers.PlaywrightDriver; 2 | 3 | public partial class PlaywrightWebDriver 4 | { 5 | public async Task CloseCurrentPage(MessageInfo message) 6 | { 7 | await _instance.CloseCurrentPage(message.ContextId); 8 | var result = new BrowserActionResult 9 | { 10 | IsSuccess = true 11 | }; 12 | 13 | return result; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/Drivers/PlaywrightDriver/PlaywrightWebDriver.EvaluateScript.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.WebDriver.Drivers.PlaywrightDriver; 2 | 3 | public partial class PlaywrightWebDriver 4 | { 5 | public async Task EvaluateScript(string contextId, string script) 6 | { 7 | await _instance.Wait(contextId); 8 | 9 | return await _instance.GetPage(contextId).EvaluateAsync(script); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/Models/MarkupProperties.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.WebDriver.Models; 2 | 3 | internal class MarkupProperties 4 | { 5 | public string? Id { get; set; } 6 | public string? Name { get; set; } 7 | public string? Type { get; set; } 8 | public string? Text { get; set; } 9 | public string? Placeholder { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/Services/WebDriverService.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Plugin.WebDriver.Services; 2 | 3 | public partial class WebDriverService 4 | { 5 | private readonly IServiceProvider _services; 6 | 7 | public WebDriverService(IServiceProvider services) 8 | { 9 | _services = services; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-web-close_browser.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "util-web-close_browser", 3 | "description": "Close browser.", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | }, 8 | "required": [ ] 9 | } 10 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-web-action_on_element.fn.liquid: -------------------------------------------------------------------------------- 1 | When user asks to do specific actions (click, fill content, scroll) on a web page, use tool of util-web-action_on_element. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-web-go_to_page.fn.liquid: -------------------------------------------------------------------------------- 1 | When user asks to open a web page, use tool of util-web-go_to_page. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions/click_button.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "click_button", 3 | "description": "Click a button in a web page.", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "element_name": { 8 | "type": "string", 9 | "description": "the html element name." 10 | } 11 | }, 12 | "required": [ "element_name" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions/close_browser.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "close_browser", 3 | "description": "Close browser", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | }, 8 | "required": [] 9 | } 10 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions/extract_data_from_page.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "extract_data_from_page", 3 | "description": "Extract data from current web page.", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "question": { 8 | "type": "string", 9 | "description": "the information user wants to know" 10 | } 11 | }, 12 | "required": [ "question" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions/go_to_page.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "go_to_page", 3 | "description": "go to another page", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "url": { 8 | "type": "string", 9 | "description": "page url start with https://" 10 | } 11 | }, 12 | "required": [ "url" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions/input_user_password.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "input_user_password", 3 | "description": "Input password in current web page", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "password": { 8 | "type": "string", 9 | "description": "user password" 10 | } 11 | }, 12 | "required": [ "password" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions/open_browser.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "open_browser", 3 | "description": "open a browser", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "url": { 8 | "type": "string", 9 | "description": "website url starts with https://" 10 | } 11 | }, 12 | "required": [ "url" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions/scroll_page.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scroll_page", 3 | "description": "Scroll page down or up", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "direction": { 8 | "type": "string", 9 | "description": "down, up, left, right" 10 | } 11 | }, 12 | "required": [ "direction" ] 13 | } 14 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions/take_screenshot.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "take_screenshot", 3 | "description": "Tak screenshot to show current page screen", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | }, 8 | "required": [] 9 | } 10 | } -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are a Web Driver that can manipulate web elements through automation tools. 2 | 3 | Follow below steps to response: 4 | 1. Analyze user's request. 5 | 2. Call appropriate function to execute the instruction. 6 | 3. If user requests execute multiple steps, execute them sequentially. 7 | 8 | Additional response requirements: 9 | * Call function input_user_password if user wants to input password. -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/templates/extract_data.liquid: -------------------------------------------------------------------------------- 1 | {{ content }} 2 | 3 | === According to above text === 4 | Find the answer of "{{ question }}" -------------------------------------------------------------------------------- /src/Plugins/BotSharp.Plugin.WebDriver/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/templates/html_parser.liquid: -------------------------------------------------------------------------------- 1 | {{ html_content }} 2 | 3 | === According to above HTML === 4 | Find the html element in the similar meaning of "{{ element_name }}". 5 | Output in JSON format {"tag_name": "", "element_id": "the id attribute", "element_name", "the name attribute", "index": -1}. 6 | The index is the position of the element which starts with 0. -------------------------------------------------------------------------------- /src/WebStarter/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/WebStarter/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/src/WebStarter/wwwroot/favicon.ico -------------------------------------------------------------------------------- /tests/BotSharp.LLM.Tests/TestBase.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.Abstraction.Agents.Models; 2 | using BotSharp.Abstraction.MLTasks; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | 6 | namespace BotSharp.Plugin.Google.Core 7 | { 8 | public abstract class TestBase 9 | { 10 | 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /tests/BotSharp.LLM.Tests/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/BotSharp.PizzaBot.MCPServer/Program.cs: -------------------------------------------------------------------------------- 1 | var builder = WebApplication.CreateBuilder(args); 2 | builder.Services.AddMcpServer() 3 | .WithToolsFromAssembly(); 4 | var app = builder.Build(); 5 | 6 | app.MapGet("/", () => "This is a test server with only stub functionality!"); 7 | app.MapMcp(); 8 | 9 | app.Run(); -------------------------------------------------------------------------------- /tests/BotSharp.PizzaBot.MCPServer/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "BotSharp.PizzaBot.MCPServer": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | }, 9 | "applicationUrl": "https://localhost:58904;http://localhost:58905" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/agent.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Order Inquiry", 3 | "description": "Check the existing order status like payment, delivery or baking.", 4 | "createdDateTime": "2023-08-18T14:39:32.2349685Z", 5 | "updatedDateTime": "2023-08-18T14:39:32.2349686Z", 6 | "id": "b284db86-e9c2-4c25-a59e-4649797dd130", 7 | "disabled": false, 8 | "isPublic": true, 9 | "profiles": [ "pizza" ], 10 | "labels": [ "experiment" ] 11 | } -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/functions/get_order_status.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get_order_status", 3 | "description": "get order status like delivery remaining time", 4 | "parameters": { 5 | "type": "object", 6 | "properties": { 7 | "order_number": { 8 | "type": "string", 9 | "description": "order number, value must be provided by user." 10 | } 11 | }, 12 | "required": [ "order_number" ] 13 | } 14 | } -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You're a Order Inquiry agent to tell user current status of the specific order. 2 | 3 | You can also access below available information related to current order to answer user's questions: 4 | * Today is {{current_date}}, the time now is {{current_time}}, today is {{current_weekday}}. 5 | {% if phone_num %}* Phone number is: {{phone_num}}.{% endif %} 6 | {% if order_number %}* order number is: {{order_number}}.{% endif %} 7 | -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/functions/get_pizza_types.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get_pizza_types", 3 | "description": "get all pizza types", 4 | "parameters": { 5 | "type": "object", 6 | "properties": {}, 7 | "required": [] 8 | } 9 | } -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/instructions/instruction.liquid: -------------------------------------------------------------------------------- 1 | You are now a Casher, handle order payment. -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/users/10d12798-08fb-4aa6-977b-5dd94d82dbfe/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "userName": "guest", 3 | "firstName": "Guest", 4 | "lastName": "Anonymous", 5 | "email": "guest@gmail.com", 6 | "salt": "55f8fafcf829479ca97e635937440fee", 7 | "password": "3b459ae9988628d41f0362c499a768dd", 8 | "role": "client", 9 | "updatedTime": "2023-11-13T18:00:00Z", 10 | "createdTime": "2023-11-13T18:00:00Z", 11 | "id": "10d12798-08fb-4aa6-977b-5dd94d82dbfe" 12 | } -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/users/456e35c5-caf0-4d45-9084-b44a8ca717e4/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "userName": "admin", 3 | "firstName": "Administrator", 4 | "lastName": "", 5 | "email": "admin@gmail.com", 6 | "salt": "55f8fafcf829479ca97e635937440fee", 7 | "password": "3b459ae9988628d41f0362c499a768dd", 8 | "role": "admin", 9 | "updatedTime": "2023-08-14T18:14:03.4602072Z", 10 | "createdTime": "2023-08-14T18:14:03.4602075Z", 11 | "id": "456e35c5-caf0-4d45-9084-b44a8ca717e4" 12 | } -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/users/d0e6680d-03d5-4ed8-bdcd-aa7d86f2a1bc/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "userName": "nancy", 3 | "firstName": "Nancy", 4 | "lastName": "Luna", 5 | "email": "user1@gmail.com", 6 | "salt": "55f8fafcf829479ca97e635937440fee", 7 | "password": "3b459ae9988628d41f0362c499a768dd", 8 | "role": "client", 9 | "updatedTime": "2023-11-13T18:00:00Z", 10 | "createdTime": "2023-11-13T18:00:00Z", 11 | "id": "d0e6680d-03d5-4ed8-bdcd-aa7d86f2a1bc" 12 | } -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/data/users/e465af5f-044f-414b-b670-92834929b96c/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "userName": "elon", 3 | "firstName": "Elon", 4 | "lastName": "Musk", 5 | "email": "csr1@gmail.com", 6 | "salt": "55f8fafcf829479ca97e635937440fee", 7 | "password": "3b459ae9988628d41f0362c499a768dd", 8 | "role": "csr", 9 | "updatedTime": "2023-11-13T18:00:00Z", 10 | "createdTime": "2023-11-13T18:00:00Z", 11 | "id": "e465af5f-044f-414b-b670-92834929b96c" 12 | } -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/documents/RDD-ChicagoThinCrust.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/tests/BotSharp.Plugin.PizzaBot/documents/RDD-ChicagoThinCrust.pdf -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.PizzaBot/documents/pizza-recipebooklet-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SciSharp/BotSharp/73934bf2b318dfd6a310557015c4f082ffe0fb6b/tests/BotSharp.Plugin.PizzaBot/documents/pizza-recipebooklet-1.pdf -------------------------------------------------------------------------------- /tests/BotSharp.Plugin.SemanticKernel.UnitTests/Usings.cs: -------------------------------------------------------------------------------- 1 | global using System; 2 | global using System.Collections.Generic; 3 | global using System.Threading.Tasks; 4 | global using System.Linq; 5 | global using System.Runtime; 6 | global using BotSharp.Abstraction.Models; 7 | global using Xunit; -------------------------------------------------------------------------------- /tests/BotSharp.Test.BrowserUse/BotSharp.Test.BrowserUse.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/BotSharp.Test.BrowserUse/Program.cs: -------------------------------------------------------------------------------- 1 | // See https://aka.ms/new-console-template for more information 2 | Console.WriteLine("Hello, World!"); 3 | -------------------------------------------------------------------------------- /tests/BotSharp.Test.RealtimeVoice/Enums/SessionMode.cs: -------------------------------------------------------------------------------- 1 | namespace BotSharp.Test.RealtimeVoice.Enums; 2 | 3 | internal enum SessionMode 4 | { 5 | StreamChannel = 1, 6 | CustomStream = 2 7 | } 8 | -------------------------------------------------------------------------------- /tests/BotSharp.Test.RealtimeVoice/Program.cs: -------------------------------------------------------------------------------- 1 | using BotSharp.OpenAPI; 2 | using System.Reflection; 3 | 4 | var services = ServiceBuilder.CreateHostBuilder(Assembly.GetExecutingAssembly()); 5 | 6 | var agentId = BuiltInAgentId.Chatbot; 7 | var session = ConsoleChatSession.Init(services); 8 | await session.StartAsync(agentId, SessionMode.StreamChannel); -------------------------------------------------------------------------------- /tests/UnitTest/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.VisualStudio.TestTools.UnitTesting; --------------------------------------------------------------------------------