Skip to content

Commit f9239b0

Browse files
Copilotstephentoub
andauthored
Migrate from Anthropic.SDK to official Anthropic package (#1083)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: stephentoub <[email protected]>
1 parent 20d726b commit f9239b0

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
<!-- Testing dependencies -->
6161
<ItemGroup>
62-
<PackageVersion Include="Anthropic.SDK" Version="5.8.0" />
62+
<PackageVersion Include="Anthropic" Version="11.0.0" />
6363
<PackageVersion Include="coverlet.collector" Version="6.0.4">
6464
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6565
<PrivateAssets>all</PrivateAssets>

samples/ChatWithTools/ChatWithTools.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.Extensions.AI" />
1616
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
17-
<PackageReference Include="Anthropic.SDK" />
1817
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
1918
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
2019
</ItemGroup>

samples/QuickstartClient/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Anthropic.SDK;
1+
using Anthropic;
22
using Microsoft.Extensions.AI;
33
using Microsoft.Extensions.Configuration;
44
using Microsoft.Extensions.Hosting;
@@ -41,8 +41,8 @@
4141
Console.WriteLine($"Connected to server with tools: {tool.Name}");
4242
}
4343

44-
using var anthropicClient = new AnthropicClient(new APIAuthentication(builder.Configuration["ANTHROPIC_API_KEY"]))
45-
.Messages
44+
using var anthropicClient = new AnthropicClient(new() { APIKey = builder.Configuration["ANTHROPIC_API_KEY"] })
45+
.AsIChatClient("claude-haiku-4-5-20251001")
4646
.AsBuilder()
4747
.UseFunctionInvocation()
4848
.Build();

samples/QuickstartClient/QuickstartClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Anthropic.SDK" />
20+
<PackageReference Include="Anthropic" />
2121
<PackageReference Include="Microsoft.Extensions.Hosting" />
2222
<PackageReference Include="Microsoft.Extensions.AI" />
2323
</ItemGroup>

0 commit comments

Comments
 (0)