@ai-sdk/anthropic 4.0.50 → 4.0.51

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 4.0.51
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [912fb01]
8
+ - @ai-sdk/provider@4.0.12
9
+ - @ai-sdk/provider-utils@5.0.38
10
+
3
11
  ## 4.0.50
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -7573,7 +7573,7 @@ var AnthropicSkills = class {
7573
7573
  };
7574
7574
 
7575
7575
  // src/version.ts
7576
- var VERSION = true ? "4.0.50" : "0.0.0-test";
7576
+ var VERSION = true ? "4.0.51" : "0.0.0-test";
7577
7577
 
7578
7578
  // src/anthropic-provider.ts
7579
7579
  var ANTHROPIC_API_URL = "https://api.anthropic.com";
@@ -144,65 +144,16 @@ The following optional provider options are available for Anthropic models:
144
144
  Optional. Metadata to include with the request. See the [Anthropic API documentation](https://platform.claude.com/docs/en/api/messages/create) for details.
145
145
  - `userId` _string_ - An external identifier for the end-user. Should be a UUID, hash, or other opaque identifier. Must not contain PII.
146
146
 
147
- ### Text Batches
147
+ ### Batch
148
148
 
149
149
  <Note type="warning">
150
- Text batch support is experimental and the API may change in patch releases.
150
+ Batch support is experimental and the API may change in patch releases.
151
151
  </Note>
152
152
 
153
153
  Anthropic language models support asynchronous text generation through the
154
154
  [Message Batches API](https://platform.claude.com/docs/en/build-with-claude/batch-processing).
155
- Use the experimental text batch APIs to start a batch, poll its status, and
156
- stream its results:
157
-
158
- ```ts
159
- import { anthropic } from '@ai-sdk/anthropic';
160
- import {
161
- experimental_getBatchResults as getBatchResults,
162
- experimental_getBatchStatus as getBatchStatus,
163
- experimental_startBatch as startBatch,
164
- } from 'ai';
165
- import { setTimeout } from 'node:timers/promises';
166
-
167
- const model = 'claude-haiku-4-5';
168
-
169
- const batch = await startBatch({
170
- provider: anthropic,
171
- requests: [
172
- {
173
- id: 'capital-france',
174
- type: 'text',
175
- model,
176
- prompt: 'What is the capital of France?',
177
- },
178
- {
179
- id: 'capital-germany',
180
- type: 'text',
181
- model: 'claude-sonnet-4-5',
182
- prompt: 'What is the capital of Germany?',
183
- },
184
- ],
185
- });
186
-
187
- let status = batch.status;
188
- while (status === 'pending') {
189
- await setTimeout(60_000);
190
- ({ status } = await getBatchStatus({ provider: anthropic, batch }));
191
- }
192
-
193
- for await (const item of getBatchResults({ provider: anthropic, batch })) {
194
- if (item.status === 'succeeded') {
195
- console.log(item.id, item.text);
196
- } else {
197
- console.error(item.id, item.error);
198
- }
199
- }
200
- ```
201
-
202
- `startBatch` returns a serializable batch reference. Persist this reference
203
- to check the batch status or retrieve its results from another process. Results
204
- can arrive in a different order from the input requests, so match each result by
205
- its `id`.
155
+ Pass the Anthropic provider to the AI SDK's [Batch](/docs/ai-sdk-core/batch)
156
+ API for the complete workflow, including polling, persistence, and result handling.
206
157
 
207
158
  Each request specifies its `type` and `model`. Anthropic supports using
208
159
  different text models within the same batch.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/anthropic",
3
- "version": "4.0.50",
3
+ "version": "4.0.51",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider": "4.0.11",
39
- "@ai-sdk/provider-utils": "5.0.37"
38
+ "@ai-sdk/provider": "4.0.12",
39
+ "@ai-sdk/provider-utils": "5.0.38"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@ai-sdk/test-server": "2.0.1",