@ai-sdk/anthropic 2.0.0-alpha.1 → 2.0.0-alpha.10
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 +69 -0
- package/dist/index.d.mts +90 -1
- package/dist/index.d.ts +90 -1
- package/dist/index.js +307 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +310 -57
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -1
- package/dist/internal/index.d.ts +3 -1
- package/dist/internal/index.js +294 -48
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +296 -48
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [c4df419]
|
|
8
|
+
- @ai-sdk/provider@2.0.0-alpha.10
|
|
9
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.10
|
|
10
|
+
|
|
11
|
+
## 2.0.0-alpha.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 362b048: add web search tool support
|
|
16
|
+
- Updated dependencies [811dff3]
|
|
17
|
+
- @ai-sdk/provider@2.0.0-alpha.9
|
|
18
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.9
|
|
19
|
+
|
|
20
|
+
## 2.0.0-alpha.8
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- ad66c0e: feat (provider/anthropic): json response schema support via tool calls
|
|
25
|
+
- 075711d: fix (provider/anthropic): return stop finish reason for json output with tool
|
|
26
|
+
- Updated dependencies [4fef487]
|
|
27
|
+
- Updated dependencies [9222aeb]
|
|
28
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.8
|
|
29
|
+
- @ai-sdk/provider@2.0.0-alpha.8
|
|
30
|
+
|
|
31
|
+
## 2.0.0-alpha.7
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [5c56081]
|
|
36
|
+
- @ai-sdk/provider@2.0.0-alpha.7
|
|
37
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.7
|
|
38
|
+
|
|
39
|
+
## 2.0.0-alpha.6
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [0d2c085]
|
|
44
|
+
- @ai-sdk/provider@2.0.0-alpha.6
|
|
45
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.6
|
|
46
|
+
|
|
47
|
+
## 2.0.0-alpha.4
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- ca8aac6: feat (providers/anthropic): add claude v4 models
|
|
52
|
+
- Updated dependencies [dc714f3]
|
|
53
|
+
- @ai-sdk/provider@2.0.0-alpha.4
|
|
54
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.4
|
|
55
|
+
|
|
56
|
+
## 2.0.0-alpha.3
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [6b98118]
|
|
61
|
+
- @ai-sdk/provider@2.0.0-alpha.3
|
|
62
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.3
|
|
63
|
+
|
|
64
|
+
## 2.0.0-alpha.2
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [26535e0]
|
|
69
|
+
- @ai-sdk/provider@2.0.0-alpha.2
|
|
70
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.2
|
|
71
|
+
|
|
3
72
|
## 2.0.0-alpha.1
|
|
4
73
|
|
|
5
74
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
|
|
3
3
|
import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type AnthropicMessagesModelId = 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
|
|
5
|
+
type AnthropicMessagesModelId = 'claude-4-opus-20250514' | 'claude-4-sonnet-20250514' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
|
|
6
6
|
declare const anthropicProviderOptions: z.ZodObject<{
|
|
7
7
|
/**
|
|
8
8
|
Include reasoning content in requests sent to the model. Defaults to `true`.
|
|
@@ -20,18 +20,107 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
20
20
|
type: "enabled" | "disabled";
|
|
21
21
|
budgetTokens?: number | undefined;
|
|
22
22
|
}>>;
|
|
23
|
+
/**
|
|
24
|
+
* Web search tool configuration for Claude models that support it.
|
|
25
|
+
* When provided, automatically adds the web search tool to the request.
|
|
26
|
+
*/
|
|
27
|
+
webSearch: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
/**
|
|
29
|
+
* Limit the number of searches per request (optional)
|
|
30
|
+
* Defaults to 5 if not specified
|
|
31
|
+
*/
|
|
32
|
+
maxUses: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
/**
|
|
34
|
+
* Only include results from these domains (optional)
|
|
35
|
+
* Cannot be used with blockedDomains
|
|
36
|
+
*/
|
|
37
|
+
allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
38
|
+
/**
|
|
39
|
+
* Never include results from these domains (optional)
|
|
40
|
+
* Cannot be used with allowedDomains
|
|
41
|
+
*/
|
|
42
|
+
blockedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
/**
|
|
44
|
+
* Localize search results based on user location (optional)
|
|
45
|
+
*/
|
|
46
|
+
userLocation: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"approximate">;
|
|
48
|
+
city: z.ZodOptional<z.ZodString>;
|
|
49
|
+
region: z.ZodOptional<z.ZodString>;
|
|
50
|
+
country: z.ZodString;
|
|
51
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
type: "approximate";
|
|
54
|
+
country: string;
|
|
55
|
+
city?: string | undefined;
|
|
56
|
+
region?: string | undefined;
|
|
57
|
+
timezone?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
type: "approximate";
|
|
60
|
+
country: string;
|
|
61
|
+
city?: string | undefined;
|
|
62
|
+
region?: string | undefined;
|
|
63
|
+
timezone?: string | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
maxUses?: number | undefined;
|
|
67
|
+
allowedDomains?: string[] | undefined;
|
|
68
|
+
blockedDomains?: string[] | undefined;
|
|
69
|
+
userLocation?: {
|
|
70
|
+
type: "approximate";
|
|
71
|
+
country: string;
|
|
72
|
+
city?: string | undefined;
|
|
73
|
+
region?: string | undefined;
|
|
74
|
+
timezone?: string | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
maxUses?: number | undefined;
|
|
78
|
+
allowedDomains?: string[] | undefined;
|
|
79
|
+
blockedDomains?: string[] | undefined;
|
|
80
|
+
userLocation?: {
|
|
81
|
+
type: "approximate";
|
|
82
|
+
country: string;
|
|
83
|
+
city?: string | undefined;
|
|
84
|
+
region?: string | undefined;
|
|
85
|
+
timezone?: string | undefined;
|
|
86
|
+
} | undefined;
|
|
87
|
+
}>>;
|
|
23
88
|
}, "strip", z.ZodTypeAny, {
|
|
24
89
|
sendReasoning?: boolean | undefined;
|
|
25
90
|
thinking?: {
|
|
26
91
|
type: "enabled" | "disabled";
|
|
27
92
|
budgetTokens?: number | undefined;
|
|
28
93
|
} | undefined;
|
|
94
|
+
webSearch?: {
|
|
95
|
+
maxUses?: number | undefined;
|
|
96
|
+
allowedDomains?: string[] | undefined;
|
|
97
|
+
blockedDomains?: string[] | undefined;
|
|
98
|
+
userLocation?: {
|
|
99
|
+
type: "approximate";
|
|
100
|
+
country: string;
|
|
101
|
+
city?: string | undefined;
|
|
102
|
+
region?: string | undefined;
|
|
103
|
+
timezone?: string | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
} | undefined;
|
|
29
106
|
}, {
|
|
30
107
|
sendReasoning?: boolean | undefined;
|
|
31
108
|
thinking?: {
|
|
32
109
|
type: "enabled" | "disabled";
|
|
33
110
|
budgetTokens?: number | undefined;
|
|
34
111
|
} | undefined;
|
|
112
|
+
webSearch?: {
|
|
113
|
+
maxUses?: number | undefined;
|
|
114
|
+
allowedDomains?: string[] | undefined;
|
|
115
|
+
blockedDomains?: string[] | undefined;
|
|
116
|
+
userLocation?: {
|
|
117
|
+
type: "approximate";
|
|
118
|
+
country: string;
|
|
119
|
+
city?: string | undefined;
|
|
120
|
+
region?: string | undefined;
|
|
121
|
+
timezone?: string | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
} | undefined;
|
|
35
124
|
}>;
|
|
36
125
|
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
37
126
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
|
|
3
3
|
import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type AnthropicMessagesModelId = 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
|
|
5
|
+
type AnthropicMessagesModelId = 'claude-4-opus-20250514' | 'claude-4-sonnet-20250514' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
|
|
6
6
|
declare const anthropicProviderOptions: z.ZodObject<{
|
|
7
7
|
/**
|
|
8
8
|
Include reasoning content in requests sent to the model. Defaults to `true`.
|
|
@@ -20,18 +20,107 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
20
20
|
type: "enabled" | "disabled";
|
|
21
21
|
budgetTokens?: number | undefined;
|
|
22
22
|
}>>;
|
|
23
|
+
/**
|
|
24
|
+
* Web search tool configuration for Claude models that support it.
|
|
25
|
+
* When provided, automatically adds the web search tool to the request.
|
|
26
|
+
*/
|
|
27
|
+
webSearch: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
/**
|
|
29
|
+
* Limit the number of searches per request (optional)
|
|
30
|
+
* Defaults to 5 if not specified
|
|
31
|
+
*/
|
|
32
|
+
maxUses: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
/**
|
|
34
|
+
* Only include results from these domains (optional)
|
|
35
|
+
* Cannot be used with blockedDomains
|
|
36
|
+
*/
|
|
37
|
+
allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
38
|
+
/**
|
|
39
|
+
* Never include results from these domains (optional)
|
|
40
|
+
* Cannot be used with allowedDomains
|
|
41
|
+
*/
|
|
42
|
+
blockedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
/**
|
|
44
|
+
* Localize search results based on user location (optional)
|
|
45
|
+
*/
|
|
46
|
+
userLocation: z.ZodOptional<z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"approximate">;
|
|
48
|
+
city: z.ZodOptional<z.ZodString>;
|
|
49
|
+
region: z.ZodOptional<z.ZodString>;
|
|
50
|
+
country: z.ZodString;
|
|
51
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
type: "approximate";
|
|
54
|
+
country: string;
|
|
55
|
+
city?: string | undefined;
|
|
56
|
+
region?: string | undefined;
|
|
57
|
+
timezone?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
type: "approximate";
|
|
60
|
+
country: string;
|
|
61
|
+
city?: string | undefined;
|
|
62
|
+
region?: string | undefined;
|
|
63
|
+
timezone?: string | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
maxUses?: number | undefined;
|
|
67
|
+
allowedDomains?: string[] | undefined;
|
|
68
|
+
blockedDomains?: string[] | undefined;
|
|
69
|
+
userLocation?: {
|
|
70
|
+
type: "approximate";
|
|
71
|
+
country: string;
|
|
72
|
+
city?: string | undefined;
|
|
73
|
+
region?: string | undefined;
|
|
74
|
+
timezone?: string | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
maxUses?: number | undefined;
|
|
78
|
+
allowedDomains?: string[] | undefined;
|
|
79
|
+
blockedDomains?: string[] | undefined;
|
|
80
|
+
userLocation?: {
|
|
81
|
+
type: "approximate";
|
|
82
|
+
country: string;
|
|
83
|
+
city?: string | undefined;
|
|
84
|
+
region?: string | undefined;
|
|
85
|
+
timezone?: string | undefined;
|
|
86
|
+
} | undefined;
|
|
87
|
+
}>>;
|
|
23
88
|
}, "strip", z.ZodTypeAny, {
|
|
24
89
|
sendReasoning?: boolean | undefined;
|
|
25
90
|
thinking?: {
|
|
26
91
|
type: "enabled" | "disabled";
|
|
27
92
|
budgetTokens?: number | undefined;
|
|
28
93
|
} | undefined;
|
|
94
|
+
webSearch?: {
|
|
95
|
+
maxUses?: number | undefined;
|
|
96
|
+
allowedDomains?: string[] | undefined;
|
|
97
|
+
blockedDomains?: string[] | undefined;
|
|
98
|
+
userLocation?: {
|
|
99
|
+
type: "approximate";
|
|
100
|
+
country: string;
|
|
101
|
+
city?: string | undefined;
|
|
102
|
+
region?: string | undefined;
|
|
103
|
+
timezone?: string | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
} | undefined;
|
|
29
106
|
}, {
|
|
30
107
|
sendReasoning?: boolean | undefined;
|
|
31
108
|
thinking?: {
|
|
32
109
|
type: "enabled" | "disabled";
|
|
33
110
|
budgetTokens?: number | undefined;
|
|
34
111
|
} | undefined;
|
|
112
|
+
webSearch?: {
|
|
113
|
+
maxUses?: number | undefined;
|
|
114
|
+
allowedDomains?: string[] | undefined;
|
|
115
|
+
blockedDomains?: string[] | undefined;
|
|
116
|
+
userLocation?: {
|
|
117
|
+
type: "approximate";
|
|
118
|
+
country: string;
|
|
119
|
+
city?: string | undefined;
|
|
120
|
+
region?: string | undefined;
|
|
121
|
+
timezone?: string | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
} | undefined;
|
|
35
124
|
}>;
|
|
36
125
|
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
37
126
|
|