diff --git a/BotSharp.sln b/BotSharp.sln index b04cd1c7..804e4092 100644 --- a/BotSharp.sln +++ b/BotSharp.sln @@ -83,7 +83,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.SqlDriver", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.Dashboard", "src\Plugins\BotSharp.Plugin.Dashboard\BotSharp.Plugin.Dashboard.csproj", "{267998C1-55C2-4ADC-8361-2CDFA5EA6D6C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Plugin.SparkDesk", "src\Plugins\BotSharp.Plugin.SparkDesk\BotSharp.Plugin.SparkDesk.csproj", "{289E25C8-63F1-4D52-9909-207724DB40CB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.SparkDesk", "src\Plugins\BotSharp.Plugin.SparkDesk\BotSharp.Plugin.SparkDesk.csproj", "{289E25C8-63F1-4D52-9909-207724DB40CB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.AnthropicAI", "src\Plugins\BotSharp.Plugin.AnthropicAI\BotSharp.Plugin.AnthropicAI.csproj", "{806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -333,6 +335,14 @@ Global {289E25C8-63F1-4D52-9909-207724DB40CB}.Release|Any CPU.Build.0 = Release|Any CPU {289E25C8-63F1-4D52-9909-207724DB40CB}.Release|x64.ActiveCfg = Release|Any CPU {289E25C8-63F1-4D52-9909-207724DB40CB}.Release|x64.Build.0 = Release|Any CPU + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}.Debug|x64.ActiveCfg = Debug|Any CPU + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}.Debug|x64.Build.0 = Debug|Any CPU + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}.Release|Any CPU.Build.0 = Release|Any CPU + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}.Release|x64.ActiveCfg = Release|Any CPU + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -375,6 +385,7 @@ Global {D775DB67-A4B4-44E5-9144-522689590057} = {51AFE054-AE99-497D-A593-69BAEFB5106F} {267998C1-55C2-4ADC-8361-2CDFA5EA6D6C} = {51AFE054-AE99-497D-A593-69BAEFB5106F} {289E25C8-63F1-4D52-9909-207724DB40CB} = {D5293208-2BEF-42FC-A64C-5954F61720BA} + {806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C} = {D5293208-2BEF-42FC-A64C-5954F61720BA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A9969D89-C98B-40A5-A12B-FC87E55B3A19} diff --git a/src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Template/ButtonTemplateMessage.cs b/src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Template/ButtonTemplateMessage.cs index 647ebc98..bdc742ce 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Template/ButtonTemplateMessage.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Template/ButtonTemplateMessage.cs @@ -1,4 +1,3 @@ -using BotSharp.Abstraction.Messaging.Enums; using Newtonsoft.Json; namespace BotSharp.Abstraction.Messaging.Models.RichContent.Template; diff --git a/src/Infrastructure/BotSharp.Abstraction/Using.cs b/src/Infrastructure/BotSharp.Abstraction/Using.cs index 91f672b8..6668aec6 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Using.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Using.cs @@ -14,4 +14,5 @@ global using BotSharp.Abstraction.Models; global using BotSharp.Abstraction.Routing.Models; global using BotSharp.Abstraction.Routing.Planning; global using BotSharp.Abstraction.Templating; -global using BotSharp.Abstraction.Translation.Attributes; \ No newline at end of file +global using BotSharp.Abstraction.Translation.Attributes; +global using BotSharp.Abstraction.Messaging.Enums; diff --git a/src/Infrastructure/BotSharp.Core/Using.cs b/src/Infrastructure/BotSharp.Core/Using.cs index 769f318f..453fc896 100644 --- a/src/Infrastructure/BotSharp.Core/Using.cs +++ b/src/Infrastructure/BotSharp.Core/Using.cs @@ -23,6 +23,8 @@ global using BotSharp.Abstraction.Functions.Models; global using BotSharp.Abstraction.Repositories; global using BotSharp.Abstraction.Repositories.Filters; global using BotSharp.Abstraction.Translation; +global using BotSharp.Abstraction.Translation.Attributes; +global using BotSharp.Abstraction.Messaging.Enums; global using BotSharp.Core.Repository; global using BotSharp.Core.Routing; global using BotSharp.Core.Agents.Services; diff --git a/src/Plugins/BotSharp.Plugin.AnthropicAI/AnthropicPlugin.cs b/src/Plugins/BotSharp.Plugin.AnthropicAI/AnthropicPlugin.cs index 4da20e73..701d7416 100644 --- a/src/Plugins/BotSharp.Plugin.AnthropicAI/AnthropicPlugin.cs +++ b/src/Plugins/BotSharp.Plugin.AnthropicAI/AnthropicPlugin.cs @@ -1,9 +1,6 @@ -using BotSharp.Abstraction.MLTasks; using BotSharp.Abstraction.Plugins; using BotSharp.Plugin.AnthropicAI.Providers; -using BotSharp.Plugin.AnthropicAI.Settings; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; namespace BotSharp.Plugin.AnthropicAI; @@ -14,7 +11,7 @@ public class AnthropicPlugin : IBotSharpPlugin public void RegisterDI(IServiceCollection services, IConfiguration config) { var settings = new AnthropicSettings(); - config.Bind("Anthropic", settings); + config.Bind("AnthropicAi", settings); services.AddSingleton(x => { // Console.WriteLine($"Loaded Anthropic settings: {settings.Claude.ApiKey.SubstringMax(4)}"); diff --git a/src/Plugins/BotSharp.Plugin.AnthropicAI/Providers/ChatCompletionProvider.cs b/src/Plugins/BotSharp.Plugin.AnthropicAI/Providers/ChatCompletionProvider.cs index 87a22ee8..aaebfc33 100644 --- a/src/Plugins/BotSharp.Plugin.AnthropicAI/Providers/ChatCompletionProvider.cs +++ b/src/Plugins/BotSharp.Plugin.AnthropicAI/Providers/ChatCompletionProvider.cs @@ -1,4 +1,5 @@ using Anthropic.SDK.Common; +using BotSharp.Abstraction.MLTasks.Settings; using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; @@ -38,7 +39,7 @@ public class ChatCompletionProvider : IChatCompletion var settings = settingsService.GetSetting("anthropic", agent.LlmConfig?.Model ?? "claude-3-haiku"); var client = new AnthropicClient(new APIAuthentication(settings.ApiKey)); - var (prompt, parameters) = PrepareOptions(agent, conversations); + var (prompt, parameters) = PrepareOptions(agent, conversations, settings); var response = await client.Messages.GetClaudeMessageAsync(parameters); @@ -93,7 +94,7 @@ public class ChatCompletionProvider : IChatCompletion throw new NotImplementedException(); } - private (string, MessageParameters) PrepareOptions(Agent agent, List conversations) + private (string, MessageParameters) PrepareOptions(Agent agent, List conversations, LlmModelSetting settings) { var instruction = ""; @@ -163,7 +164,7 @@ public class ChatCompletionProvider : IChatCompletion { Messages = messages, MaxTokens = 256, - Model = AnthropicModels.Claude3Haiku, + Model = settings.Version, // AnthropicModels.Claude3Haiku Stream = false, Temperature = 0m, SystemMessage = instruction, diff --git a/src/Plugins/BotSharp.Plugin.LLamaSharp/BotSharp.Plugin.LLamaSharp.csproj b/src/Plugins/BotSharp.Plugin.LLamaSharp/BotSharp.Plugin.LLamaSharp.csproj index 5bdf5944..cb9087e9 100644 --- a/src/Plugins/BotSharp.Plugin.LLamaSharp/BotSharp.Plugin.LLamaSharp.csproj +++ b/src/Plugins/BotSharp.Plugin.LLamaSharp/BotSharp.Plugin.LLamaSharp.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Plugins/BotSharp.Plugin.LLamaSharp/Providers/TextEmbeddingProvider.cs b/src/Plugins/BotSharp.Plugin.LLamaSharp/Providers/TextEmbeddingProvider.cs index 12006342..9a562000 100644 --- a/src/Plugins/BotSharp.Plugin.LLamaSharp/Providers/TextEmbeddingProvider.cs +++ b/src/Plugins/BotSharp.Plugin.LLamaSharp/Providers/TextEmbeddingProvider.cs @@ -27,7 +27,7 @@ public class TextEmbeddingProvider : ITextEmbedding _embedder = new LLamaEmbedder(weights, @params); } - return Task.FromResult(_embedder.GetEmbeddings(text)); + return _embedder.GetEmbeddings(text); } public Task> GetVectorsAsync(List texts) diff --git a/src/WebStarter/WebStarter.csproj b/src/WebStarter/WebStarter.csproj index 913bd83c..ad08c13c 100644 --- a/src/WebStarter/WebStarter.csproj +++ b/src/WebStarter/WebStarter.csproj @@ -27,17 +27,18 @@ - - + + + diff --git a/src/WebStarter/appsettings.json b/src/WebStarter/appsettings.json index 1abd6ce3..c6555f32 100644 --- a/src/WebStarter/appsettings.json +++ b/src/WebStarter/appsettings.json @@ -152,6 +152,12 @@ "AzureOpenAi": { }, + "AnthropicAi": { + "Claude": { + + } + }, + "GoogleAi": { "PaLM": { "Endpoint": "https://generativelanguage.googleapis.com", @@ -245,6 +251,7 @@ "BotSharp.Plugin.MongoStorage", "BotSharp.Plugin.Dashboard", "BotSharp.Plugin.AzureOpenAI", + "BotSharp.Plugin.AnthropicAI", "BotSharp.Plugin.GoogleAI", "BotSharp.Plugin.MetaAI", "BotSharp.Plugin.MetaMessenger",