Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.23.0" />
<PackageVersion Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.23.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.10.1" />
<PackageVersion Include="Anthropic" Version="12.53.0" />
<PackageVersion Include="Anthropic" Version="13.4.0" />
<PackageVersion Include="Microsoft.Extensions.AI" Version="10.10.0" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="10.10.1" />
<PackageVersion Include="ModelContextProtocol" Version="1.2.0" />
Expand Down
3 changes: 1 addition & 2 deletions src/SharpClaw.Code.Providers/AnthropicProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ internal static MessageCreateParams CreateMessageParameters(ProviderRequest requ
Model = modelId,
Messages =
[
new MessageParam
new UserMessageParam
{
Role = Role.User,
Content = request.Prompt,
},
],
Expand Down
12 changes: 3 additions & 9 deletions src/SharpClaw.Code.Providers/Internal/AnthropicMessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public static ToolUnion[] BuildTools(IReadOnlyList<ProviderToolDefinition> tools

private static MessageParam BuildMessageParam(ChatMessage message)
{
var role = message.Role.Equals("assistant", StringComparison.OrdinalIgnoreCase)
? Role.Assistant
: Role.User;

var contentBlocks = new List<ContentBlockParam>(message.Content.Count);
foreach (var block in message.Content)
{
Expand All @@ -53,11 +49,9 @@ private static MessageParam BuildMessageParam(ChatMessage message)
}
}

return new MessageParam
{
Role = role,
Content = contentBlocks,
};
return message.Role.Equals("assistant", StringComparison.OrdinalIgnoreCase)
? new AssistantMessageParam { Content = contentBlocks }
: new UserMessageParam { Content = contentBlocks };
}

private static ContentBlockParam? BuildContentBlockParam(Protocol.Models.ContentBlock block)
Expand Down
Loading