@ai-sdk/anthropic 3.0.67 → 3.0.69
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 +12 -0
- package/README.md +2 -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 +1 -1
- 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
|
@@ -387,6 +387,9 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV3 {
|
|
|
387
387
|
...(anthropicOptions?.speed && {
|
|
388
388
|
speed: anthropicOptions.speed,
|
|
389
389
|
}),
|
|
390
|
+
...(anthropicOptions?.inferenceGeo && {
|
|
391
|
+
inference_geo: anthropicOptions.inferenceGeo,
|
|
392
|
+
}),
|
|
390
393
|
...(anthropicOptions?.cacheControl && {
|
|
391
394
|
cache_control: anthropicOptions.cacheControl,
|
|
392
395
|
}),
|
|
@@ -190,6 +190,16 @@ export const anthropicLanguageModelOptions = z.object({
|
|
|
190
190
|
*/
|
|
191
191
|
speed: z.enum(['fast', 'standard']).optional(),
|
|
192
192
|
|
|
193
|
+
/**
|
|
194
|
+
* Controls where model inference runs for this request.
|
|
195
|
+
*
|
|
196
|
+
* - `"global"`: Inference may run in any available geography (default).
|
|
197
|
+
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
198
|
+
*
|
|
199
|
+
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
200
|
+
*/
|
|
201
|
+
inferenceGeo: z.enum(['us', 'global']).optional(),
|
|
202
|
+
|
|
193
203
|
/**
|
|
194
204
|
* A set of beta features to enable.
|
|
195
205
|
* Allow a provider to receive the full `betas` set if it needs it.
|