Fix compile error.
This commit is contained in:
parent
d0144a686e
commit
6ad8a3e076
13
BotSharp.sln
13
BotSharp.sln
|
|
@ -83,7 +83,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.SqlDriver",
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.Dashboard", "src\Plugins\BotSharp.Plugin.Dashboard\BotSharp.Plugin.Dashboard.csproj", "{267998C1-55C2-4ADC-8361-2CDFA5EA6D6C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.Dashboard", "src\Plugins\BotSharp.Plugin.Dashboard\BotSharp.Plugin.Dashboard.csproj", "{267998C1-55C2-4ADC-8361-2CDFA5EA6D6C}"
|
||||||
EndProject
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
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|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.ActiveCfg = Release|Any CPU
|
||||||
{289E25C8-63F1-4D52-9909-207724DB40CB}.Release|x64.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -375,6 +385,7 @@ Global
|
||||||
{D775DB67-A4B4-44E5-9144-522689590057} = {51AFE054-AE99-497D-A593-69BAEFB5106F}
|
{D775DB67-A4B4-44E5-9144-522689590057} = {51AFE054-AE99-497D-A593-69BAEFB5106F}
|
||||||
{267998C1-55C2-4ADC-8361-2CDFA5EA6D6C} = {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}
|
{289E25C8-63F1-4D52-9909-207724DB40CB} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
|
||||||
|
{806A0B0E-FEFF-420E-B5B2-C9FCBF890A8C} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {A9969D89-C98B-40A5-A12B-FC87E55B3A19}
|
SolutionGuid = {A9969D89-C98B-40A5-A12B-FC87E55B3A19}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using BotSharp.Abstraction.Messaging.Enums;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace BotSharp.Abstraction.Messaging.Models.RichContent.Template;
|
namespace BotSharp.Abstraction.Messaging.Models.RichContent.Template;
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,5 @@ global using BotSharp.Abstraction.Models;
|
||||||
global using BotSharp.Abstraction.Routing.Models;
|
global using BotSharp.Abstraction.Routing.Models;
|
||||||
global using BotSharp.Abstraction.Routing.Planning;
|
global using BotSharp.Abstraction.Routing.Planning;
|
||||||
global using BotSharp.Abstraction.Templating;
|
global using BotSharp.Abstraction.Templating;
|
||||||
global using BotSharp.Abstraction.Translation.Attributes;
|
global using BotSharp.Abstraction.Translation.Attributes;
|
||||||
|
global using BotSharp.Abstraction.Messaging.Enums;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ global using BotSharp.Abstraction.Functions.Models;
|
||||||
global using BotSharp.Abstraction.Repositories;
|
global using BotSharp.Abstraction.Repositories;
|
||||||
global using BotSharp.Abstraction.Repositories.Filters;
|
global using BotSharp.Abstraction.Repositories.Filters;
|
||||||
global using BotSharp.Abstraction.Translation;
|
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.Repository;
|
||||||
global using BotSharp.Core.Routing;
|
global using BotSharp.Core.Routing;
|
||||||
global using BotSharp.Core.Agents.Services;
|
global using BotSharp.Core.Agents.Services;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
using BotSharp.Abstraction.MLTasks;
|
|
||||||
using BotSharp.Abstraction.Plugins;
|
using BotSharp.Abstraction.Plugins;
|
||||||
using BotSharp.Plugin.AnthropicAI.Providers;
|
using BotSharp.Plugin.AnthropicAI.Providers;
|
||||||
using BotSharp.Plugin.AnthropicAI.Settings;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace BotSharp.Plugin.AnthropicAI;
|
namespace BotSharp.Plugin.AnthropicAI;
|
||||||
|
|
||||||
|
|
@ -14,7 +11,7 @@ public class AnthropicPlugin : IBotSharpPlugin
|
||||||
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
||||||
{
|
{
|
||||||
var settings = new AnthropicSettings();
|
var settings = new AnthropicSettings();
|
||||||
config.Bind("Anthropic", settings);
|
config.Bind("AnthropicAi", settings);
|
||||||
services.AddSingleton(x =>
|
services.AddSingleton(x =>
|
||||||
{
|
{
|
||||||
// Console.WriteLine($"Loaded Anthropic settings: {settings.Claude.ApiKey.SubstringMax(4)}");
|
// Console.WriteLine($"Loaded Anthropic settings: {settings.Claude.ApiKey.SubstringMax(4)}");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Anthropic.SDK.Common;
|
using Anthropic.SDK.Common;
|
||||||
|
using BotSharp.Abstraction.MLTasks.Settings;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using System.Text.Json.Serialization;
|
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 settings = settingsService.GetSetting("anthropic", agent.LlmConfig?.Model ?? "claude-3-haiku");
|
||||||
|
|
||||||
var client = new AnthropicClient(new APIAuthentication(settings.ApiKey));
|
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);
|
var response = await client.Messages.GetClaudeMessageAsync(parameters);
|
||||||
|
|
||||||
|
|
@ -93,7 +94,7 @@ public class ChatCompletionProvider : IChatCompletion
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private (string, MessageParameters) PrepareOptions(Agent agent, List<RoleDialogModel> conversations)
|
private (string, MessageParameters) PrepareOptions(Agent agent, List<RoleDialogModel> conversations, LlmModelSetting settings)
|
||||||
{
|
{
|
||||||
var instruction = "";
|
var instruction = "";
|
||||||
|
|
||||||
|
|
@ -163,7 +164,7 @@ public class ChatCompletionProvider : IChatCompletion
|
||||||
{
|
{
|
||||||
Messages = messages,
|
Messages = messages,
|
||||||
MaxTokens = 256,
|
MaxTokens = 256,
|
||||||
Model = AnthropicModels.Claude3Haiku,
|
Model = settings.Version, // AnthropicModels.Claude3Haiku
|
||||||
Stream = false,
|
Stream = false,
|
||||||
Temperature = 0m,
|
Temperature = 0m,
|
||||||
SystemMessage = instruction,
|
SystemMessage = instruction,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="LLamaSharp" Version="0.9.1" />
|
<PackageReference Include="LLamaSharp" Version="0.11.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class TextEmbeddingProvider : ITextEmbedding
|
||||||
_embedder = new LLamaEmbedder(weights, @params);
|
_embedder = new LLamaEmbedder(weights, @params);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult(_embedder.GetEmbeddings(text));
|
return _embedder.GetEmbeddings(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<float[]>> GetVectorsAsync(List<string> texts)
|
public Task<List<float[]>> GetVectorsAsync(List<string> texts)
|
||||||
|
|
|
||||||
|
|
@ -27,17 +27,18 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\tests\BotSharp.Plugin.PizzaBot\BotSharp.Plugin.PizzaBot.csproj" />
|
<ProjectReference Include="..\..\tests\BotSharp.Plugin.PizzaBot\BotSharp.Plugin.PizzaBot.csproj" />
|
||||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.Dashboard\BotSharp.Plugin.Dashboard.csproj" />
|
|
||||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.SparkDesk\BotSharp.Plugin.SparkDesk.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="$(SolutionName)==BotSharp">
|
<ItemGroup Condition="$(SolutionName)==BotSharp">
|
||||||
<ProjectReference Include="..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
|
<ProjectReference Include="..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
|
||||||
<ProjectReference Include="..\Infrastructure\BotSharp.Logger\BotSharp.Logger.csproj" />
|
<ProjectReference Include="..\Infrastructure\BotSharp.Logger\BotSharp.Logger.csproj" />
|
||||||
<ProjectReference Include="..\Infrastructure\BotSharp.OpenAPI\BotSharp.OpenAPI.csproj" />
|
<ProjectReference Include="..\Infrastructure\BotSharp.OpenAPI\BotSharp.OpenAPI.csproj" />
|
||||||
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.Dashboard\BotSharp.Plugin.Dashboard.csproj" />
|
||||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.GoogleAI\BotSharp.Plugin.GoogleAI.csproj" />
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.GoogleAI\BotSharp.Plugin.GoogleAI.csproj" />
|
||||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.MongoStorage\BotSharp.Plugin.MongoStorage.csproj" />
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.MongoStorage\BotSharp.Plugin.MongoStorage.csproj" />
|
||||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.AzureOpenAI\BotSharp.Plugin.AzureOpenAI.csproj" />
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.AzureOpenAI\BotSharp.Plugin.AzureOpenAI.csproj" />
|
||||||
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.SparkDesk\BotSharp.Plugin.SparkDesk.csproj" />
|
||||||
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.AnthropicAI\BotSharp.Plugin.AnthropicAI.csproj" />
|
||||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.ChatbotUI\BotSharp.Plugin.ChatbotUI.csproj" />
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.ChatbotUI\BotSharp.Plugin.ChatbotUI.csproj" />
|
||||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.HuggingFace\BotSharp.Plugin.HuggingFace.csproj" />
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.HuggingFace\BotSharp.Plugin.HuggingFace.csproj" />
|
||||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.KnowledgeBase\BotSharp.Plugin.KnowledgeBase.csproj" />
|
<ProjectReference Include="..\Plugins\BotSharp.Plugin.KnowledgeBase\BotSharp.Plugin.KnowledgeBase.csproj" />
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,12 @@
|
||||||
"AzureOpenAi": {
|
"AzureOpenAi": {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"AnthropicAi": {
|
||||||
|
"Claude": {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"GoogleAi": {
|
"GoogleAi": {
|
||||||
"PaLM": {
|
"PaLM": {
|
||||||
"Endpoint": "https://generativelanguage.googleapis.com",
|
"Endpoint": "https://generativelanguage.googleapis.com",
|
||||||
|
|
@ -245,6 +251,7 @@
|
||||||
"BotSharp.Plugin.MongoStorage",
|
"BotSharp.Plugin.MongoStorage",
|
||||||
"BotSharp.Plugin.Dashboard",
|
"BotSharp.Plugin.Dashboard",
|
||||||
"BotSharp.Plugin.AzureOpenAI",
|
"BotSharp.Plugin.AzureOpenAI",
|
||||||
|
"BotSharp.Plugin.AnthropicAI",
|
||||||
"BotSharp.Plugin.GoogleAI",
|
"BotSharp.Plugin.GoogleAI",
|
||||||
"BotSharp.Plugin.MetaAI",
|
"BotSharp.Plugin.MetaAI",
|
||||||
"BotSharp.Plugin.MetaMessenger",
|
"BotSharp.Plugin.MetaMessenger",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue