@ai-sdk/anthropic 3.0.53 → 3.0.55
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.mts +116 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +743 -451
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +728 -428
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +118 -2
- package/dist/internal/index.d.ts +118 -2
- package/dist/internal/index.js +736 -444
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +727 -427
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-messages-api.ts +61 -2
- package/src/anthropic-messages-language-model.ts +93 -1
- package/src/anthropic-prepare-tools.ts +37 -0
- package/src/anthropic-tools.ts +23 -0
- package/src/convert-to-anthropic-messages-prompt.ts +37 -3
- package/src/tool/code-execution_20260120.ts +38 -0
- package/src/tool/web-fetch-20260209.ts +145 -0
- package/src/tool/web-search_20260209.ts +136 -0
|
@@ -271,6 +271,15 @@ declare const anthropicTools: {
|
|
|
271
271
|
type: "code_execution_output";
|
|
272
272
|
file_id: string;
|
|
273
273
|
}>;
|
|
274
|
+
} | {
|
|
275
|
+
type: "encrypted_code_execution_result";
|
|
276
|
+
encrypted_stdout: string;
|
|
277
|
+
stderr: string;
|
|
278
|
+
return_code: number;
|
|
279
|
+
content: Array<{
|
|
280
|
+
type: "code_execution_output";
|
|
281
|
+
file_id: string;
|
|
282
|
+
}>;
|
|
274
283
|
} | {
|
|
275
284
|
type: "bash_code_execution_result";
|
|
276
285
|
content: Array<{
|
|
@@ -333,6 +342,15 @@ declare const anthropicTools: {
|
|
|
333
342
|
type: "code_execution_output";
|
|
334
343
|
file_id: string;
|
|
335
344
|
}>;
|
|
345
|
+
} | {
|
|
346
|
+
type: "encrypted_code_execution_result";
|
|
347
|
+
encrypted_stdout: string;
|
|
348
|
+
stderr: string;
|
|
349
|
+
return_code: number;
|
|
350
|
+
content: Array<{
|
|
351
|
+
type: "code_execution_output";
|
|
352
|
+
file_id: string;
|
|
353
|
+
}>;
|
|
336
354
|
} | {
|
|
337
355
|
type: "bash_code_execution_result";
|
|
338
356
|
content: Array<{
|
|
@@ -619,6 +637,68 @@ declare const anthropicTools: {
|
|
|
619
637
|
};
|
|
620
638
|
retrievedAt: string | null;
|
|
621
639
|
}>;
|
|
640
|
+
/**
|
|
641
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
642
|
+
*
|
|
643
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
644
|
+
* @param allowedDomains - Only fetch from these domains
|
|
645
|
+
* @param blockedDomains - Never fetch from these domains
|
|
646
|
+
* @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.
|
|
647
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
648
|
+
*/
|
|
649
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
650
|
+
url: string;
|
|
651
|
+
}, {
|
|
652
|
+
type: "web_fetch_result";
|
|
653
|
+
url: string;
|
|
654
|
+
content: {
|
|
655
|
+
type: "document";
|
|
656
|
+
title: string | null;
|
|
657
|
+
citations?: {
|
|
658
|
+
enabled: boolean;
|
|
659
|
+
};
|
|
660
|
+
source: {
|
|
661
|
+
type: "base64";
|
|
662
|
+
mediaType: "application/pdf";
|
|
663
|
+
data: string;
|
|
664
|
+
} | {
|
|
665
|
+
type: "text";
|
|
666
|
+
mediaType: "text/plain";
|
|
667
|
+
data: string;
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
retrievedAt: string | null;
|
|
671
|
+
}, {
|
|
672
|
+
maxUses?: number;
|
|
673
|
+
allowedDomains?: string[];
|
|
674
|
+
blockedDomains?: string[];
|
|
675
|
+
citations?: {
|
|
676
|
+
enabled: boolean;
|
|
677
|
+
};
|
|
678
|
+
maxContentTokens?: number;
|
|
679
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
680
|
+
url: string;
|
|
681
|
+
}, {
|
|
682
|
+
type: "web_fetch_result";
|
|
683
|
+
url: string;
|
|
684
|
+
content: {
|
|
685
|
+
type: "document";
|
|
686
|
+
title: string | null;
|
|
687
|
+
citations?: {
|
|
688
|
+
enabled: boolean;
|
|
689
|
+
};
|
|
690
|
+
source: {
|
|
691
|
+
type: "base64";
|
|
692
|
+
mediaType: "application/pdf";
|
|
693
|
+
data: string;
|
|
694
|
+
} | {
|
|
695
|
+
type: "text";
|
|
696
|
+
mediaType: "text/plain";
|
|
697
|
+
data: string;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
retrievedAt: string | null;
|
|
701
|
+
}>;
|
|
622
702
|
/**
|
|
623
703
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
624
704
|
*
|
|
@@ -655,6 +735,42 @@ declare const anthropicTools: {
|
|
|
655
735
|
pageAge: string | null;
|
|
656
736
|
encryptedContent: string;
|
|
657
737
|
}[]>;
|
|
738
|
+
/**
|
|
739
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
740
|
+
*
|
|
741
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
742
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
743
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
744
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
745
|
+
*/
|
|
746
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
747
|
+
query: string;
|
|
748
|
+
}, {
|
|
749
|
+
type: "web_search_result";
|
|
750
|
+
url: string;
|
|
751
|
+
title: string | null;
|
|
752
|
+
pageAge: string | null;
|
|
753
|
+
encryptedContent: string;
|
|
754
|
+
}[], {
|
|
755
|
+
maxUses?: number;
|
|
756
|
+
allowedDomains?: string[];
|
|
757
|
+
blockedDomains?: string[];
|
|
758
|
+
userLocation?: {
|
|
759
|
+
type: "approximate";
|
|
760
|
+
city?: string;
|
|
761
|
+
region?: string;
|
|
762
|
+
country?: string;
|
|
763
|
+
timezone?: string;
|
|
764
|
+
};
|
|
765
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
766
|
+
query: string;
|
|
767
|
+
}, {
|
|
768
|
+
type: "web_search_result";
|
|
769
|
+
url: string;
|
|
770
|
+
title: string | null;
|
|
771
|
+
pageAge: string | null;
|
|
772
|
+
encryptedContent: string;
|
|
773
|
+
}[]>;
|
|
658
774
|
/**
|
|
659
775
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
660
776
|
*
|
|
@@ -774,7 +890,7 @@ type AnthropicTool = {
|
|
|
774
890
|
name: string;
|
|
775
891
|
type: 'memory_20250818';
|
|
776
892
|
} | {
|
|
777
|
-
type: 'web_fetch_20250910';
|
|
893
|
+
type: 'web_fetch_20250910' | 'web_fetch_20260209';
|
|
778
894
|
name: string;
|
|
779
895
|
max_uses?: number;
|
|
780
896
|
allowed_domains?: string[];
|
|
@@ -785,7 +901,7 @@ type AnthropicTool = {
|
|
|
785
901
|
max_content_tokens?: number;
|
|
786
902
|
cache_control: AnthropicCacheControl | undefined;
|
|
787
903
|
} | {
|
|
788
|
-
type: 'web_search_20250305';
|
|
904
|
+
type: 'web_search_20250305' | 'web_search_20260209';
|
|
789
905
|
name: string;
|
|
790
906
|
max_uses?: number;
|
|
791
907
|
allowed_domains?: string[];
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -271,6 +271,15 @@ declare const anthropicTools: {
|
|
|
271
271
|
type: "code_execution_output";
|
|
272
272
|
file_id: string;
|
|
273
273
|
}>;
|
|
274
|
+
} | {
|
|
275
|
+
type: "encrypted_code_execution_result";
|
|
276
|
+
encrypted_stdout: string;
|
|
277
|
+
stderr: string;
|
|
278
|
+
return_code: number;
|
|
279
|
+
content: Array<{
|
|
280
|
+
type: "code_execution_output";
|
|
281
|
+
file_id: string;
|
|
282
|
+
}>;
|
|
274
283
|
} | {
|
|
275
284
|
type: "bash_code_execution_result";
|
|
276
285
|
content: Array<{
|
|
@@ -333,6 +342,15 @@ declare const anthropicTools: {
|
|
|
333
342
|
type: "code_execution_output";
|
|
334
343
|
file_id: string;
|
|
335
344
|
}>;
|
|
345
|
+
} | {
|
|
346
|
+
type: "encrypted_code_execution_result";
|
|
347
|
+
encrypted_stdout: string;
|
|
348
|
+
stderr: string;
|
|
349
|
+
return_code: number;
|
|
350
|
+
content: Array<{
|
|
351
|
+
type: "code_execution_output";
|
|
352
|
+
file_id: string;
|
|
353
|
+
}>;
|
|
336
354
|
} | {
|
|
337
355
|
type: "bash_code_execution_result";
|
|
338
356
|
content: Array<{
|
|
@@ -619,6 +637,68 @@ declare const anthropicTools: {
|
|
|
619
637
|
};
|
|
620
638
|
retrievedAt: string | null;
|
|
621
639
|
}>;
|
|
640
|
+
/**
|
|
641
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
642
|
+
*
|
|
643
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
644
|
+
* @param allowedDomains - Only fetch from these domains
|
|
645
|
+
* @param blockedDomains - Never fetch from these domains
|
|
646
|
+
* @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.
|
|
647
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
648
|
+
*/
|
|
649
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
650
|
+
url: string;
|
|
651
|
+
}, {
|
|
652
|
+
type: "web_fetch_result";
|
|
653
|
+
url: string;
|
|
654
|
+
content: {
|
|
655
|
+
type: "document";
|
|
656
|
+
title: string | null;
|
|
657
|
+
citations?: {
|
|
658
|
+
enabled: boolean;
|
|
659
|
+
};
|
|
660
|
+
source: {
|
|
661
|
+
type: "base64";
|
|
662
|
+
mediaType: "application/pdf";
|
|
663
|
+
data: string;
|
|
664
|
+
} | {
|
|
665
|
+
type: "text";
|
|
666
|
+
mediaType: "text/plain";
|
|
667
|
+
data: string;
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
retrievedAt: string | null;
|
|
671
|
+
}, {
|
|
672
|
+
maxUses?: number;
|
|
673
|
+
allowedDomains?: string[];
|
|
674
|
+
blockedDomains?: string[];
|
|
675
|
+
citations?: {
|
|
676
|
+
enabled: boolean;
|
|
677
|
+
};
|
|
678
|
+
maxContentTokens?: number;
|
|
679
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
680
|
+
url: string;
|
|
681
|
+
}, {
|
|
682
|
+
type: "web_fetch_result";
|
|
683
|
+
url: string;
|
|
684
|
+
content: {
|
|
685
|
+
type: "document";
|
|
686
|
+
title: string | null;
|
|
687
|
+
citations?: {
|
|
688
|
+
enabled: boolean;
|
|
689
|
+
};
|
|
690
|
+
source: {
|
|
691
|
+
type: "base64";
|
|
692
|
+
mediaType: "application/pdf";
|
|
693
|
+
data: string;
|
|
694
|
+
} | {
|
|
695
|
+
type: "text";
|
|
696
|
+
mediaType: "text/plain";
|
|
697
|
+
data: string;
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
retrievedAt: string | null;
|
|
701
|
+
}>;
|
|
622
702
|
/**
|
|
623
703
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
624
704
|
*
|
|
@@ -655,6 +735,42 @@ declare const anthropicTools: {
|
|
|
655
735
|
pageAge: string | null;
|
|
656
736
|
encryptedContent: string;
|
|
657
737
|
}[]>;
|
|
738
|
+
/**
|
|
739
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
740
|
+
*
|
|
741
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
742
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
743
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
744
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
745
|
+
*/
|
|
746
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
747
|
+
query: string;
|
|
748
|
+
}, {
|
|
749
|
+
type: "web_search_result";
|
|
750
|
+
url: string;
|
|
751
|
+
title: string | null;
|
|
752
|
+
pageAge: string | null;
|
|
753
|
+
encryptedContent: string;
|
|
754
|
+
}[], {
|
|
755
|
+
maxUses?: number;
|
|
756
|
+
allowedDomains?: string[];
|
|
757
|
+
blockedDomains?: string[];
|
|
758
|
+
userLocation?: {
|
|
759
|
+
type: "approximate";
|
|
760
|
+
city?: string;
|
|
761
|
+
region?: string;
|
|
762
|
+
country?: string;
|
|
763
|
+
timezone?: string;
|
|
764
|
+
};
|
|
765
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
766
|
+
query: string;
|
|
767
|
+
}, {
|
|
768
|
+
type: "web_search_result";
|
|
769
|
+
url: string;
|
|
770
|
+
title: string | null;
|
|
771
|
+
pageAge: string | null;
|
|
772
|
+
encryptedContent: string;
|
|
773
|
+
}[]>;
|
|
658
774
|
/**
|
|
659
775
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
660
776
|
*
|
|
@@ -774,7 +890,7 @@ type AnthropicTool = {
|
|
|
774
890
|
name: string;
|
|
775
891
|
type: 'memory_20250818';
|
|
776
892
|
} | {
|
|
777
|
-
type: 'web_fetch_20250910';
|
|
893
|
+
type: 'web_fetch_20250910' | 'web_fetch_20260209';
|
|
778
894
|
name: string;
|
|
779
895
|
max_uses?: number;
|
|
780
896
|
allowed_domains?: string[];
|
|
@@ -785,7 +901,7 @@ type AnthropicTool = {
|
|
|
785
901
|
max_content_tokens?: number;
|
|
786
902
|
cache_control: AnthropicCacheControl | undefined;
|
|
787
903
|
} | {
|
|
788
|
-
type: 'web_search_20250305';
|
|
904
|
+
type: 'web_search_20250305' | 'web_search_20260209';
|
|
789
905
|
name: string;
|
|
790
906
|
max_uses?: number;
|
|
791
907
|
allowed_domains?: string[];
|