@ai-sdk/anthropic 2.0.75 → 2.0.77

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.
@@ -1,7 +1,6 @@
1
1
  // src/anthropic-messages-language-model.ts
2
2
  import {
3
- APICallError,
4
- UnsupportedFunctionalityError as UnsupportedFunctionalityError3
3
+ APICallError
5
4
  } from "@ai-sdk/provider";
6
5
  import {
7
6
  combineHeaders,
@@ -709,6 +708,15 @@ var anthropicProviderOptions = z3.object({
709
708
  * Only supported with claude-opus-4-6.
710
709
  */
711
710
  speed: z3.enum(["fast", "standard"]).optional(),
711
+ /**
712
+ * Controls where model inference runs for this request.
713
+ *
714
+ * - `"global"`: Inference may run in any available geography (default).
715
+ * - `"us"`: Inference runs only in US-based infrastructure.
716
+ *
717
+ * See https://platform.claude.com/docs/en/build-with-claude/data-residency
718
+ */
719
+ inferenceGeo: z3.enum(["us", "global"]).optional(),
712
720
  /**
713
721
  * Context management configuration for automatic context window management.
714
722
  * Enables features like automatic compaction and clearing of tool uses/thinking blocks.
@@ -2144,6 +2152,9 @@ var AnthropicMessagesLanguageModel = class {
2144
2152
  ...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
2145
2153
  speed: anthropicOptions.speed
2146
2154
  },
2155
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
2156
+ inference_geo: anthropicOptions.inferenceGeo
2157
+ },
2147
2158
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
2148
2159
  cache_control: anthropicOptions.cacheControl
2149
2160
  },
@@ -2225,9 +2236,15 @@ var AnthropicMessagesLanguageModel = class {
2225
2236
  };
2226
2237
  if (isThinking) {
2227
2238
  if (thinkingType === "enabled" && thinkingBudget == null) {
2228
- throw new UnsupportedFunctionalityError3({
2229
- functionality: "thinking requires a budget"
2239
+ warnings.push({
2240
+ type: "other",
2241
+ message: "thinking budget is required when thinking is enabled. using default budget of 1024 tokens."
2230
2242
  });
2243
+ baseArgs.thinking = {
2244
+ type: "enabled",
2245
+ budget_tokens: 1024
2246
+ };
2247
+ thinkingBudget = 1024;
2231
2248
  }
2232
2249
  if (baseArgs.temperature != null) {
2233
2250
  baseArgs.temperature = void 0;