Skip to content

Commit 1e0fc89

Browse files
authored
refactor: migrate Anthropic provider to @ai-sdk/anthropic (#11287)
* refactor: migrate Anthropic provider to @ai-sdk/anthropic Replace the raw @anthropic-ai/sdk implementation with @ai-sdk/anthropic (Vercel AI SDK) for consistency with other providers (Bedrock, DeepSeek, Mistral, etc.). Changes: - Replace Anthropic() client with createAnthropic() from @ai-sdk/anthropic - Replace manual stream parsing with streamText() + processAiSdkStreamPart() - Replace client.messages.create() with generateText() for completePrompt() - Use convertToAiSdkMessages() and convertToolsForAiSdk() for format conversion - Handle prompt caching via AI SDK providerOptions (cacheControl on messages) - Handle extended thinking via providerOptions.anthropic.thinking - Add getThoughtSignature() and getRedactedThinkingBlocks() for thinking signature round-tripping (matching Bedrock pattern, improves on original which had a TODO for this) - Add isAiSdkProvider() returning true - Update tests to mock @ai-sdk/anthropic and ai instead of raw SDK * fix: address PR review - remove apiKey fallback and use system+systemProviderOptions pattern
1 parent ef2fec9 commit 1e0fc89

4 files changed

Lines changed: 688 additions & 832 deletions

File tree

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)