@ai-sdk/anthropic 4.0.0-beta.23 → 4.0.0-beta.25
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 +13 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +12 -0
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +12 -0
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +25 -0
- package/package.json +2 -2
- package/src/anthropic-messages-language-model.ts +3 -0
- package/src/anthropic-messages-options.ts +10 -0
package/docs/05-anthropic.mdx
CHANGED
|
@@ -130,6 +130,10 @@ The following optional provider options are available for Anthropic models:
|
|
|
130
130
|
|
|
131
131
|
Optional. See [Fast Mode section](#fast-mode) for more details.
|
|
132
132
|
|
|
133
|
+
- `inferenceGeo` _"us" | "global"_
|
|
134
|
+
|
|
135
|
+
Optional. See [Data Residency section](#data-residency) for more details.
|
|
136
|
+
|
|
133
137
|
- `thinking` _object_
|
|
134
138
|
|
|
135
139
|
Optional. See [Reasoning section](#reasoning) for more details.
|
|
@@ -224,6 +228,27 @@ const { text } = await generateText({
|
|
|
224
228
|
|
|
225
229
|
The `speed` option accepts `'fast'` or `'standard'` (default behavior).
|
|
226
230
|
|
|
231
|
+
### Data Residency
|
|
232
|
+
|
|
233
|
+
Anthropic supports an [`inferenceGeo` option](https://platform.claude.com/docs/en/build-with-claude/data-residency) that controls where model inference runs for a request.
|
|
234
|
+
|
|
235
|
+
```ts highlight="8-10"
|
|
236
|
+
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
|
|
237
|
+
import { generateText } from 'ai';
|
|
238
|
+
|
|
239
|
+
const { text } = await generateText({
|
|
240
|
+
model: anthropic('claude-opus-4-6'),
|
|
241
|
+
prompt: 'Summarize the key points of this document.',
|
|
242
|
+
providerOptions: {
|
|
243
|
+
anthropic: {
|
|
244
|
+
inferenceGeo: 'us',
|
|
245
|
+
} satisfies AnthropicLanguageModelOptions,
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The `inferenceGeo` option accepts `'us'` (US-only infrastructure) or `'global'` (default, any available geography).
|
|
251
|
+
|
|
227
252
|
### Reasoning
|
|
228
253
|
|
|
229
254
|
Anthropic models support extended thinking, where Claude shows its reasoning process before providing a final answer.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/anthropic",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.25",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@ai-sdk/provider": "4.0.0-beta.10",
|
|
40
|
-
"@ai-sdk/provider-utils": "5.0.0-beta.
|
|
40
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.17"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "20.17.24",
|
|
@@ -417,6 +417,9 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV4 {
|
|
|
417
417
|
...(anthropicOptions?.speed && {
|
|
418
418
|
speed: anthropicOptions.speed,
|
|
419
419
|
}),
|
|
420
|
+
...(anthropicOptions?.inferenceGeo && {
|
|
421
|
+
inference_geo: anthropicOptions.inferenceGeo,
|
|
422
|
+
}),
|
|
420
423
|
...(anthropicOptions?.cacheControl && {
|
|
421
424
|
cache_control: anthropicOptions.cacheControl,
|
|
422
425
|
}),
|
|
@@ -197,6 +197,16 @@ export const anthropicLanguageModelOptions = z.object({
|
|
|
197
197
|
*/
|
|
198
198
|
speed: z.enum(['fast', 'standard']).optional(),
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Controls where model inference runs for this request.
|
|
202
|
+
*
|
|
203
|
+
* - `"global"`: Inference may run in any available geography (default).
|
|
204
|
+
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
205
|
+
*
|
|
206
|
+
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
207
|
+
*/
|
|
208
|
+
inferenceGeo: z.enum(['us', 'global']).optional(),
|
|
209
|
+
|
|
200
210
|
/**
|
|
201
211
|
* A set of beta features to enable.
|
|
202
212
|
* Allow a provider to receive the full `betas` set if it needs it.
|