From f9239b0fb71e98efb1fb344fbb769bcd146c731a Mon Sep 17 00:00:00 2001
From: Copilot <198982749+Copilot@users.noreply.github.com>
Date: Wed, 10 Dec 2025 08:58:41 -0500
Subject: [PATCH] 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>
---
Directory.Packages.props | 2 +-
samples/ChatWithTools/ChatWithTools.csproj | 1 -
samples/QuickstartClient/Program.cs | 6 +++---
samples/QuickstartClient/QuickstartClient.csproj | 2 +-
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/Directory.Packages.props b/Directory.Packages.props
index d1e451a..9242c18 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -59,7 +59,7 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/samples/ChatWithTools/ChatWithTools.csproj b/samples/ChatWithTools/ChatWithTools.csproj
index 481b86f..3723185 100644
--- a/samples/ChatWithTools/ChatWithTools.csproj
+++ b/samples/ChatWithTools/ChatWithTools.csproj
@@ -14,7 +14,6 @@
-
diff --git a/samples/QuickstartClient/Program.cs b/samples/QuickstartClient/Program.cs
index 598f883..23bc4c1 100644
--- a/samples/QuickstartClient/Program.cs
+++ b/samples/QuickstartClient/Program.cs
@@ -1,4 +1,4 @@
-using Anthropic.SDK;
+using Anthropic;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
@@ -41,8 +41,8 @@ foreach (var tool in tools)
Console.WriteLine($"Connected to server with tools: {tool.Name}");
}
-using var anthropicClient = new AnthropicClient(new APIAuthentication(builder.Configuration["ANTHROPIC_API_KEY"]))
- .Messages
+using var anthropicClient = new AnthropicClient(new() { APIKey = builder.Configuration["ANTHROPIC_API_KEY"] })
+ .AsIChatClient("claude-haiku-4-5-20251001")
.AsBuilder()
.UseFunctionInvocation()
.Build();
diff --git a/samples/QuickstartClient/QuickstartClient.csproj b/samples/QuickstartClient/QuickstartClient.csproj
index 3b23310..9af83fb 100644
--- a/samples/QuickstartClient/QuickstartClient.csproj
+++ b/samples/QuickstartClient/QuickstartClient.csproj
@@ -17,7 +17,7 @@
-
+