@ai-sdk/anthropic 3.0.119 → 3.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/index.d.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +834 -458
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +826 -446
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +74 -2
- package/dist/internal/index.d.ts +74 -2
- package/dist/internal/index.js +827 -451
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +825 -445
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +125 -14
- package/package.json +3 -3
- package/src/anthropic-messages-api.ts +23 -0
- package/src/anthropic-messages-language-model.ts +264 -6
- package/src/anthropic-messages-options.ts +12 -2
- package/src/anthropic-prepare-tools.ts +76 -0
- package/src/anthropic-tools.ts +25 -0
- package/src/convert-to-anthropic-messages-prompt.ts +77 -1
- package/src/tool/computer-toolset_20260801.ts +165 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.121
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [da2e17b]
|
|
8
|
+
- @ai-sdk/provider@3.0.17
|
|
9
|
+
- @ai-sdk/provider-utils@4.0.53
|
|
10
|
+
|
|
11
|
+
## 3.0.120
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- bd8bf1f: feat(anthropic): add Claude Opus 5.5 support
|
|
16
|
+
|
|
17
|
+
- add the `claude-opus-5-5` model ID to `@ai-sdk/anthropic` and `anthropic/claude-opus-5.5` to `@ai-sdk/gateway`
|
|
18
|
+
- models that always use adaptive thinking (`claude-opus-5-5`, `claude-fable-5`, `claude-fable-5-1`) no longer receive `thinking: { type: 'disabled' }` or budget-based thinking; the provider drops the unsupported setting and emits a warning
|
|
19
|
+
- models that reject forced tool use (`claude-opus-5-5`, `claude-fable-5-1`) fall back to `auto` tool choice for `required` and named tool choices, and to native structured outputs when `structuredOutputMode: 'jsonTool'` is requested, each with a warning
|
|
20
|
+
- add the `computerToolset_20260801` computer use tool (`computer_toolset_20260801`), which is required for computer use on `claude-opus-5-5`
|
|
21
|
+
- use the documented `mid-conversation-output-config-2026-07-01` beta header for per-message effort
|
|
22
|
+
|
|
3
23
|
## 3.0.119
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -195,7 +195,7 @@ interface AnthropicMessageMetadata {
|
|
|
195
195
|
} | null;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
|
|
198
|
+
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
|
|
199
199
|
/**
|
|
200
200
|
* Anthropic provider options for system messages.
|
|
201
201
|
*/
|
|
@@ -353,6 +353,14 @@ interface AnthropicToolOptions {
|
|
|
353
353
|
eagerInputStreaming?: boolean;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Member tools of the computer toolset. Each member is returned by the API as
|
|
358
|
+
* its own `tool_use` block; the AI SDK exposes it as the `action` of a single
|
|
359
|
+
* computer tool call.
|
|
360
|
+
*/
|
|
361
|
+
declare const computerToolset_20260801Members: readonly ["screenshot", "zoom", "left_click", "right_click", "middle_click", "double_click", "triple_click", "left_click_drag", "mouse_move", "left_mouse_down", "left_mouse_up", "cursor_position", "scroll", "type", "key", "hold_key", "wait"];
|
|
362
|
+
type ComputerToolset_20260801Member = (typeof computerToolset_20260801Members)[number];
|
|
363
|
+
|
|
356
364
|
declare const anthropicTools: {
|
|
357
365
|
/**
|
|
358
366
|
* Pairs a faster executor model with a higher-intelligence advisor model
|
|
@@ -821,6 +829,44 @@ declare const anthropicTools: {
|
|
|
821
829
|
displayNumber?: number;
|
|
822
830
|
enableZoom?: boolean;
|
|
823
831
|
}>;
|
|
832
|
+
/**
|
|
833
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
834
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
835
|
+
* (`computer_20251124` and earlier) on newer models.
|
|
836
|
+
*
|
|
837
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
838
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
839
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
840
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
841
|
+
* in one turn.
|
|
842
|
+
*
|
|
843
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
844
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
845
|
+
*
|
|
846
|
+
* Does not require a beta header.
|
|
847
|
+
*
|
|
848
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
849
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
850
|
+
*
|
|
851
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
852
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
853
|
+
*/
|
|
854
|
+
computerToolset_20260801: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
855
|
+
action: ComputerToolset_20260801Member;
|
|
856
|
+
coordinate?: [number, number];
|
|
857
|
+
duration?: number;
|
|
858
|
+
region?: [number, number, number, number];
|
|
859
|
+
repeat?: number;
|
|
860
|
+
scroll_amount?: number;
|
|
861
|
+
scroll_direction?: "up" | "down" | "left" | "right";
|
|
862
|
+
start_coordinate?: [number, number];
|
|
863
|
+
text?: string;
|
|
864
|
+
}, {
|
|
865
|
+
configs?: Partial<Record<ComputerToolset_20260801Member, {
|
|
866
|
+
enabled?: boolean;
|
|
867
|
+
deferLoading?: boolean;
|
|
868
|
+
}>>;
|
|
869
|
+
}>;
|
|
824
870
|
/**
|
|
825
871
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
826
872
|
* Claude can create, read, update, and delete files that persist between sessions,
|
package/dist/index.d.ts
CHANGED
|
@@ -195,7 +195,7 @@ interface AnthropicMessageMetadata {
|
|
|
195
195
|
} | null;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
|
|
198
|
+
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
|
|
199
199
|
/**
|
|
200
200
|
* Anthropic provider options for system messages.
|
|
201
201
|
*/
|
|
@@ -353,6 +353,14 @@ interface AnthropicToolOptions {
|
|
|
353
353
|
eagerInputStreaming?: boolean;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Member tools of the computer toolset. Each member is returned by the API as
|
|
358
|
+
* its own `tool_use` block; the AI SDK exposes it as the `action` of a single
|
|
359
|
+
* computer tool call.
|
|
360
|
+
*/
|
|
361
|
+
declare const computerToolset_20260801Members: readonly ["screenshot", "zoom", "left_click", "right_click", "middle_click", "double_click", "triple_click", "left_click_drag", "mouse_move", "left_mouse_down", "left_mouse_up", "cursor_position", "scroll", "type", "key", "hold_key", "wait"];
|
|
362
|
+
type ComputerToolset_20260801Member = (typeof computerToolset_20260801Members)[number];
|
|
363
|
+
|
|
356
364
|
declare const anthropicTools: {
|
|
357
365
|
/**
|
|
358
366
|
* Pairs a faster executor model with a higher-intelligence advisor model
|
|
@@ -821,6 +829,44 @@ declare const anthropicTools: {
|
|
|
821
829
|
displayNumber?: number;
|
|
822
830
|
enableZoom?: boolean;
|
|
823
831
|
}>;
|
|
832
|
+
/**
|
|
833
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
834
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
835
|
+
* (`computer_20251124` and earlier) on newer models.
|
|
836
|
+
*
|
|
837
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
838
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
839
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
840
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
841
|
+
* in one turn.
|
|
842
|
+
*
|
|
843
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
844
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
845
|
+
*
|
|
846
|
+
* Does not require a beta header.
|
|
847
|
+
*
|
|
848
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
849
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
850
|
+
*
|
|
851
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
852
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
853
|
+
*/
|
|
854
|
+
computerToolset_20260801: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
855
|
+
action: ComputerToolset_20260801Member;
|
|
856
|
+
coordinate?: [number, number];
|
|
857
|
+
duration?: number;
|
|
858
|
+
region?: [number, number, number, number];
|
|
859
|
+
repeat?: number;
|
|
860
|
+
scroll_amount?: number;
|
|
861
|
+
scroll_direction?: "up" | "down" | "left" | "right";
|
|
862
|
+
start_coordinate?: [number, number];
|
|
863
|
+
text?: string;
|
|
864
|
+
}, {
|
|
865
|
+
configs?: Partial<Record<ComputerToolset_20260801Member, {
|
|
866
|
+
enabled?: boolean;
|
|
867
|
+
deferLoading?: boolean;
|
|
868
|
+
}>>;
|
|
869
|
+
}>;
|
|
824
870
|
/**
|
|
825
871
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
826
872
|
* Claude can create, read, update, and delete files that persist between sessions,
|