From 2e01c1112554ae481eeb9a631e6227895c9a2ebe Mon Sep 17 00:00:00 2001 From: Entinger Christoph Date: Thu, 2 Jul 2026 10:07:06 +0200 Subject: [PATCH 1/2] feat(ai-anthropic): add Claude Sonnet 5, Fable 5 and other missing models to type maps Added Claude Sonnet 5, Claude Fable 5, Opus 4.7 Fast, Opus 4.8, and Opus 4.8 Fast to: - ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS - AnthropicChatModelToolCapabilitiesByName Added type assertion tests for Sonnet 5 and Fable 5 covering provider options, extended thinking, priority tier, base options, and input modality constraints. Closes #880 --- .changeset/spotty-maps-walk.md | 5 + packages/ai-anthropic/src/model-meta.ts | 9 ++ .../ai-anthropic/tests/model-meta.test.ts | 134 ++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 .changeset/spotty-maps-walk.md diff --git a/.changeset/spotty-maps-walk.md b/.changeset/spotty-maps-walk.md new file mode 100644 index 000000000..a3c7e4eea --- /dev/null +++ b/.changeset/spotty-maps-walk.md @@ -0,0 +1,5 @@ +--- +"@tanstack/ai-anthropic": patch +--- + +Added Claude Sonnet 5, Claude Fable 5, Opus 4.7 Fast, Opus 4.8, and Opus 4.8 Fast to `ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS` and `AnthropicChatModelToolCapabilitiesByName` diff --git a/packages/ai-anthropic/src/model-meta.ts b/packages/ai-anthropic/src/model-meta.ts index e951d9edb..4ef07d794 100644 --- a/packages/ai-anthropic/src/model-meta.ts +++ b/packages/ai-anthropic/src/model-meta.ts @@ -830,6 +830,10 @@ export const ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS = new Set([ CLAUDE_SONNET_4_5.id, CLAUDE_SONNET_4_6.id, CLAUDE_HAIKU_4_5.id, + CLAUDE_OPUS_4_8.id, + CLAUDE_OPUS_4_8_FAST.id, + CLAUDE_FABLE_5.id, + CLAUDE_SONNET_5.id, ]) // const ANTHROPIC_IMAGE_MODELS = [] as const @@ -1004,6 +1008,11 @@ export type AnthropicChatModelToolCapabilitiesByName = { [CLAUDE_HAIKU_3.id]: typeof CLAUDE_HAIKU_3.supports.tools [CLAUDE_OPUS_4_6_FAST.id]: typeof CLAUDE_OPUS_4_6_FAST.supports.tools [CLAUDE_OPUS_4_7.id]: typeof CLAUDE_OPUS_4_7.supports.tools + [CLAUDE_OPUS_4_7_FAST.id]: typeof CLAUDE_OPUS_4_7_FAST.supports.tools + [CLAUDE_OPUS_4_8.id]: typeof CLAUDE_OPUS_4_8.supports.tools + [CLAUDE_OPUS_4_8_FAST.id]: typeof CLAUDE_OPUS_4_8_FAST.supports.tools + [CLAUDE_FABLE_5.id]: typeof CLAUDE_FABLE_5.supports.tools + [CLAUDE_SONNET_5.id]: typeof CLAUDE_SONNET_5.supports.tools } /** diff --git a/packages/ai-anthropic/tests/model-meta.test.ts b/packages/ai-anthropic/tests/model-meta.test.ts index 3a8c5bc44..93e4cfb36 100644 --- a/packages/ai-anthropic/tests/model-meta.test.ts +++ b/packages/ai-anthropic/tests/model-meta.test.ts @@ -160,6 +160,40 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf().toHaveProperty('tool_choice') expectTypeOf().toHaveProperty('top_k') }) + + it('claude-sonnet-5 should support thinking options', () => { + type Options = AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + + expectTypeOf().toExtend() + expectTypeOf().toExtend() + expectTypeOf().toExtend() + + expectTypeOf().toHaveProperty('thinking') + expectTypeOf().toHaveProperty('service_tier') + expectTypeOf().toHaveProperty('container') + expectTypeOf().toHaveProperty('context_management') + expectTypeOf().toHaveProperty('mcp_servers') + expectTypeOf().toHaveProperty('stop_sequences') + expectTypeOf().toHaveProperty('tool_choice') + expectTypeOf().toHaveProperty('top_k') + }) + + it('claude-fable-5 should support thinking options', () => { + type Options = AnthropicChatModelProviderOptionsByName['claude-fable-5'] + + expectTypeOf().toExtend() + expectTypeOf().toExtend() + expectTypeOf().toExtend() + + expectTypeOf().toHaveProperty('thinking') + expectTypeOf().toHaveProperty('service_tier') + expectTypeOf().toHaveProperty('container') + expectTypeOf().toHaveProperty('context_management') + expectTypeOf().toHaveProperty('mcp_servers') + expectTypeOf().toHaveProperty('stop_sequences') + expectTypeOf().toHaveProperty('tool_choice') + expectTypeOf().toHaveProperty('top_k') + }) }) describe('Models WITHOUT extended_thinking support', () => { @@ -221,6 +255,8 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf<'claude-opus-4'>().toExtend() expectTypeOf<'claude-3-5-haiku'>().toExtend() expectTypeOf<'claude-3-haiku'>().toExtend() + expectTypeOf<'claude-sonnet-5'>().toExtend() + expectTypeOf<'claude-fable-5'>().toExtend() }) }) @@ -256,6 +292,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-3-haiku'] >().toHaveProperty('container') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toHaveProperty('container') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toHaveProperty('container') }) it('all models should have context management options', () => { @@ -289,6 +331,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-3-haiku'] >().toHaveProperty('context_management') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toHaveProperty('context_management') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toHaveProperty('context_management') }) it('all models should have MCP options', () => { @@ -322,6 +370,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-3-haiku'] >().toHaveProperty('mcp_servers') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toHaveProperty('mcp_servers') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toHaveProperty('mcp_servers') }) it('all models should have stop sequences options', () => { @@ -355,6 +409,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-3-haiku'] >().toHaveProperty('stop_sequences') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toHaveProperty('stop_sequences') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toHaveProperty('stop_sequences') }) it('all models should have tool choice options', () => { @@ -388,6 +448,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-3-haiku'] >().toHaveProperty('tool_choice') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toHaveProperty('tool_choice') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toHaveProperty('tool_choice') }) it('all models should have sampling options (top_k)', () => { @@ -421,6 +487,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-3-haiku'] >().toHaveProperty('top_k') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toHaveProperty('top_k') + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toHaveProperty('top_k') }) }) @@ -450,6 +522,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-opus-4'] >().toExtend() + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toExtend() + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toExtend() }) it('models without extended_thinking should NOT extend AnthropicThinkingOptions', () => { @@ -489,6 +567,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-3-5-haiku'] >().toExtend() + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toExtend() + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toExtend() }) it('models without priority_tier should NOT extend AnthropicServiceTierOptions', () => { @@ -528,6 +612,12 @@ describe('Anthropic Model Provider Options Type Assertions', () => { expectTypeOf< AnthropicChatModelProviderOptionsByName['claude-3-haiku'] >().toExtend() + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-sonnet-5'] + >().toExtend() + expectTypeOf< + AnthropicChatModelProviderOptionsByName['claude-fable-5'] + >().toExtend() }) }) }) @@ -779,4 +869,48 @@ describe('Anthropic Model Input Modality Type Assertions', () => { >().not.toExtend() }) }) + + describe('Claude Sonnet 5 (text + image + document)', () => { + type Modalities = AnthropicModelInputModalitiesByName['claude-sonnet-5'] + type Message = ConstrainedModelMessage> + + it('should allow TextPart, ImagePart, and DocumentPart', () => { + expectTypeOf>().toExtend() + expectTypeOf>().toExtend() + expectTypeOf< + MessageWithContent + >().toExtend() + }) + + it('should NOT allow AudioPart or VideoPart', () => { + expectTypeOf< + MessageWithContent + >().not.toExtend() + expectTypeOf< + MessageWithContent + >().not.toExtend() + }) + }) + + describe('Claude Fable 5 (text + image + document)', () => { + type Modalities = AnthropicModelInputModalitiesByName['claude-fable-5'] + type Message = ConstrainedModelMessage> + + it('should allow TextPart, ImagePart, and DocumentPart', () => { + expectTypeOf>().toExtend() + expectTypeOf>().toExtend() + expectTypeOf< + MessageWithContent + >().toExtend() + }) + + it('should NOT allow AudioPart or VideoPart', () => { + expectTypeOf< + MessageWithContent + >().not.toExtend() + expectTypeOf< + MessageWithContent + >().not.toExtend() + }) + }) }) From 3d702d0cedbff48b8c86618ff17cca48cf45c345 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2026 09:49:25 +0000 Subject: [PATCH 2/2] ci: apply automated fixes --- .changeset/spotty-maps-walk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/spotty-maps-walk.md b/.changeset/spotty-maps-walk.md index a3c7e4eea..620766f85 100644 --- a/.changeset/spotty-maps-walk.md +++ b/.changeset/spotty-maps-walk.md @@ -1,5 +1,5 @@ --- -"@tanstack/ai-anthropic": patch +'@tanstack/ai-anthropic': patch --- Added Claude Sonnet 5, Claude Fable 5, Opus 4.7 Fast, Opus 4.8, and Opus 4.8 Fast to `ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS` and `AnthropicChatModelToolCapabilitiesByName`