-
Notifications
You must be signed in to change notification settings - Fork 1.1k
.Net: Update Anthropic and Anthropic.Foundry package versions #3517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the Anthropic SDK packages to their latest versions and adapts the codebase to handle breaking API changes. The update enables native TokenCredential support in Anthropic.Foundry, eliminating the need for a custom credential wrapper implementation.
Changes:
- Updated package versions: Anthropic 12.0.1 → 12.3.0, Anthropic.Foundry 0.1.0 → 0.4.1, System.Net.ServerSentEvents 10.0.0 → 10.0.1
- Adapted code to breaking API changes:
APIKey→ApiKey,BaseUrltype change fromUritostring, and new interface members - Replaced custom
AnthropicAzureTokenCredentialclass (35 lines) with built-inAnthropicFoundryIdentityTokenCredentials
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| dotnet/Directory.Packages.props | Updated Anthropic, Anthropic.Foundry, and System.Net.ServerSentEvents package versions |
| dotnet/tests/Microsoft.Agents.AI.Anthropic.UnitTests/Extensions/AnthropicClientExtensionsTests.cs | Updated test mocks to reflect API changes: ApiKey property rename, BaseUrl type change, added WithRawResponse property and Dispose method |
| dotnet/tests/Microsoft.Agents.AI.Anthropic.UnitTests/Extensions/AnthropicBetaServiceExtensionsTests.cs | Updated test mocks with same API changes plus WithRawResponse property on IBetaService |
| dotnet/tests/AnthropicChatCompletion.IntegrationTests/AnthropicChatCompletionFixture.cs | Updated ApiKey property reference in test setup |
| dotnet/samples/GettingStarted/Workflows/_Foundational/05_MultiModelService/Program.cs | Updated ApiKey property reference in sample |
| dotnet/samples/GettingStarted/AgentWithAnthropic/Agent_Anthropic_Step03_UsingFunctionTools/Program.cs | Updated ApiKey property reference in sample |
| dotnet/samples/GettingStarted/AgentWithAnthropic/Agent_Anthropic_Step02_Reasoning/Program.cs | Updated ApiKey property reference in sample |
| dotnet/samples/GettingStarted/AgentWithAnthropic/Agent_Anthropic_Step01_Running/Program.cs | Updated ApiKey property reference in sample |
| dotnet/samples/GettingStarted/AgentProviders/Agent_With_Anthropic/Program.cs | Removed custom credential implementation and unused using statements, replaced with built-in AnthropicFoundryIdentityTokenCredentials, updated ApiKey property reference |
dotnet/tests/AnthropicChatCompletion.IntegrationTests/AnthropicChatCompletionFixture.cs
Show resolved
Hide resolved
…oft#3517) * Initial plan * Update Anthropic packages to v12.3.0 and Anthropic.Foundry to v0.4.1 Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com> * Fix AnthropicClient not being disposed in sample --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
Motivation and Context
Anthropic.Foundry 0.4.1 now natively supports
TokenCredentialauthentication, eliminating the need for custom credential wrapper implementations.Description
Package Updates:
Anthropic: 12.0.1 → 12.3.0Anthropic.Foundry: 0.1.0 → 0.4.1System.Net.ServerSentEvents: 10.0.0 → 10.0.1 (transitive)Breaking API Changes in Anthropic SDK:
APIKey→ApiKeyproperty renameBaseUrltype changed fromUritostringIAnthropicClientnow implementsIDisposableExecutemethod moved toIAnthropicClientWithRawResponseWithRawResponseproperty onIAnthropicClientandIBetaServiceSample Simplification:
Replaced 35-line custom
AnthropicAzureTokenCredentialwith built-in class:Contribution Checklist
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
www.nuget.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.