Migrate from Anthropic.SDK to official Anthropic package (#1083)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This commit is contained in:
parent
20d726bfdf
commit
f9239b0fb7
4 changed files with 5 additions and 6 deletions
|
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
<!-- Testing dependencies -->
|
<!-- Testing dependencies -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="Anthropic.SDK" Version="5.8.0" />
|
<PackageVersion Include="Anthropic" Version="11.0.0" />
|
||||||
<PackageVersion Include="coverlet.collector" Version="6.0.4">
|
<PackageVersion Include="coverlet.collector" Version="6.0.4">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.AI" />
|
<PackageReference Include="Microsoft.Extensions.AI" />
|
||||||
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
|
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
|
||||||
<PackageReference Include="Anthropic.SDK" />
|
|
||||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
|
||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Anthropic.SDK;
|
using Anthropic;
|
||||||
using Microsoft.Extensions.AI;
|
using Microsoft.Extensions.AI;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
@ -41,8 +41,8 @@ foreach (var tool in tools)
|
||||||
Console.WriteLine($"Connected to server with tools: {tool.Name}");
|
Console.WriteLine($"Connected to server with tools: {tool.Name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
using var anthropicClient = new AnthropicClient(new APIAuthentication(builder.Configuration["ANTHROPIC_API_KEY"]))
|
using var anthropicClient = new AnthropicClient(new() { APIKey = builder.Configuration["ANTHROPIC_API_KEY"] })
|
||||||
.Messages
|
.AsIChatClient("claude-haiku-4-5-20251001")
|
||||||
.AsBuilder()
|
.AsBuilder()
|
||||||
.UseFunctionInvocation()
|
.UseFunctionInvocation()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Anthropic.SDK" />
|
<PackageReference Include="Anthropic" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||||
<PackageReference Include="Microsoft.Extensions.AI" />
|
<PackageReference Include="Microsoft.Extensions.AI" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue