@ai-sdk/anthropic 4.0.59 → 4.0.60
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 +12 -0
- package/dist/index.d.ts +47 -1
- package/dist/index.js +958 -559
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +84 -2
- package/dist/internal/index.js +906 -507
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +125 -14
- package/package.json +1 -1
- package/src/anthropic-api.ts +23 -0
- package/src/anthropic-language-model-options.ts +13 -3
- package/src/anthropic-language-model.ts +287 -5
- package/src/anthropic-prepare-tools.ts +76 -0
- package/src/anthropic-tools.ts +25 -0
- package/src/convert-to-anthropic-prompt.ts +74 -1
- package/src/tool/computer-toolset_20260801.ts +165 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.60
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 49295bb: feat(anthropic): add Claude Opus 5.5 support
|
|
8
|
+
|
|
9
|
+
- add the `claude-opus-5-5` model ID to `@ai-sdk/anthropic` and `anthropic/claude-opus-5.5` to `@ai-sdk/gateway`
|
|
10
|
+
- 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, maps `reasoning: 'none'` to `effort: 'low'`, and emits a warning
|
|
11
|
+
- 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
|
|
12
|
+
- add the `computerToolset_20260801` computer use tool (`computer_toolset_20260801`), which is required for computer use on `claude-opus-5-5`
|
|
13
|
+
- use the documented `mid-conversation-output-config-2026-07-01` beta header for per-message effort
|
|
14
|
+
|
|
3
15
|
## 4.0.59
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -219,7 +219,7 @@ interface AnthropicMessageMetadata {
|
|
|
219
219
|
} | null;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
type AnthropicModelId = '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 & {});
|
|
222
|
+
type AnthropicModelId = '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 & {});
|
|
223
223
|
/**
|
|
224
224
|
* Anthropic provider options for system messages.
|
|
225
225
|
*/
|
|
@@ -390,6 +390,14 @@ interface AnthropicToolOptions {
|
|
|
390
390
|
eagerInputStreaming?: boolean;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
+
/**
|
|
394
|
+
* Member tools of the computer toolset. Each member is returned by the API as
|
|
395
|
+
* its own `tool_use` block; the AI SDK exposes it as the `action` of a single
|
|
396
|
+
* computer tool call.
|
|
397
|
+
*/
|
|
398
|
+
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"];
|
|
399
|
+
type ComputerToolset_20260801Member = (typeof computerToolset_20260801Members)[number];
|
|
400
|
+
|
|
393
401
|
type Bash20241022Input = {
|
|
394
402
|
/**
|
|
395
403
|
* The bash command to run. Required unless the tool is being restarted.
|
|
@@ -917,6 +925,44 @@ declare const anthropicTools: {
|
|
|
917
925
|
displayNumber?: number;
|
|
918
926
|
enableZoom?: boolean;
|
|
919
927
|
}, {}>;
|
|
928
|
+
/**
|
|
929
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
930
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
931
|
+
* (`computer_20251124` and earlier) on newer models.
|
|
932
|
+
*
|
|
933
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
934
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
935
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
936
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
937
|
+
* in one turn.
|
|
938
|
+
*
|
|
939
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
940
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
941
|
+
*
|
|
942
|
+
* Does not require a beta header.
|
|
943
|
+
*
|
|
944
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
945
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
946
|
+
*
|
|
947
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
948
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
949
|
+
*/
|
|
950
|
+
computerToolset_20260801: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
951
|
+
action: ComputerToolset_20260801Member;
|
|
952
|
+
coordinate?: [number, number];
|
|
953
|
+
duration?: number;
|
|
954
|
+
region?: [number, number, number, number];
|
|
955
|
+
repeat?: number;
|
|
956
|
+
scroll_amount?: number;
|
|
957
|
+
scroll_direction?: "up" | "down" | "left" | "right";
|
|
958
|
+
start_coordinate?: [number, number];
|
|
959
|
+
text?: string;
|
|
960
|
+
}, {
|
|
961
|
+
configs?: Partial<Record<ComputerToolset_20260801Member, {
|
|
962
|
+
enabled?: boolean;
|
|
963
|
+
deferLoading?: boolean;
|
|
964
|
+
}>>;
|
|
965
|
+
}, {}>;
|
|
920
966
|
/**
|
|
921
967
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
922
968
|
* Claude can create, read, update, and delete files that persist between sessions,
|