@ai-sdk/anthropic 4.0.0-beta.36 → 4.0.0-beta.38
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 +21 -0
- package/dist/index.d.ts +24 -24
- package/dist/index.js +59 -61
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +29 -29
- package/dist/internal/index.js +59 -60
- package/dist/internal/index.js.map +1 -1
- package/package.json +4 -3
- package/src/{anthropic-messages-api.ts → anthropic-api.ts} +4 -4
- package/src/{anthropic-messages-language-model.ts → anthropic-language-model.ts} +32 -37
- package/src/{anthropic-messages-options.ts → anthropic-options.ts} +1 -1
- package/src/anthropic-prepare-tools.ts +1 -1
- package/src/anthropic-provider.ts +9 -9
- package/src/{convert-anthropic-messages-usage.ts → convert-anthropic-usage.ts} +3 -3
- package/src/{convert-to-anthropic-messages-prompt.ts → convert-to-anthropic-prompt.ts} +9 -8
- package/src/get-cache-control.ts +1 -1
- package/src/index.ts +1 -1
- package/src/internal/index.ts +9 -3
- package/src/tool/bash_20241022.ts +2 -2
- package/src/tool/bash_20250124.ts +2 -2
- package/src/tool/code-execution_20250522.ts +2 -2
- package/src/tool/code-execution_20250825.ts +2 -2
- package/src/tool/code-execution_20260120.ts +2 -2
- package/src/tool/computer_20241022.ts +2 -2
- package/src/tool/computer_20250124.ts +2 -2
- package/src/tool/computer_20251124.ts +2 -2
- package/src/tool/memory_20250818.ts +2 -2
- package/src/tool/text-editor_20241022.ts +2 -2
- package/src/tool/text-editor_20250124.ts +2 -2
- package/src/tool/text-editor_20250429.ts +2 -2
- package/src/tool/text-editor_20250728.ts +2 -2
- package/src/tool/tool-search-bm25_20251119.ts +2 -2
- package/src/tool/tool-search-regex_20251119.ts +2 -2
- package/src/tool/web-fetch-20250910.ts +2 -2
- package/src/tool/web-fetch-20260209.ts +2 -2
- package/src/tool/web-search_20250305.ts +2 -2
- package/src/tool/web-search_20260209.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.38
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 87d1723: chore(anthropic): remove unnecessary messages affix from Anthropic symbols and files
|
|
8
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
9
|
+
- Updated dependencies [785fe16]
|
|
10
|
+
- Updated dependencies [67df0a0]
|
|
11
|
+
- Updated dependencies [befb78c]
|
|
12
|
+
- Updated dependencies [0458559]
|
|
13
|
+
- Updated dependencies [5852c0a]
|
|
14
|
+
- Updated dependencies [fc92055]
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
16
|
+
|
|
17
|
+
## 4.0.0-beta.37
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [2e98477]
|
|
22
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
23
|
+
|
|
3
24
|
## 4.0.0-beta.36
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -127,7 +127,7 @@ interface AnthropicMessageMetadata {
|
|
|
127
127
|
} | null;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
type
|
|
130
|
+
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' | (string & {});
|
|
131
131
|
declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
132
132
|
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
133
133
|
structuredOutputMode: z.ZodOptional<z.ZodEnum<{
|
|
@@ -251,7 +251,7 @@ declare const anthropicTools: {
|
|
|
251
251
|
*
|
|
252
252
|
* Image results are supported.
|
|
253
253
|
*/
|
|
254
|
-
bash_20241022: _ai_sdk_provider_utils.
|
|
254
|
+
bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
255
255
|
command: string;
|
|
256
256
|
restart?: boolean;
|
|
257
257
|
}, {}, {}>;
|
|
@@ -261,7 +261,7 @@ declare const anthropicTools: {
|
|
|
261
261
|
*
|
|
262
262
|
* Image results are supported.
|
|
263
263
|
*/
|
|
264
|
-
bash_20250124: _ai_sdk_provider_utils.
|
|
264
|
+
bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
265
265
|
command: string;
|
|
266
266
|
restart?: boolean;
|
|
267
267
|
}, {}, {}>;
|
|
@@ -273,7 +273,7 @@ declare const anthropicTools: {
|
|
|
273
273
|
* The code execution tool allows Claude to run Bash commands and manipulate files,
|
|
274
274
|
* including writing code, in a secure, sandboxed environment.
|
|
275
275
|
*/
|
|
276
|
-
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.
|
|
276
|
+
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
277
277
|
code: string;
|
|
278
278
|
}, {
|
|
279
279
|
type: "code_execution_result";
|
|
@@ -306,7 +306,7 @@ declare const anthropicTools: {
|
|
|
306
306
|
*
|
|
307
307
|
* This is the latest version with enhanced Bash support and file operations.
|
|
308
308
|
*/
|
|
309
|
-
codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.
|
|
309
|
+
codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
310
310
|
type: "programmatic-tool-call";
|
|
311
311
|
code: string;
|
|
312
312
|
} | {
|
|
@@ -443,7 +443,7 @@ declare const anthropicTools: {
|
|
|
443
443
|
*
|
|
444
444
|
* Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
|
|
445
445
|
*/
|
|
446
|
-
codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.
|
|
446
|
+
codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
447
447
|
type: "programmatic-tool-call";
|
|
448
448
|
code: string;
|
|
449
449
|
} | {
|
|
@@ -596,7 +596,7 @@ declare const anthropicTools: {
|
|
|
596
596
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
597
597
|
* @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
|
|
598
598
|
*/
|
|
599
|
-
computer_20241022: _ai_sdk_provider_utils.
|
|
599
|
+
computer_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
600
600
|
action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
|
|
601
601
|
coordinate?: number[];
|
|
602
602
|
text?: string;
|
|
@@ -615,7 +615,7 @@ declare const anthropicTools: {
|
|
|
615
615
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
616
616
|
* @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
|
|
617
617
|
*/
|
|
618
|
-
computer_20250124: _ai_sdk_provider_utils.
|
|
618
|
+
computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
619
619
|
action: "key" | "hold_key" | "type" | "cursor_position" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "triple_click" | "scroll" | "wait" | "screenshot";
|
|
620
620
|
coordinate?: [number, number];
|
|
621
621
|
duration?: number;
|
|
@@ -643,7 +643,7 @@ declare const anthropicTools: {
|
|
|
643
643
|
* @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
|
|
644
644
|
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
645
645
|
*/
|
|
646
|
-
computer_20251124: _ai_sdk_provider_utils.
|
|
646
|
+
computer_20251124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
647
647
|
action: "key" | "hold_key" | "type" | "cursor_position" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "triple_click" | "scroll" | "wait" | "screenshot" | "zoom";
|
|
648
648
|
coordinate?: [number, number];
|
|
649
649
|
duration?: number;
|
|
@@ -666,7 +666,7 @@ declare const anthropicTools: {
|
|
|
666
666
|
*
|
|
667
667
|
* Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
|
|
668
668
|
*/
|
|
669
|
-
memory_20250818: _ai_sdk_provider_utils.
|
|
669
|
+
memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
670
670
|
command: "view";
|
|
671
671
|
path: string;
|
|
672
672
|
view_range?: [number, number];
|
|
@@ -699,7 +699,7 @@ declare const anthropicTools: {
|
|
|
699
699
|
*
|
|
700
700
|
* Supported models: Claude Sonnet 3.5
|
|
701
701
|
*/
|
|
702
|
-
textEditor_20241022: _ai_sdk_provider_utils.
|
|
702
|
+
textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
703
703
|
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
704
704
|
path: string;
|
|
705
705
|
file_text?: string;
|
|
@@ -716,7 +716,7 @@ declare const anthropicTools: {
|
|
|
716
716
|
*
|
|
717
717
|
* Supported models: Claude Sonnet 3.7
|
|
718
718
|
*/
|
|
719
|
-
textEditor_20250124: _ai_sdk_provider_utils.
|
|
719
|
+
textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
720
720
|
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
721
721
|
path: string;
|
|
722
722
|
file_text?: string;
|
|
@@ -735,7 +735,7 @@ declare const anthropicTools: {
|
|
|
735
735
|
*
|
|
736
736
|
* @deprecated Use textEditor_20250728 instead
|
|
737
737
|
*/
|
|
738
|
-
textEditor_20250429: _ai_sdk_provider_utils.
|
|
738
|
+
textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
739
739
|
command: "view" | "create" | "str_replace" | "insert";
|
|
740
740
|
path: string;
|
|
741
741
|
file_text?: string;
|
|
@@ -756,7 +756,7 @@ declare const anthropicTools: {
|
|
|
756
756
|
*
|
|
757
757
|
* @param maxCharacters - Optional maximum number of characters to view in the file
|
|
758
758
|
*/
|
|
759
|
-
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.
|
|
759
|
+
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
760
760
|
command: "view" | "create" | "str_replace" | "insert";
|
|
761
761
|
path: string;
|
|
762
762
|
file_text?: string;
|
|
@@ -786,7 +786,7 @@ declare const anthropicTools: {
|
|
|
786
786
|
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
787
787
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
788
788
|
*/
|
|
789
|
-
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.
|
|
789
|
+
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
790
790
|
url: string;
|
|
791
791
|
}, {
|
|
792
792
|
type: "web_fetch_result";
|
|
@@ -848,7 +848,7 @@ declare const anthropicTools: {
|
|
|
848
848
|
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
849
849
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
850
850
|
*/
|
|
851
|
-
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.
|
|
851
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
852
852
|
url: string;
|
|
853
853
|
}, {
|
|
854
854
|
type: "web_fetch_result";
|
|
@@ -909,7 +909,7 @@ declare const anthropicTools: {
|
|
|
909
909
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
910
910
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
911
911
|
*/
|
|
912
|
-
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.
|
|
912
|
+
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
913
913
|
query: string;
|
|
914
914
|
}, {
|
|
915
915
|
type: "web_search_result";
|
|
@@ -945,7 +945,7 @@ declare const anthropicTools: {
|
|
|
945
945
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
946
946
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
947
947
|
*/
|
|
948
|
-
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.
|
|
948
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
949
949
|
query: string;
|
|
950
950
|
}, {
|
|
951
951
|
type: "web_search_result";
|
|
@@ -986,7 +986,7 @@ declare const anthropicTools: {
|
|
|
986
986
|
*
|
|
987
987
|
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
988
988
|
*/
|
|
989
|
-
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.
|
|
989
|
+
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
990
990
|
pattern: string;
|
|
991
991
|
limit?: number;
|
|
992
992
|
}, {
|
|
@@ -1012,7 +1012,7 @@ declare const anthropicTools: {
|
|
|
1012
1012
|
*
|
|
1013
1013
|
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
1014
1014
|
*/
|
|
1015
|
-
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.
|
|
1015
|
+
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
1016
1016
|
query: string;
|
|
1017
1017
|
limit?: number;
|
|
1018
1018
|
}, {
|
|
@@ -1031,13 +1031,13 @@ interface AnthropicProvider extends ProviderV4 {
|
|
|
1031
1031
|
/**
|
|
1032
1032
|
* Creates a model for text generation.
|
|
1033
1033
|
*/
|
|
1034
|
-
(modelId:
|
|
1034
|
+
(modelId: AnthropicModelId): LanguageModelV4;
|
|
1035
1035
|
/**
|
|
1036
1036
|
* Creates a model for text generation.
|
|
1037
1037
|
*/
|
|
1038
|
-
languageModel(modelId:
|
|
1039
|
-
chat(modelId:
|
|
1040
|
-
messages(modelId:
|
|
1038
|
+
languageModel(modelId: AnthropicModelId): LanguageModelV4;
|
|
1039
|
+
chat(modelId: AnthropicModelId): LanguageModelV4;
|
|
1040
|
+
messages(modelId: AnthropicModelId): LanguageModelV4;
|
|
1041
1041
|
/**
|
|
1042
1042
|
* @deprecated Use `embeddingModel` instead.
|
|
1043
1043
|
*/
|