diff --git a/src/Plugins/BotSharp.Plugin.AnthropicAI/BotSharp.Plugin.AnthropicAI.csproj b/src/Plugins/BotSharp.Plugin.AnthropicAI/BotSharp.Plugin.AnthropicAI.csproj index 5574afe56..c5bd88d04 100644 --- a/src/Plugins/BotSharp.Plugin.AnthropicAI/BotSharp.Plugin.AnthropicAI.csproj +++ b/src/Plugins/BotSharp.Plugin.AnthropicAI/BotSharp.Plugin.AnthropicAI.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Plugins/BotSharp.Plugin.AnthropicAI/Providers/ChatCompletionProvider.cs b/src/Plugins/BotSharp.Plugin.AnthropicAI/Providers/ChatCompletionProvider.cs index dc9df32ae..047cc2469 100644 --- a/src/Plugins/BotSharp.Plugin.AnthropicAI/Providers/ChatCompletionProvider.cs +++ b/src/Plugins/BotSharp.Plugin.AnthropicAI/Providers/ChatCompletionProvider.cs @@ -179,8 +179,15 @@ public Task GetChatCompletionsStreamingAsync(Agent agent, List() { } + Tools = new List() + }; + + if (!string.IsNullOrEmpty(instruction)) + { + parameters.System = new List() + { + new SystemMessage(instruction) + }; }; JsonSerializerOptions jsonSerializationOptions = new() @@ -221,7 +228,7 @@ public Task GetChatCompletionsStreamingAsync(Agent agent, List x.Text))}\r\n"; prompt += "\r\n[CONVERSATION]"; var verbose = string.Join("\r\n", parameters.Messages @@ -264,7 +271,7 @@ private string GetPrompt(MessageParameters parameters) { var functions = string.Join("\r\n", parameters.Tools.Select(x => { - return $"\r\n{x.Name}: {x.Description}\r\n{JsonSerializer.Serialize(x.Parameters)}"; + return $"\r\n{x.Function.Name}: {x.Function.Description}\r\n{JsonSerializer.Serialize(x.Function.Parameters)}"; })); prompt += $"\r\n[FUNCTIONS]\r\n{functions}\r\n"; }