Upgrade Anthropic provider from beta SDK to stable v1.4.0 #189
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upgrade Anthropic provider from beta SDK to stable v1.4.0
Summary
This PR updates the Anthropic SDK integration from beta version 0.2.0-beta.2 to stable version 1.4.0, along with necessary code changes to accommodate the SDK's API updates. The changes also include documentation updates to add the Claude 4 models to the supported model list.
Files Changed
README.md
Added Claude 4 Sonnet and Claude 4 Opus to the list of supported Anthropic models in the documentation.
cmd/schema/README.md
Minor formatting fix - removed extra newline at end of file.
go.mod
andgo.sum
Updated the Anthropic SDK dependency from
v0.2.0-beta.2
tov1.4.0
.internal/llm/provider/anthropic.go
Updated code to match the new SDK API:
OfRequestTextBlock
toOfText
for text content blocksNewToolUseBlock
helper functionThinkingConfigParamOfEnabled
helperCode Changes
Text Block Cache Control Updates
Tool Use Block Creation
Thinking Configuration Simplification
Reason for Changes
Impact of Changes
ThinkingConfigParamOfEnabled
) that simplify the codeTest Plan
Verify that all Anthropic model interactions work correctly with the new SDK
Test message conversion with cache control enabled and disabled
Ensure tool use functionality continues to work as expected
Validate that thinking mode triggers correctly based on message content
Used compiled go binary to do major refactoring of an existing code repository:
Additional Notes
The changes are primarily mechanical updates to accommodate the SDK's API changes. The core logic and behavior remain unchanged. The addition of Claude 4 models to the documentation suggests these models are now available for use, though no code changes were needed to support them.