@ai-sdk/anthropic 1.2.12 → 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 +244 -24
- package/dist/index.d.mts +101 -30
- package/dist/index.d.ts +101 -30
- package/dist/index.js +629 -347
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +634 -349
- package/dist/index.mjs.map +1 -1
- package/{internal/dist → dist/internal}/index.d.mts +12 -37
- package/{internal/dist → dist/internal}/index.d.ts +12 -37
- package/{internal/dist → dist/internal}/index.js +611 -338
- package/dist/internal/index.js.map +1 -0
- package/{internal/dist → dist/internal}/index.mjs +615 -340
- package/dist/internal/index.mjs.map +1 -0
- package/internal.d.ts +1 -0
- package/package.json +18 -16
- package/internal/dist/index.js.map +0 -1
- package/internal/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,60 +1,280 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.0-alpha.10
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Updated dependencies [c4df419]
|
|
8
|
+
- @ai-sdk/provider@2.0.0-alpha.10
|
|
9
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.10
|
|
8
10
|
|
|
9
|
-
##
|
|
11
|
+
## 2.0.0-alpha.9
|
|
10
12
|
|
|
11
13
|
### Patch Changes
|
|
12
14
|
|
|
13
|
-
-
|
|
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
|
|
15
19
|
|
|
16
|
-
##
|
|
20
|
+
## 2.0.0-alpha.8
|
|
17
21
|
|
|
18
22
|
### Patch Changes
|
|
19
23
|
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
23
30
|
|
|
24
|
-
##
|
|
31
|
+
## 2.0.0-alpha.7
|
|
25
32
|
|
|
26
33
|
### Patch Changes
|
|
27
34
|
|
|
28
|
-
-
|
|
35
|
+
- Updated dependencies [5c56081]
|
|
36
|
+
- @ai-sdk/provider@2.0.0-alpha.7
|
|
37
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.7
|
|
29
38
|
|
|
30
|
-
##
|
|
39
|
+
## 2.0.0-alpha.6
|
|
31
40
|
|
|
32
41
|
### Patch Changes
|
|
33
42
|
|
|
34
|
-
- Updated dependencies [
|
|
35
|
-
- @ai-sdk/provider@
|
|
36
|
-
- @ai-sdk/provider-utils@
|
|
43
|
+
- Updated dependencies [0d2c085]
|
|
44
|
+
- @ai-sdk/provider@2.0.0-alpha.6
|
|
45
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.6
|
|
37
46
|
|
|
38
|
-
##
|
|
47
|
+
## 2.0.0-alpha.4
|
|
39
48
|
|
|
40
49
|
### Patch Changes
|
|
41
50
|
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
- @ai-sdk/provider@
|
|
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
|
|
45
55
|
|
|
46
|
-
##
|
|
56
|
+
## 2.0.0-alpha.3
|
|
47
57
|
|
|
48
58
|
### Patch Changes
|
|
49
59
|
|
|
50
|
-
- Updated dependencies [
|
|
51
|
-
- @ai-sdk/provider
|
|
60
|
+
- Updated dependencies [6b98118]
|
|
61
|
+
- @ai-sdk/provider@2.0.0-alpha.3
|
|
62
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.3
|
|
52
63
|
|
|
53
|
-
##
|
|
64
|
+
## 2.0.0-alpha.2
|
|
54
65
|
|
|
55
66
|
### Patch Changes
|
|
56
67
|
|
|
57
|
-
-
|
|
68
|
+
- Updated dependencies [26535e0]
|
|
69
|
+
- @ai-sdk/provider@2.0.0-alpha.2
|
|
70
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.2
|
|
71
|
+
|
|
72
|
+
## 2.0.0-alpha.1
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [3f2f00c]
|
|
77
|
+
- @ai-sdk/provider@2.0.0-alpha.1
|
|
78
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.1
|
|
79
|
+
|
|
80
|
+
## 2.0.0-canary.19
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [faf8446]
|
|
85
|
+
- @ai-sdk/provider-utils@3.0.0-canary.19
|
|
86
|
+
|
|
87
|
+
## 2.0.0-canary.18
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- Updated dependencies [40acf9b]
|
|
92
|
+
- @ai-sdk/provider-utils@3.0.0-canary.18
|
|
93
|
+
|
|
94
|
+
## 2.0.0-canary.17
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies [ea7a7c9]
|
|
99
|
+
- @ai-sdk/provider-utils@3.0.0-canary.17
|
|
100
|
+
|
|
101
|
+
## 2.0.0-canary.16
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- Updated dependencies [87b828f]
|
|
106
|
+
- @ai-sdk/provider-utils@3.0.0-canary.16
|
|
107
|
+
|
|
108
|
+
## 2.0.0-canary.15
|
|
109
|
+
|
|
110
|
+
### Patch Changes
|
|
111
|
+
|
|
112
|
+
- Updated dependencies [a571d6e]
|
|
113
|
+
- Updated dependencies [a8c8bd5]
|
|
114
|
+
- Updated dependencies [7979f7f]
|
|
115
|
+
- Updated dependencies [41fa418]
|
|
116
|
+
- @ai-sdk/provider-utils@3.0.0-canary.15
|
|
117
|
+
- @ai-sdk/provider@2.0.0-canary.14
|
|
118
|
+
|
|
119
|
+
## 2.0.0-canary.14
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [957b739]
|
|
124
|
+
- Updated dependencies [9bd5ab5]
|
|
125
|
+
- @ai-sdk/provider-utils@3.0.0-canary.14
|
|
126
|
+
- @ai-sdk/provider@2.0.0-canary.13
|
|
127
|
+
|
|
128
|
+
## 2.0.0-canary.13
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- Updated dependencies [7b3ae3f]
|
|
133
|
+
- Updated dependencies [0ff02bb]
|
|
134
|
+
- @ai-sdk/provider@2.0.0-canary.12
|
|
135
|
+
- @ai-sdk/provider-utils@3.0.0-canary.13
|
|
136
|
+
|
|
137
|
+
## 2.0.0-canary.12
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- 5c9eec4: chore(providers/anthropic): switch to providerOptions
|
|
142
|
+
- Updated dependencies [9bf7291]
|
|
143
|
+
- Updated dependencies [4617fab]
|
|
144
|
+
- Updated dependencies [e030615]
|
|
145
|
+
- @ai-sdk/provider@2.0.0-canary.11
|
|
146
|
+
- @ai-sdk/provider-utils@3.0.0-canary.12
|
|
147
|
+
|
|
148
|
+
## 2.0.0-canary.11
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- 66962ed: fix(packages): export node10 compatible types
|
|
153
|
+
- Updated dependencies [66962ed]
|
|
154
|
+
- Updated dependencies [9301f86]
|
|
155
|
+
- Updated dependencies [a3f768e]
|
|
156
|
+
- @ai-sdk/provider-utils@3.0.0-canary.11
|
|
157
|
+
- @ai-sdk/provider@2.0.0-canary.10
|
|
158
|
+
|
|
159
|
+
## 2.0.0-canary.10
|
|
160
|
+
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- Updated dependencies [e86be6f]
|
|
164
|
+
- @ai-sdk/provider@2.0.0-canary.9
|
|
165
|
+
- @ai-sdk/provider-utils@3.0.0-canary.10
|
|
166
|
+
|
|
167
|
+
## 2.0.0-canary.9
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [95857aa]
|
|
172
|
+
- Updated dependencies [7ea4132]
|
|
173
|
+
- @ai-sdk/provider@2.0.0-canary.8
|
|
174
|
+
- @ai-sdk/provider-utils@3.0.0-canary.9
|
|
175
|
+
|
|
176
|
+
## 2.0.0-canary.8
|
|
177
|
+
|
|
178
|
+
### Patch Changes
|
|
179
|
+
|
|
180
|
+
- Updated dependencies [5d142ab]
|
|
181
|
+
- Updated dependencies [b6b43c7]
|
|
182
|
+
- Updated dependencies [8aa9e20]
|
|
183
|
+
- Updated dependencies [3795467]
|
|
184
|
+
- @ai-sdk/provider-utils@3.0.0-canary.8
|
|
185
|
+
- @ai-sdk/provider@2.0.0-canary.7
|
|
186
|
+
|
|
187
|
+
## 2.0.0-canary.7
|
|
188
|
+
|
|
189
|
+
### Patch Changes
|
|
190
|
+
|
|
191
|
+
- Updated dependencies [26735b5]
|
|
192
|
+
- Updated dependencies [443d8ec]
|
|
193
|
+
- Updated dependencies [14c9410]
|
|
194
|
+
- Updated dependencies [d9c98f4]
|
|
195
|
+
- Updated dependencies [c4a2fec]
|
|
196
|
+
- Updated dependencies [0054544]
|
|
197
|
+
- Updated dependencies [9e9c809]
|
|
198
|
+
- Updated dependencies [32831c6]
|
|
199
|
+
- Updated dependencies [d0f9495]
|
|
200
|
+
- Updated dependencies [fd65bc6]
|
|
201
|
+
- Updated dependencies [393138b]
|
|
202
|
+
- Updated dependencies [7182d14]
|
|
203
|
+
- @ai-sdk/provider@2.0.0-canary.6
|
|
204
|
+
- @ai-sdk/provider-utils@3.0.0-canary.7
|
|
205
|
+
|
|
206
|
+
## 2.0.0-canary.6
|
|
207
|
+
|
|
208
|
+
### Patch Changes
|
|
209
|
+
|
|
210
|
+
- f10304b: feat(tool-calling): don't require the user to have to pass parameters
|
|
211
|
+
- Updated dependencies [411e483]
|
|
212
|
+
- Updated dependencies [79457bd]
|
|
213
|
+
- Updated dependencies [ad80501]
|
|
214
|
+
- Updated dependencies [1766ede]
|
|
215
|
+
- Updated dependencies [f10304b]
|
|
216
|
+
- @ai-sdk/provider@2.0.0-canary.5
|
|
217
|
+
- @ai-sdk/provider-utils@3.0.0-canary.6
|
|
218
|
+
|
|
219
|
+
## 2.0.0-canary.5
|
|
220
|
+
|
|
221
|
+
### Patch Changes
|
|
222
|
+
|
|
223
|
+
- Updated dependencies [6f6bb89]
|
|
224
|
+
- @ai-sdk/provider@2.0.0-canary.4
|
|
225
|
+
- @ai-sdk/provider-utils@3.0.0-canary.5
|
|
226
|
+
|
|
227
|
+
## 2.0.0-canary.4
|
|
228
|
+
|
|
229
|
+
### Patch Changes
|
|
230
|
+
|
|
231
|
+
- Updated dependencies [d1a1aa1]
|
|
232
|
+
- @ai-sdk/provider@2.0.0-canary.3
|
|
233
|
+
- @ai-sdk/provider-utils@3.0.0-canary.4
|
|
234
|
+
|
|
235
|
+
## 2.0.0-canary.3
|
|
236
|
+
|
|
237
|
+
### Patch Changes
|
|
238
|
+
|
|
239
|
+
- 61ab528: Add support for URL-based PDF documents in the Anthropic provider
|
|
240
|
+
- Updated dependencies [a166433]
|
|
241
|
+
- Updated dependencies [abf9a79]
|
|
242
|
+
- Updated dependencies [9f95b35]
|
|
243
|
+
- Updated dependencies [0a87932]
|
|
244
|
+
- Updated dependencies [6dc848c]
|
|
245
|
+
- @ai-sdk/provider-utils@3.0.0-canary.3
|
|
246
|
+
- @ai-sdk/provider@2.0.0-canary.2
|
|
247
|
+
|
|
248
|
+
## 2.0.0-canary.2
|
|
249
|
+
|
|
250
|
+
### Patch Changes
|
|
251
|
+
|
|
252
|
+
- Updated dependencies [c57e248]
|
|
253
|
+
- Updated dependencies [33f4a6a]
|
|
254
|
+
- @ai-sdk/provider@2.0.0-canary.1
|
|
255
|
+
- @ai-sdk/provider-utils@3.0.0-canary.2
|
|
256
|
+
|
|
257
|
+
## 2.0.0-canary.1
|
|
258
|
+
|
|
259
|
+
### Patch Changes
|
|
260
|
+
|
|
261
|
+
- Updated dependencies [060370c]
|
|
262
|
+
- Updated dependencies [0c0c0b3]
|
|
263
|
+
- Updated dependencies [63d791d]
|
|
264
|
+
- @ai-sdk/provider-utils@3.0.0-canary.1
|
|
265
|
+
|
|
266
|
+
## 2.0.0-canary.0
|
|
267
|
+
|
|
268
|
+
### Major Changes
|
|
269
|
+
|
|
270
|
+
- d5f588f: AI SDK 5
|
|
271
|
+
|
|
272
|
+
### Patch Changes
|
|
273
|
+
|
|
274
|
+
- 91715e5: fix (provider/google-vertex): fix anthropic support for image urls in messages
|
|
275
|
+
- Updated dependencies [d5f588f]
|
|
276
|
+
- @ai-sdk/provider-utils@3.0.0-canary.0
|
|
277
|
+
- @ai-sdk/provider@2.0.0-canary.0
|
|
58
278
|
|
|
59
279
|
## 1.2.4
|
|
60
280
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
|
|
3
|
+
import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
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
|
-
|
|
7
|
-
/**
|
|
8
|
-
Enable Anthropic cache control. This will allow you to use provider-specific
|
|
9
|
-
`cacheControl` metadata.
|
|
10
|
-
|
|
11
|
-
@deprecated cache control is now enabled by default (meaning you are able to
|
|
12
|
-
optionally mark content for caching) and this setting is no longer needed.
|
|
13
|
-
*/
|
|
14
|
-
cacheControl?: boolean;
|
|
6
|
+
declare const anthropicProviderOptions: z.ZodObject<{
|
|
15
7
|
/**
|
|
16
8
|
Include reasoning content in requests sent to the model. Defaults to `true`.
|
|
17
9
|
|
|
18
10
|
If you are experiencing issues with the model handling requests involving
|
|
19
|
-
reasoning content, you can set this to `false` to omit them from the request.
|
|
20
11
|
*/
|
|
21
|
-
sendReasoning
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare const anthropicProviderOptionsSchema: z.ZodObject<{
|
|
12
|
+
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
25
13
|
thinking: z.ZodOptional<z.ZodObject<{
|
|
26
14
|
type: z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
|
|
27
15
|
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -32,30 +20,113 @@ declare const anthropicProviderOptionsSchema: z.ZodObject<{
|
|
|
32
20
|
type: "enabled" | "disabled";
|
|
33
21
|
budgetTokens?: number | undefined;
|
|
34
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
|
+
}>>;
|
|
35
88
|
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
sendReasoning?: boolean | undefined;
|
|
36
90
|
thinking?: {
|
|
37
91
|
type: "enabled" | "disabled";
|
|
38
92
|
budgetTokens?: number | undefined;
|
|
39
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;
|
|
40
106
|
}, {
|
|
107
|
+
sendReasoning?: boolean | undefined;
|
|
41
108
|
thinking?: {
|
|
42
109
|
type: "enabled" | "disabled";
|
|
43
110
|
budgetTokens?: number | undefined;
|
|
44
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;
|
|
45
124
|
}>;
|
|
46
|
-
type AnthropicProviderOptions = z.infer<typeof
|
|
125
|
+
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
47
126
|
|
|
48
127
|
type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
|
|
49
128
|
abortSignal?: AbortSignal;
|
|
50
129
|
}) => Promise<RESULT>);
|
|
51
|
-
type ToolResultContent = Array<{
|
|
52
|
-
type: 'text';
|
|
53
|
-
text: string;
|
|
54
|
-
} | {
|
|
55
|
-
type: 'image';
|
|
56
|
-
data: string;
|
|
57
|
-
mimeType?: string;
|
|
58
|
-
}>;
|
|
59
130
|
declare const Bash20241022Parameters: z.ZodObject<{
|
|
60
131
|
command: z.ZodString;
|
|
61
132
|
restart: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -440,23 +511,23 @@ declare const anthropicTools: {
|
|
|
440
511
|
computer_20250124: typeof computerTool_20250124;
|
|
441
512
|
};
|
|
442
513
|
|
|
443
|
-
interface AnthropicProvider extends
|
|
514
|
+
interface AnthropicProvider extends ProviderV2 {
|
|
444
515
|
/**
|
|
445
516
|
Creates a model for text generation.
|
|
446
517
|
*/
|
|
447
|
-
(modelId: AnthropicMessagesModelId
|
|
518
|
+
(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
448
519
|
/**
|
|
449
520
|
Creates a model for text generation.
|
|
450
521
|
*/
|
|
451
|
-
languageModel(modelId: AnthropicMessagesModelId
|
|
522
|
+
languageModel(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
452
523
|
/**
|
|
453
524
|
@deprecated Use `.languageModel()` instead.
|
|
454
525
|
*/
|
|
455
|
-
chat(modelId: AnthropicMessagesModelId
|
|
526
|
+
chat(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
456
527
|
/**
|
|
457
528
|
@deprecated Use `.languageModel()` instead.
|
|
458
529
|
*/
|
|
459
|
-
messages(modelId: AnthropicMessagesModelId
|
|
530
|
+
messages(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
460
531
|
/**
|
|
461
532
|
Anthropic-specific computer use tool.
|
|
462
533
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
|
|
3
|
+
import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
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
|
-
|
|
7
|
-
/**
|
|
8
|
-
Enable Anthropic cache control. This will allow you to use provider-specific
|
|
9
|
-
`cacheControl` metadata.
|
|
10
|
-
|
|
11
|
-
@deprecated cache control is now enabled by default (meaning you are able to
|
|
12
|
-
optionally mark content for caching) and this setting is no longer needed.
|
|
13
|
-
*/
|
|
14
|
-
cacheControl?: boolean;
|
|
6
|
+
declare const anthropicProviderOptions: z.ZodObject<{
|
|
15
7
|
/**
|
|
16
8
|
Include reasoning content in requests sent to the model. Defaults to `true`.
|
|
17
9
|
|
|
18
10
|
If you are experiencing issues with the model handling requests involving
|
|
19
|
-
reasoning content, you can set this to `false` to omit them from the request.
|
|
20
11
|
*/
|
|
21
|
-
sendReasoning
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare const anthropicProviderOptionsSchema: z.ZodObject<{
|
|
12
|
+
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
25
13
|
thinking: z.ZodOptional<z.ZodObject<{
|
|
26
14
|
type: z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
|
|
27
15
|
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -32,30 +20,113 @@ declare const anthropicProviderOptionsSchema: z.ZodObject<{
|
|
|
32
20
|
type: "enabled" | "disabled";
|
|
33
21
|
budgetTokens?: number | undefined;
|
|
34
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
|
+
}>>;
|
|
35
88
|
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
sendReasoning?: boolean | undefined;
|
|
36
90
|
thinking?: {
|
|
37
91
|
type: "enabled" | "disabled";
|
|
38
92
|
budgetTokens?: number | undefined;
|
|
39
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;
|
|
40
106
|
}, {
|
|
107
|
+
sendReasoning?: boolean | undefined;
|
|
41
108
|
thinking?: {
|
|
42
109
|
type: "enabled" | "disabled";
|
|
43
110
|
budgetTokens?: number | undefined;
|
|
44
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;
|
|
45
124
|
}>;
|
|
46
|
-
type AnthropicProviderOptions = z.infer<typeof
|
|
125
|
+
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
47
126
|
|
|
48
127
|
type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
|
|
49
128
|
abortSignal?: AbortSignal;
|
|
50
129
|
}) => Promise<RESULT>);
|
|
51
|
-
type ToolResultContent = Array<{
|
|
52
|
-
type: 'text';
|
|
53
|
-
text: string;
|
|
54
|
-
} | {
|
|
55
|
-
type: 'image';
|
|
56
|
-
data: string;
|
|
57
|
-
mimeType?: string;
|
|
58
|
-
}>;
|
|
59
130
|
declare const Bash20241022Parameters: z.ZodObject<{
|
|
60
131
|
command: z.ZodString;
|
|
61
132
|
restart: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -440,23 +511,23 @@ declare const anthropicTools: {
|
|
|
440
511
|
computer_20250124: typeof computerTool_20250124;
|
|
441
512
|
};
|
|
442
513
|
|
|
443
|
-
interface AnthropicProvider extends
|
|
514
|
+
interface AnthropicProvider extends ProviderV2 {
|
|
444
515
|
/**
|
|
445
516
|
Creates a model for text generation.
|
|
446
517
|
*/
|
|
447
|
-
(modelId: AnthropicMessagesModelId
|
|
518
|
+
(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
448
519
|
/**
|
|
449
520
|
Creates a model for text generation.
|
|
450
521
|
*/
|
|
451
|
-
languageModel(modelId: AnthropicMessagesModelId
|
|
522
|
+
languageModel(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
452
523
|
/**
|
|
453
524
|
@deprecated Use `.languageModel()` instead.
|
|
454
525
|
*/
|
|
455
|
-
chat(modelId: AnthropicMessagesModelId
|
|
526
|
+
chat(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
456
527
|
/**
|
|
457
528
|
@deprecated Use `.languageModel()` instead.
|
|
458
529
|
*/
|
|
459
|
-
messages(modelId: AnthropicMessagesModelId
|
|
530
|
+
messages(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
460
531
|
/**
|
|
461
532
|
Anthropic-specific computer use tool.
|
|
462
533
|
*/
|