@ai-sdk/anthropic 4.0.54 → 4.0.56
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 +26 -0
- package/dist/index.d.ts +107 -1
- package/dist/index.js +662 -484
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +109 -2
- package/dist/internal/index.js +608 -435
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +91 -7
- package/package.json +3 -3
- package/src/anthropic-api.ts +8 -2
- package/src/anthropic-language-model.ts +14 -12
- package/src/anthropic-prepare-tools.ts +38 -0
- package/src/anthropic-provider.ts +10 -0
- package/src/anthropic-tools.ts +26 -0
- package/src/convert-to-anthropic-prompt.ts +8 -7
- package/src/tool/web-fetch-20260318.ts +159 -0
- package/src/tool/web-search_20260318.ts +143 -0
package/dist/internal/index.d.ts
CHANGED
|
@@ -399,7 +399,7 @@ type AnthropicTool = {
|
|
|
399
399
|
name: string;
|
|
400
400
|
type: 'memory_20250818';
|
|
401
401
|
} | {
|
|
402
|
-
type: 'web_fetch_20250910' | 'web_fetch_20260209';
|
|
402
|
+
type: 'web_fetch_20250910' | 'web_fetch_20260209' | 'web_fetch_20260318';
|
|
403
403
|
name: string;
|
|
404
404
|
max_uses?: number;
|
|
405
405
|
allowed_domains?: string[];
|
|
@@ -408,9 +408,11 @@ type AnthropicTool = {
|
|
|
408
408
|
enabled: boolean;
|
|
409
409
|
};
|
|
410
410
|
max_content_tokens?: number;
|
|
411
|
+
use_cache?: boolean;
|
|
412
|
+
response_inclusion?: 'full' | 'excluded';
|
|
411
413
|
cache_control: AnthropicCacheControl | undefined;
|
|
412
414
|
} | {
|
|
413
|
-
type: 'web_search_20250305' | 'web_search_20260209';
|
|
415
|
+
type: 'web_search_20250305' | 'web_search_20260209' | 'web_search_20260318';
|
|
414
416
|
name: string;
|
|
415
417
|
max_uses?: number;
|
|
416
418
|
allowed_domains?: string[];
|
|
@@ -422,6 +424,7 @@ type AnthropicTool = {
|
|
|
422
424
|
country?: string;
|
|
423
425
|
timezone?: string;
|
|
424
426
|
};
|
|
427
|
+
response_inclusion?: 'full' | 'excluded';
|
|
425
428
|
cache_control: AnthropicCacheControl | undefined;
|
|
426
429
|
} | {
|
|
427
430
|
type: 'tool_search_tool_regex_20251119';
|
|
@@ -1707,6 +1710,72 @@ declare const anthropicTools: {
|
|
|
1707
1710
|
};
|
|
1708
1711
|
retrievedAt: string | null;
|
|
1709
1712
|
}, {}>;
|
|
1713
|
+
/**
|
|
1714
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
1715
|
+
*
|
|
1716
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
1717
|
+
* @param allowedDomains - Only fetch from these domains
|
|
1718
|
+
* @param blockedDomains - Never fetch from these domains
|
|
1719
|
+
* @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.
|
|
1720
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
1721
|
+
* @param useCache - Whether cached content may be returned. Set to false to fetch fresh content.
|
|
1722
|
+
* @param responseInclusion - Whether result blocks consumed by completed code execution calls are returned. Defaults to "full".
|
|
1723
|
+
*/
|
|
1724
|
+
webFetch_20260318: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
1725
|
+
url: string;
|
|
1726
|
+
}, {
|
|
1727
|
+
type: "web_fetch_result";
|
|
1728
|
+
url: string;
|
|
1729
|
+
content: {
|
|
1730
|
+
type: "document";
|
|
1731
|
+
title: string | null;
|
|
1732
|
+
citations?: {
|
|
1733
|
+
enabled: boolean;
|
|
1734
|
+
};
|
|
1735
|
+
source: {
|
|
1736
|
+
type: "base64";
|
|
1737
|
+
mediaType: "application/pdf";
|
|
1738
|
+
data: string;
|
|
1739
|
+
} | {
|
|
1740
|
+
type: "text";
|
|
1741
|
+
mediaType: "text/plain";
|
|
1742
|
+
data: string;
|
|
1743
|
+
};
|
|
1744
|
+
};
|
|
1745
|
+
retrievedAt: string | null;
|
|
1746
|
+
}, {
|
|
1747
|
+
maxUses?: number;
|
|
1748
|
+
allowedDomains?: string[];
|
|
1749
|
+
blockedDomains?: string[];
|
|
1750
|
+
citations?: {
|
|
1751
|
+
enabled: boolean;
|
|
1752
|
+
};
|
|
1753
|
+
maxContentTokens?: number;
|
|
1754
|
+
useCache?: boolean;
|
|
1755
|
+
responseInclusion?: "full" | "excluded";
|
|
1756
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
1757
|
+
url: string;
|
|
1758
|
+
}, {
|
|
1759
|
+
type: "web_fetch_result";
|
|
1760
|
+
url: string;
|
|
1761
|
+
content: {
|
|
1762
|
+
type: "document";
|
|
1763
|
+
title: string | null;
|
|
1764
|
+
citations?: {
|
|
1765
|
+
enabled: boolean;
|
|
1766
|
+
};
|
|
1767
|
+
source: {
|
|
1768
|
+
type: "base64";
|
|
1769
|
+
mediaType: "application/pdf";
|
|
1770
|
+
data: string;
|
|
1771
|
+
} | {
|
|
1772
|
+
type: "text";
|
|
1773
|
+
mediaType: "text/plain";
|
|
1774
|
+
data: string;
|
|
1775
|
+
};
|
|
1776
|
+
};
|
|
1777
|
+
retrievedAt: string | null;
|
|
1778
|
+
}, {}>;
|
|
1710
1779
|
/**
|
|
1711
1780
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
1712
1781
|
*
|
|
@@ -1779,6 +1848,44 @@ declare const anthropicTools: {
|
|
|
1779
1848
|
pageAge: string | null;
|
|
1780
1849
|
encryptedContent: string;
|
|
1781
1850
|
}[], {}>;
|
|
1851
|
+
/**
|
|
1852
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
1853
|
+
*
|
|
1854
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
1855
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
1856
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
1857
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
1858
|
+
* @param responseInclusion - Whether result blocks consumed by completed code execution calls are returned. Defaults to "full".
|
|
1859
|
+
*/
|
|
1860
|
+
webSearch_20260318: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
1861
|
+
query: string;
|
|
1862
|
+
}, {
|
|
1863
|
+
type: "web_search_result";
|
|
1864
|
+
url: string;
|
|
1865
|
+
title: string | null;
|
|
1866
|
+
pageAge: string | null;
|
|
1867
|
+
encryptedContent: string;
|
|
1868
|
+
}[], {
|
|
1869
|
+
maxUses?: number;
|
|
1870
|
+
allowedDomains?: string[];
|
|
1871
|
+
blockedDomains?: string[];
|
|
1872
|
+
userLocation?: {
|
|
1873
|
+
type: "approximate";
|
|
1874
|
+
city?: string;
|
|
1875
|
+
region?: string;
|
|
1876
|
+
country?: string;
|
|
1877
|
+
timezone?: string;
|
|
1878
|
+
};
|
|
1879
|
+
responseInclusion?: "full" | "excluded";
|
|
1880
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
1881
|
+
query: string;
|
|
1882
|
+
}, {
|
|
1883
|
+
type: "web_search_result";
|
|
1884
|
+
url: string;
|
|
1885
|
+
title: string | null;
|
|
1886
|
+
pageAge: string | null;
|
|
1887
|
+
encryptedContent: string;
|
|
1888
|
+
}[], {}>;
|
|
1782
1889
|
/**
|
|
1783
1890
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
1784
1891
|
*
|