@ai-sdk/anthropic 4.0.0-beta.9 → 4.0.0-canary.44
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 +299 -4
- package/README.md +2 -0
- package/dist/index.d.ts +83 -58
- package/dist/index.js +2074 -1369
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +85 -58
- package/dist/internal/index.js +1835 -1355
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +116 -13
- package/package.json +13 -14
- package/src/{anthropic-messages-api.ts → anthropic-api.ts} +14 -6
- package/src/anthropic-error.ts +1 -1
- package/src/anthropic-files.ts +95 -0
- package/src/{anthropic-messages-options.ts → anthropic-language-model-options.ts} +68 -11
- package/src/{anthropic-messages-language-model.ts → anthropic-language-model.ts} +263 -78
- package/src/anthropic-message-metadata.ts +1 -4
- package/src/anthropic-prepare-tools.ts +14 -5
- package/src/anthropic-provider.ts +42 -13
- package/src/{convert-anthropic-messages-usage.ts → convert-anthropic-usage.ts} +4 -4
- package/src/{convert-to-anthropic-messages-prompt.ts → convert-to-anthropic-prompt.ts} +230 -166
- package/src/forward-anthropic-container-id-from-last-step.ts +2 -2
- package/src/get-cache-control.ts +5 -2
- package/src/index.ts +1 -1
- package/src/internal/index.ts +11 -2
- package/src/map-anthropic-stop-reason.ts +1 -1
- package/src/sanitize-json-schema.ts +203 -0
- package/src/skills/anthropic-skills-api.ts +44 -0
- package/src/skills/anthropic-skills.ts +132 -0
- package/src/tool/bash_20241022.ts +2 -2
- package/src/tool/bash_20250124.ts +2 -2
- package/src/tool/code-execution_20250522.ts +2 -2
- package/src/tool/code-execution_20250825.ts +2 -2
- package/src/tool/code-execution_20260120.ts +2 -2
- package/src/tool/computer_20241022.ts +2 -2
- package/src/tool/computer_20250124.ts +2 -2
- package/src/tool/computer_20251124.ts +2 -2
- package/src/tool/memory_20250818.ts +2 -2
- package/src/tool/text-editor_20241022.ts +2 -2
- package/src/tool/text-editor_20250124.ts +2 -2
- package/src/tool/text-editor_20250429.ts +2 -2
- package/src/tool/text-editor_20250728.ts +6 -3
- package/src/tool/tool-search-bm25_20251119.ts +2 -2
- package/src/tool/tool-search-regex_20251119.ts +2 -2
- package/src/tool/web-fetch-20250910.ts +2 -2
- package/src/tool/web-fetch-20260209.ts +2 -2
- package/src/tool/web-search_20250305.ts +2 -2
- package/src/tool/web-search_20260209.ts +2 -2
- package/dist/index.d.mts +0 -1090
- package/dist/index.mjs +0 -5242
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -969
- package/dist/internal/index.mjs +0 -5134
- package/dist/internal/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,300 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.44
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5463d0d: feat(provider): align tool result output content file part types with top-level message file part types
|
|
8
|
+
- Updated dependencies [5463d0d]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-canary.32
|
|
10
|
+
- @ai-sdk/provider@4.0.0-canary.16
|
|
11
|
+
|
|
12
|
+
## 4.0.0-canary.43
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 0c4c275: trigger initial canary release
|
|
17
|
+
- Updated dependencies [0c4c275]
|
|
18
|
+
- @ai-sdk/provider-utils@5.0.0-canary.31
|
|
19
|
+
- @ai-sdk/provider@4.0.0-canary.15
|
|
20
|
+
|
|
21
|
+
## 4.0.0-beta.42
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
|
|
26
|
+
|
|
27
|
+
For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [08d2129]
|
|
32
|
+
- @ai-sdk/provider-utils@5.0.0-beta.30
|
|
33
|
+
|
|
34
|
+
## 4.0.0-beta.41
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
|
|
39
|
+
- 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
|
|
40
|
+
- Updated dependencies [9bd6512]
|
|
41
|
+
- Updated dependencies [258c093]
|
|
42
|
+
- Updated dependencies [b6783da]
|
|
43
|
+
- @ai-sdk/provider-utils@5.0.0-beta.29
|
|
44
|
+
- @ai-sdk/provider@4.0.0-beta.14
|
|
45
|
+
|
|
46
|
+
## 4.0.0-beta.40
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- c012d57: feat(anthropic): sanitize the unsupported JSON schema validation properties
|
|
51
|
+
|
|
52
|
+
## 4.0.0-beta.39
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- 9f0e36c: trigger release for all packages after provenance setup
|
|
57
|
+
- Updated dependencies [9f0e36c]
|
|
58
|
+
- @ai-sdk/provider@4.0.0-beta.13
|
|
59
|
+
- @ai-sdk/provider-utils@5.0.0-beta.28
|
|
60
|
+
|
|
61
|
+
## 4.0.0-beta.38
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- 87d1723: chore(anthropic): remove unnecessary messages affix from Anthropic symbols and files
|
|
66
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
67
|
+
- Updated dependencies [785fe16]
|
|
68
|
+
- Updated dependencies [67df0a0]
|
|
69
|
+
- Updated dependencies [befb78c]
|
|
70
|
+
- Updated dependencies [0458559]
|
|
71
|
+
- Updated dependencies [5852c0a]
|
|
72
|
+
- Updated dependencies [fc92055]
|
|
73
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
74
|
+
|
|
75
|
+
## 4.0.0-beta.37
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [2e98477]
|
|
80
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
81
|
+
|
|
82
|
+
## 4.0.0-beta.36
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Updated dependencies [eea8d98]
|
|
87
|
+
- @ai-sdk/provider-utils@5.0.0-beta.25
|
|
88
|
+
|
|
89
|
+
## 4.0.0-beta.35
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- Updated dependencies [f807e45]
|
|
94
|
+
- @ai-sdk/provider-utils@5.0.0-beta.24
|
|
95
|
+
|
|
96
|
+
## 4.0.0-beta.34
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- Updated dependencies [350ea38]
|
|
101
|
+
- @ai-sdk/provider-utils@5.0.0-beta.23
|
|
102
|
+
|
|
103
|
+
## 4.0.0-beta.33
|
|
104
|
+
|
|
105
|
+
### Major Changes
|
|
106
|
+
|
|
107
|
+
- 832f86f: fix(anthropic): remove cacheCreationInputTokens from providerMetadata
|
|
108
|
+
|
|
109
|
+
## 4.0.0-beta.32
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- ad0b376: fix(provider/anthropic): stop adding `fine-grained-tool-streaming-2025-05-14` beta for `claude-opus-4-7`
|
|
114
|
+
|
|
115
|
+
## 4.0.0-beta.31
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Updated dependencies [083947b]
|
|
120
|
+
- @ai-sdk/provider-utils@5.0.0-beta.22
|
|
121
|
+
|
|
122
|
+
## 4.0.0-beta.30
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- 0d8f107: feat(provider/anthropic): add support for Opus 4.7 and relevant API enhancements
|
|
127
|
+
|
|
128
|
+
## 4.0.0-beta.29
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- Updated dependencies [add1126]
|
|
133
|
+
- @ai-sdk/provider-utils@5.0.0-beta.21
|
|
134
|
+
|
|
135
|
+
## 4.0.0-beta.28
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
140
|
+
|
|
141
|
+
**`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
|
|
142
|
+
|
|
143
|
+
**All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
|
|
144
|
+
|
|
145
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
146
|
+
|
|
147
|
+
- ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
|
|
148
|
+
- Updated dependencies [b3976a2]
|
|
149
|
+
- Updated dependencies [ff5eba1]
|
|
150
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
151
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
152
|
+
|
|
153
|
+
## 4.0.0-beta.27
|
|
154
|
+
|
|
155
|
+
### Major Changes
|
|
156
|
+
|
|
157
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [ef992f8]
|
|
162
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
163
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
164
|
+
|
|
165
|
+
## 4.0.0-beta.26
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
170
|
+
- Updated dependencies [90e2d8a]
|
|
171
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
172
|
+
|
|
173
|
+
## 4.0.0-beta.25
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- 09bd27b: feat (provider/anthropic): add support for inference_geo provider option
|
|
178
|
+
|
|
179
|
+
## 4.0.0-beta.24
|
|
180
|
+
|
|
181
|
+
### Patch Changes
|
|
182
|
+
|
|
183
|
+
- Updated dependencies [3ae1786]
|
|
184
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
185
|
+
|
|
186
|
+
## 4.0.0-beta.23
|
|
187
|
+
|
|
188
|
+
### Patch Changes
|
|
189
|
+
|
|
190
|
+
- Updated dependencies [176466a]
|
|
191
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
192
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
193
|
+
|
|
194
|
+
## 4.0.0-beta.22
|
|
195
|
+
|
|
196
|
+
### Patch Changes
|
|
197
|
+
|
|
198
|
+
- e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
|
|
199
|
+
- Updated dependencies [e311194]
|
|
200
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
201
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
202
|
+
|
|
203
|
+
## 4.0.0-beta.21
|
|
204
|
+
|
|
205
|
+
### Patch Changes
|
|
206
|
+
|
|
207
|
+
- 34bd95d: feat(ai): add support for uploading provider skills using the provider references abstraction
|
|
208
|
+
- Updated dependencies [34bd95d]
|
|
209
|
+
- Updated dependencies [008271d]
|
|
210
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
211
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
212
|
+
|
|
213
|
+
## 4.0.0-beta.20
|
|
214
|
+
|
|
215
|
+
### Patch Changes
|
|
216
|
+
|
|
217
|
+
- Updated dependencies [b0c2869]
|
|
218
|
+
- Updated dependencies [7e26e81]
|
|
219
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
220
|
+
|
|
221
|
+
## 4.0.0-beta.19
|
|
222
|
+
|
|
223
|
+
### Patch Changes
|
|
224
|
+
|
|
225
|
+
- Updated dependencies [46d1149]
|
|
226
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
227
|
+
|
|
228
|
+
## 4.0.0-beta.18
|
|
229
|
+
|
|
230
|
+
### Patch Changes
|
|
231
|
+
|
|
232
|
+
- 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
|
|
233
|
+
- Updated dependencies [6fd51c0]
|
|
234
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
235
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
236
|
+
|
|
237
|
+
## 4.0.0-beta.17
|
|
238
|
+
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
242
|
+
- Updated dependencies [c29a26f]
|
|
243
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
244
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
245
|
+
|
|
246
|
+
## 4.0.0-beta.16
|
|
247
|
+
|
|
248
|
+
### Patch Changes
|
|
249
|
+
|
|
250
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
251
|
+
|
|
252
|
+
## 4.0.0-beta.15
|
|
253
|
+
|
|
254
|
+
### Patch Changes
|
|
255
|
+
|
|
256
|
+
- f57c702: fix(anthropic): allow both temperature and topP for non-Anthropic models using the Anthropic-compatible API
|
|
257
|
+
|
|
258
|
+
The temperature/topP mutual exclusivity check now only applies to known Anthropic models (model IDs starting with `claude-`). Non-Anthropic models using the Anthropic-compatible API (e.g. Minimax) can now send both parameters as required by their APIs.
|
|
259
|
+
|
|
260
|
+
## 4.0.0-beta.14
|
|
261
|
+
|
|
262
|
+
### Patch Changes
|
|
263
|
+
|
|
264
|
+
- Updated dependencies [2e17091]
|
|
265
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
266
|
+
|
|
267
|
+
## 4.0.0-beta.13
|
|
268
|
+
|
|
269
|
+
### Patch Changes
|
|
270
|
+
|
|
271
|
+
- Updated dependencies [986c6fd]
|
|
272
|
+
- Updated dependencies [493295c]
|
|
273
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
274
|
+
|
|
275
|
+
## 4.0.0-beta.12
|
|
276
|
+
|
|
277
|
+
### Patch Changes
|
|
278
|
+
|
|
279
|
+
- Updated dependencies [1f509d4]
|
|
280
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
281
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
282
|
+
|
|
283
|
+
## 4.0.0-beta.11
|
|
284
|
+
|
|
285
|
+
### Patch Changes
|
|
286
|
+
|
|
287
|
+
- 0ee8aec: feat (provider/anthropic): support passing metadata.user_id
|
|
288
|
+
|
|
289
|
+
## 4.0.0-beta.10
|
|
290
|
+
|
|
291
|
+
### Patch Changes
|
|
292
|
+
|
|
293
|
+
- 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
|
|
294
|
+
- Updated dependencies [3887c70]
|
|
295
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
296
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
297
|
+
|
|
3
298
|
## 4.0.0-beta.9
|
|
4
299
|
|
|
5
300
|
### Patch Changes
|
|
@@ -489,13 +784,13 @@
|
|
|
489
784
|
Before
|
|
490
785
|
|
|
491
786
|
```ts
|
|
492
|
-
model.textEmbeddingModel(
|
|
787
|
+
model.textEmbeddingModel("my-model-id");
|
|
493
788
|
```
|
|
494
789
|
|
|
495
790
|
After
|
|
496
791
|
|
|
497
792
|
```ts
|
|
498
|
-
model.embeddingModel(
|
|
793
|
+
model.embeddingModel("my-model-id");
|
|
499
794
|
```
|
|
500
795
|
|
|
501
796
|
- f33a018: chore: add model ID for Haiku 4.5
|
|
@@ -835,13 +1130,13 @@
|
|
|
835
1130
|
Before
|
|
836
1131
|
|
|
837
1132
|
```ts
|
|
838
|
-
model.textEmbeddingModel(
|
|
1133
|
+
model.textEmbeddingModel("my-model-id");
|
|
839
1134
|
```
|
|
840
1135
|
|
|
841
1136
|
After
|
|
842
1137
|
|
|
843
1138
|
```ts
|
|
844
|
-
model.embeddingModel(
|
|
1139
|
+
model.embeddingModel("my-model-id");
|
|
845
1140
|
```
|
|
846
1141
|
|
|
847
1142
|
- Updated dependencies [8d9e8ad]
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
The **[Anthropic provider](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Anthropic Messages API](https://docs.anthropic.com/claude/reference/messages_post).
|
|
4
4
|
|
|
5
|
+
> **Deploying to Vercel?** With Vercel's AI Gateway you can access Anthropic (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
|
|
6
|
+
|
|
5
7
|
## Setup
|
|
6
8
|
|
|
7
9
|
The Anthropic provider is available in the `@ai-sdk/anthropic` module. You can install it with
|