@ai-sdk/anthropic 3.0.53 → 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 +6 -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 +618 -375
- 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 +617 -374
- 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 +6 -0
- package/src/tool/web-fetch-20260209.ts +145 -0
- package/src/tool/web-search_20260209.ts +136 -0
|
@@ -619,6 +619,68 @@ declare const anthropicTools: {
|
|
|
619
619
|
};
|
|
620
620
|
retrievedAt: string | null;
|
|
621
621
|
}>;
|
|
622
|
+
/**
|
|
623
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
624
|
+
*
|
|
625
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
626
|
+
* @param allowedDomains - Only fetch from these domains
|
|
627
|
+
* @param blockedDomains - Never fetch from these domains
|
|
628
|
+
* @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.
|
|
629
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
630
|
+
*/
|
|
631
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
632
|
+
url: string;
|
|
633
|
+
}, {
|
|
634
|
+
type: "web_fetch_result";
|
|
635
|
+
url: string;
|
|
636
|
+
content: {
|
|
637
|
+
type: "document";
|
|
638
|
+
title: string | null;
|
|
639
|
+
citations?: {
|
|
640
|
+
enabled: boolean;
|
|
641
|
+
};
|
|
642
|
+
source: {
|
|
643
|
+
type: "base64";
|
|
644
|
+
mediaType: "application/pdf";
|
|
645
|
+
data: string;
|
|
646
|
+
} | {
|
|
647
|
+
type: "text";
|
|
648
|
+
mediaType: "text/plain";
|
|
649
|
+
data: string;
|
|
650
|
+
};
|
|
651
|
+
};
|
|
652
|
+
retrievedAt: string | null;
|
|
653
|
+
}, {
|
|
654
|
+
maxUses?: number;
|
|
655
|
+
allowedDomains?: string[];
|
|
656
|
+
blockedDomains?: string[];
|
|
657
|
+
citations?: {
|
|
658
|
+
enabled: boolean;
|
|
659
|
+
};
|
|
660
|
+
maxContentTokens?: number;
|
|
661
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
662
|
+
url: string;
|
|
663
|
+
}, {
|
|
664
|
+
type: "web_fetch_result";
|
|
665
|
+
url: string;
|
|
666
|
+
content: {
|
|
667
|
+
type: "document";
|
|
668
|
+
title: string | null;
|
|
669
|
+
citations?: {
|
|
670
|
+
enabled: boolean;
|
|
671
|
+
};
|
|
672
|
+
source: {
|
|
673
|
+
type: "base64";
|
|
674
|
+
mediaType: "application/pdf";
|
|
675
|
+
data: string;
|
|
676
|
+
} | {
|
|
677
|
+
type: "text";
|
|
678
|
+
mediaType: "text/plain";
|
|
679
|
+
data: string;
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
retrievedAt: string | null;
|
|
683
|
+
}>;
|
|
622
684
|
/**
|
|
623
685
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
624
686
|
*
|
|
@@ -655,6 +717,42 @@ declare const anthropicTools: {
|
|
|
655
717
|
pageAge: string | null;
|
|
656
718
|
encryptedContent: string;
|
|
657
719
|
}[]>;
|
|
720
|
+
/**
|
|
721
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
722
|
+
*
|
|
723
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
724
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
725
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
726
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
727
|
+
*/
|
|
728
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
729
|
+
query: string;
|
|
730
|
+
}, {
|
|
731
|
+
type: "web_search_result";
|
|
732
|
+
url: string;
|
|
733
|
+
title: string | null;
|
|
734
|
+
pageAge: string | null;
|
|
735
|
+
encryptedContent: string;
|
|
736
|
+
}[], {
|
|
737
|
+
maxUses?: number;
|
|
738
|
+
allowedDomains?: string[];
|
|
739
|
+
blockedDomains?: string[];
|
|
740
|
+
userLocation?: {
|
|
741
|
+
type: "approximate";
|
|
742
|
+
city?: string;
|
|
743
|
+
region?: string;
|
|
744
|
+
country?: string;
|
|
745
|
+
timezone?: string;
|
|
746
|
+
};
|
|
747
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
748
|
+
query: string;
|
|
749
|
+
}, {
|
|
750
|
+
type: "web_search_result";
|
|
751
|
+
url: string;
|
|
752
|
+
title: string | null;
|
|
753
|
+
pageAge: string | null;
|
|
754
|
+
encryptedContent: string;
|
|
755
|
+
}[]>;
|
|
658
756
|
/**
|
|
659
757
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
660
758
|
*
|
|
@@ -774,7 +872,7 @@ type AnthropicTool = {
|
|
|
774
872
|
name: string;
|
|
775
873
|
type: 'memory_20250818';
|
|
776
874
|
} | {
|
|
777
|
-
type: 'web_fetch_20250910';
|
|
875
|
+
type: 'web_fetch_20250910' | 'web_fetch_20260209';
|
|
778
876
|
name: string;
|
|
779
877
|
max_uses?: number;
|
|
780
878
|
allowed_domains?: string[];
|
|
@@ -785,7 +883,7 @@ type AnthropicTool = {
|
|
|
785
883
|
max_content_tokens?: number;
|
|
786
884
|
cache_control: AnthropicCacheControl | undefined;
|
|
787
885
|
} | {
|
|
788
|
-
type: 'web_search_20250305';
|
|
886
|
+
type: 'web_search_20250305' | 'web_search_20260209';
|
|
789
887
|
name: string;
|
|
790
888
|
max_uses?: number;
|
|
791
889
|
allowed_domains?: string[];
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -619,6 +619,68 @@ declare const anthropicTools: {
|
|
|
619
619
|
};
|
|
620
620
|
retrievedAt: string | null;
|
|
621
621
|
}>;
|
|
622
|
+
/**
|
|
623
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
624
|
+
*
|
|
625
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
626
|
+
* @param allowedDomains - Only fetch from these domains
|
|
627
|
+
* @param blockedDomains - Never fetch from these domains
|
|
628
|
+
* @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.
|
|
629
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
630
|
+
*/
|
|
631
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
632
|
+
url: string;
|
|
633
|
+
}, {
|
|
634
|
+
type: "web_fetch_result";
|
|
635
|
+
url: string;
|
|
636
|
+
content: {
|
|
637
|
+
type: "document";
|
|
638
|
+
title: string | null;
|
|
639
|
+
citations?: {
|
|
640
|
+
enabled: boolean;
|
|
641
|
+
};
|
|
642
|
+
source: {
|
|
643
|
+
type: "base64";
|
|
644
|
+
mediaType: "application/pdf";
|
|
645
|
+
data: string;
|
|
646
|
+
} | {
|
|
647
|
+
type: "text";
|
|
648
|
+
mediaType: "text/plain";
|
|
649
|
+
data: string;
|
|
650
|
+
};
|
|
651
|
+
};
|
|
652
|
+
retrievedAt: string | null;
|
|
653
|
+
}, {
|
|
654
|
+
maxUses?: number;
|
|
655
|
+
allowedDomains?: string[];
|
|
656
|
+
blockedDomains?: string[];
|
|
657
|
+
citations?: {
|
|
658
|
+
enabled: boolean;
|
|
659
|
+
};
|
|
660
|
+
maxContentTokens?: number;
|
|
661
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
662
|
+
url: string;
|
|
663
|
+
}, {
|
|
664
|
+
type: "web_fetch_result";
|
|
665
|
+
url: string;
|
|
666
|
+
content: {
|
|
667
|
+
type: "document";
|
|
668
|
+
title: string | null;
|
|
669
|
+
citations?: {
|
|
670
|
+
enabled: boolean;
|
|
671
|
+
};
|
|
672
|
+
source: {
|
|
673
|
+
type: "base64";
|
|
674
|
+
mediaType: "application/pdf";
|
|
675
|
+
data: string;
|
|
676
|
+
} | {
|
|
677
|
+
type: "text";
|
|
678
|
+
mediaType: "text/plain";
|
|
679
|
+
data: string;
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
retrievedAt: string | null;
|
|
683
|
+
}>;
|
|
622
684
|
/**
|
|
623
685
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
624
686
|
*
|
|
@@ -655,6 +717,42 @@ declare const anthropicTools: {
|
|
|
655
717
|
pageAge: string | null;
|
|
656
718
|
encryptedContent: string;
|
|
657
719
|
}[]>;
|
|
720
|
+
/**
|
|
721
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
722
|
+
*
|
|
723
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
724
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
725
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
726
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
727
|
+
*/
|
|
728
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
729
|
+
query: string;
|
|
730
|
+
}, {
|
|
731
|
+
type: "web_search_result";
|
|
732
|
+
url: string;
|
|
733
|
+
title: string | null;
|
|
734
|
+
pageAge: string | null;
|
|
735
|
+
encryptedContent: string;
|
|
736
|
+
}[], {
|
|
737
|
+
maxUses?: number;
|
|
738
|
+
allowedDomains?: string[];
|
|
739
|
+
blockedDomains?: string[];
|
|
740
|
+
userLocation?: {
|
|
741
|
+
type: "approximate";
|
|
742
|
+
city?: string;
|
|
743
|
+
region?: string;
|
|
744
|
+
country?: string;
|
|
745
|
+
timezone?: string;
|
|
746
|
+
};
|
|
747
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
748
|
+
query: string;
|
|
749
|
+
}, {
|
|
750
|
+
type: "web_search_result";
|
|
751
|
+
url: string;
|
|
752
|
+
title: string | null;
|
|
753
|
+
pageAge: string | null;
|
|
754
|
+
encryptedContent: string;
|
|
755
|
+
}[]>;
|
|
658
756
|
/**
|
|
659
757
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
660
758
|
*
|
|
@@ -774,7 +872,7 @@ type AnthropicTool = {
|
|
|
774
872
|
name: string;
|
|
775
873
|
type: 'memory_20250818';
|
|
776
874
|
} | {
|
|
777
|
-
type: 'web_fetch_20250910';
|
|
875
|
+
type: 'web_fetch_20250910' | 'web_fetch_20260209';
|
|
778
876
|
name: string;
|
|
779
877
|
max_uses?: number;
|
|
780
878
|
allowed_domains?: string[];
|
|
@@ -785,7 +883,7 @@ type AnthropicTool = {
|
|
|
785
883
|
max_content_tokens?: number;
|
|
786
884
|
cache_control: AnthropicCacheControl | undefined;
|
|
787
885
|
} | {
|
|
788
|
-
type: 'web_search_20250305';
|
|
886
|
+
type: 'web_search_20250305' | 'web_search_20260209';
|
|
789
887
|
name: string;
|
|
790
888
|
max_uses?: number;
|
|
791
889
|
allowed_domains?: string[];
|