@ai-sdk/anthropic 3.0.52 → 3.0.54
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 +98 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +635 -400
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +620 -376
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +100 -2
- package/dist/internal/index.d.ts +100 -2
- package/dist/internal/index.js +628 -393
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +619 -375
- 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 +64 -1
- package/src/anthropic-prepare-tools.ts +37 -0
- package/src/anthropic-tools.ts +23 -0
- package/src/convert-to-anthropic-messages-prompt.ts +8 -1
- package/src/tool/web-fetch-20260209.ts +145 -0
- package/src/tool/web-search_20260209.ts +136 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.54
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 56c67d5: feat(provider/anthropic): add support for Anthropic web tools `web_fetch_20260209` and `web_search_20260209`
|
|
8
|
+
|
|
9
|
+
## 3.0.53
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 89caf28: fix(openai-compat): decode base64 string data
|
|
14
|
+
|
|
3
15
|
## 3.0.52
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -799,6 +799,68 @@ declare const anthropicTools: {
|
|
|
799
799
|
};
|
|
800
800
|
retrievedAt: string | null;
|
|
801
801
|
}>;
|
|
802
|
+
/**
|
|
803
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
804
|
+
*
|
|
805
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
806
|
+
* @param allowedDomains - Only fetch from these domains
|
|
807
|
+
* @param blockedDomains - Never fetch from these domains
|
|
808
|
+
* @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.
|
|
809
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
810
|
+
*/
|
|
811
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
812
|
+
url: string;
|
|
813
|
+
}, {
|
|
814
|
+
type: "web_fetch_result";
|
|
815
|
+
url: string;
|
|
816
|
+
content: {
|
|
817
|
+
type: "document";
|
|
818
|
+
title: string | null;
|
|
819
|
+
citations?: {
|
|
820
|
+
enabled: boolean;
|
|
821
|
+
};
|
|
822
|
+
source: {
|
|
823
|
+
type: "base64";
|
|
824
|
+
mediaType: "application/pdf";
|
|
825
|
+
data: string;
|
|
826
|
+
} | {
|
|
827
|
+
type: "text";
|
|
828
|
+
mediaType: "text/plain";
|
|
829
|
+
data: string;
|
|
830
|
+
};
|
|
831
|
+
};
|
|
832
|
+
retrievedAt: string | null;
|
|
833
|
+
}, {
|
|
834
|
+
maxUses?: number;
|
|
835
|
+
allowedDomains?: string[];
|
|
836
|
+
blockedDomains?: string[];
|
|
837
|
+
citations?: {
|
|
838
|
+
enabled: boolean;
|
|
839
|
+
};
|
|
840
|
+
maxContentTokens?: number;
|
|
841
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
842
|
+
url: string;
|
|
843
|
+
}, {
|
|
844
|
+
type: "web_fetch_result";
|
|
845
|
+
url: string;
|
|
846
|
+
content: {
|
|
847
|
+
type: "document";
|
|
848
|
+
title: string | null;
|
|
849
|
+
citations?: {
|
|
850
|
+
enabled: boolean;
|
|
851
|
+
};
|
|
852
|
+
source: {
|
|
853
|
+
type: "base64";
|
|
854
|
+
mediaType: "application/pdf";
|
|
855
|
+
data: string;
|
|
856
|
+
} | {
|
|
857
|
+
type: "text";
|
|
858
|
+
mediaType: "text/plain";
|
|
859
|
+
data: string;
|
|
860
|
+
};
|
|
861
|
+
};
|
|
862
|
+
retrievedAt: string | null;
|
|
863
|
+
}>;
|
|
802
864
|
/**
|
|
803
865
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
804
866
|
*
|
|
@@ -835,6 +897,42 @@ declare const anthropicTools: {
|
|
|
835
897
|
pageAge: string | null;
|
|
836
898
|
encryptedContent: string;
|
|
837
899
|
}[]>;
|
|
900
|
+
/**
|
|
901
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
902
|
+
*
|
|
903
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
904
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
905
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
906
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
907
|
+
*/
|
|
908
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
909
|
+
query: string;
|
|
910
|
+
}, {
|
|
911
|
+
type: "web_search_result";
|
|
912
|
+
url: string;
|
|
913
|
+
title: string | null;
|
|
914
|
+
pageAge: string | null;
|
|
915
|
+
encryptedContent: string;
|
|
916
|
+
}[], {
|
|
917
|
+
maxUses?: number;
|
|
918
|
+
allowedDomains?: string[];
|
|
919
|
+
blockedDomains?: string[];
|
|
920
|
+
userLocation?: {
|
|
921
|
+
type: "approximate";
|
|
922
|
+
city?: string;
|
|
923
|
+
region?: string;
|
|
924
|
+
country?: string;
|
|
925
|
+
timezone?: string;
|
|
926
|
+
};
|
|
927
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
928
|
+
query: string;
|
|
929
|
+
}, {
|
|
930
|
+
type: "web_search_result";
|
|
931
|
+
url: string;
|
|
932
|
+
title: string | null;
|
|
933
|
+
pageAge: string | null;
|
|
934
|
+
encryptedContent: string;
|
|
935
|
+
}[]>;
|
|
838
936
|
/**
|
|
839
937
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
840
938
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -799,6 +799,68 @@ declare const anthropicTools: {
|
|
|
799
799
|
};
|
|
800
800
|
retrievedAt: string | null;
|
|
801
801
|
}>;
|
|
802
|
+
/**
|
|
803
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
804
|
+
*
|
|
805
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
806
|
+
* @param allowedDomains - Only fetch from these domains
|
|
807
|
+
* @param blockedDomains - Never fetch from these domains
|
|
808
|
+
* @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.
|
|
809
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
810
|
+
*/
|
|
811
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
812
|
+
url: string;
|
|
813
|
+
}, {
|
|
814
|
+
type: "web_fetch_result";
|
|
815
|
+
url: string;
|
|
816
|
+
content: {
|
|
817
|
+
type: "document";
|
|
818
|
+
title: string | null;
|
|
819
|
+
citations?: {
|
|
820
|
+
enabled: boolean;
|
|
821
|
+
};
|
|
822
|
+
source: {
|
|
823
|
+
type: "base64";
|
|
824
|
+
mediaType: "application/pdf";
|
|
825
|
+
data: string;
|
|
826
|
+
} | {
|
|
827
|
+
type: "text";
|
|
828
|
+
mediaType: "text/plain";
|
|
829
|
+
data: string;
|
|
830
|
+
};
|
|
831
|
+
};
|
|
832
|
+
retrievedAt: string | null;
|
|
833
|
+
}, {
|
|
834
|
+
maxUses?: number;
|
|
835
|
+
allowedDomains?: string[];
|
|
836
|
+
blockedDomains?: string[];
|
|
837
|
+
citations?: {
|
|
838
|
+
enabled: boolean;
|
|
839
|
+
};
|
|
840
|
+
maxContentTokens?: number;
|
|
841
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
842
|
+
url: string;
|
|
843
|
+
}, {
|
|
844
|
+
type: "web_fetch_result";
|
|
845
|
+
url: string;
|
|
846
|
+
content: {
|
|
847
|
+
type: "document";
|
|
848
|
+
title: string | null;
|
|
849
|
+
citations?: {
|
|
850
|
+
enabled: boolean;
|
|
851
|
+
};
|
|
852
|
+
source: {
|
|
853
|
+
type: "base64";
|
|
854
|
+
mediaType: "application/pdf";
|
|
855
|
+
data: string;
|
|
856
|
+
} | {
|
|
857
|
+
type: "text";
|
|
858
|
+
mediaType: "text/plain";
|
|
859
|
+
data: string;
|
|
860
|
+
};
|
|
861
|
+
};
|
|
862
|
+
retrievedAt: string | null;
|
|
863
|
+
}>;
|
|
802
864
|
/**
|
|
803
865
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
804
866
|
*
|
|
@@ -835,6 +897,42 @@ declare const anthropicTools: {
|
|
|
835
897
|
pageAge: string | null;
|
|
836
898
|
encryptedContent: string;
|
|
837
899
|
}[]>;
|
|
900
|
+
/**
|
|
901
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
902
|
+
*
|
|
903
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
904
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
905
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
906
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
907
|
+
*/
|
|
908
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
909
|
+
query: string;
|
|
910
|
+
}, {
|
|
911
|
+
type: "web_search_result";
|
|
912
|
+
url: string;
|
|
913
|
+
title: string | null;
|
|
914
|
+
pageAge: string | null;
|
|
915
|
+
encryptedContent: string;
|
|
916
|
+
}[], {
|
|
917
|
+
maxUses?: number;
|
|
918
|
+
allowedDomains?: string[];
|
|
919
|
+
blockedDomains?: string[];
|
|
920
|
+
userLocation?: {
|
|
921
|
+
type: "approximate";
|
|
922
|
+
city?: string;
|
|
923
|
+
region?: string;
|
|
924
|
+
country?: string;
|
|
925
|
+
timezone?: string;
|
|
926
|
+
};
|
|
927
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
928
|
+
query: string;
|
|
929
|
+
}, {
|
|
930
|
+
type: "web_search_result";
|
|
931
|
+
url: string;
|
|
932
|
+
title: string | null;
|
|
933
|
+
pageAge: string | null;
|
|
934
|
+
encryptedContent: string;
|
|
935
|
+
}[]>;
|
|
838
936
|
/**
|
|
839
937
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
840
938
|
*
|