@ai-sdk/anthropic 2.0.100 → 2.0.101

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.
@@ -2,7 +2,7 @@ import { LanguageModelV2, JSONSchema7, SharedV2ProviderMetadata, LanguageModelV2
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-sonnet-5' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -2,7 +2,7 @@ import { LanguageModelV2, JSONSchema7, SharedV2ProviderMetadata, LanguageModelV2
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-sonnet-5' | (string & {});
5
+ type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
6
6
 
7
7
  type AnthropicMessagesConfig = {
8
8
  provider: string;
@@ -660,6 +660,19 @@ var anthropicFilePartProviderOptions = import_v43.z.object({
660
660
  context: import_v43.z.string().optional()
661
661
  });
662
662
  var anthropicSystemMessageProviderOptions = import_v43.z.object({
663
+ /**
664
+ * Controls when a mid-conversation system message is cleared.
665
+ *
666
+ * The value is forwarded to Anthropic as `clear_at`. The required
667
+ * `mid-conversation-system-clear-at-2026-08-21` beta is added automatically.
668
+ */
669
+ clearAt: import_v43.z.literal("next_user_message").optional(),
670
+ /**
671
+ * Overrides the effort for the turn following this mid-conversation system
672
+ * message. The required `mid-conversation-effort-2026-08-01` beta is added
673
+ * automatically.
674
+ */
675
+ effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
663
676
  /**
664
677
  * Mid-conversation tool changes. Adds or removes tools from the
665
678
  * conversation's tool set between turns without invalidating the prompt
@@ -687,6 +700,14 @@ var anthropicSystemMessageProviderOptions = import_v43.z.object({
687
700
  ])
688
701
  ).optional()
689
702
  });
703
+ var anthropicThinkingBlockBinding = import_v43.z.object({
704
+ /**
705
+ * Controls behavior when a replayed thinking block does not match its
706
+ * conversation prefix. The `drop_block` behavior drops the mismatched block
707
+ * instead of returning an invalid signature error.
708
+ */
709
+ prefixMismatchBehavior: import_v43.z.literal("drop_block")
710
+ });
690
711
  var anthropicProviderOptions = import_v43.z.object({
691
712
  /**
692
713
  * Whether to send reasoning to the model.
@@ -698,8 +719,8 @@ var anthropicProviderOptions = import_v43.z.object({
698
719
  * Determines how structured outputs are generated.
699
720
  *
700
721
  * - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
701
- * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default).
702
- * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool'.
722
+ * - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
723
+ * - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Fable 5.1).
703
724
  */
704
725
  structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
705
726
  /**
@@ -708,7 +729,7 @@ var anthropicProviderOptions = import_v43.z.object({
708
729
  * When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
709
730
  * Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
710
731
  */
711
- thinking: import_v43.z.discriminatedUnion("type", [
732
+ thinking: import_v43.z.union([
712
733
  import_v43.z.object({
713
734
  /** for Sonnet 4.6, Opus 4.6, and newer models */
714
735
  type: import_v43.z.literal("adaptive"),
@@ -716,16 +737,34 @@ var anthropicProviderOptions = import_v43.z.object({
716
737
  * Controls whether thinking content is included in the response.
717
738
  * - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
718
739
  * - `"summarized"`: Thinking content is returned. Required to see reasoning output.
740
+ * - `"updates"`: Thinking summaries are emitted between tool calls.
741
+ */
742
+ display: import_v43.z.enum(["omitted", "summarized", "updates"]).optional(),
743
+ /**
744
+ * Controls handling for thinking blocks whose conversation prefix no
745
+ * longer matches. Forwarded as `block_binding`.
719
746
  */
720
- display: import_v43.z.enum(["omitted", "summarized"]).optional()
747
+ blockBinding: anthropicThinkingBlockBinding.optional()
721
748
  }),
722
749
  import_v43.z.object({
723
750
  /** for models before Opus 4.6, except Sonnet 4.6 still supports it */
724
751
  type: import_v43.z.literal("enabled"),
725
- budgetTokens: import_v43.z.number().optional()
752
+ budgetTokens: import_v43.z.number().optional(),
753
+ /**
754
+ * Controls handling for thinking blocks whose conversation prefix no
755
+ * longer matches. Forwarded as `block_binding`.
756
+ */
757
+ blockBinding: anthropicThinkingBlockBinding.optional()
726
758
  }),
727
759
  import_v43.z.object({
728
760
  type: import_v43.z.literal("disabled")
761
+ }),
762
+ import_v43.z.object({
763
+ /**
764
+ * Configure prefix mismatch handling without changing the model's
765
+ * default thinking mode.
766
+ */
767
+ blockBinding: anthropicThinkingBlockBinding
729
768
  })
730
769
  ]).optional(),
731
770
  /**
@@ -1468,7 +1507,7 @@ async function convertToAnthropicMessagesPrompt({
1468
1507
  warnings,
1469
1508
  cacheControlValidator
1470
1509
  }) {
1471
- var _a, _b, _c, _d, _e, _f, _g;
1510
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1472
1511
  const betas = /* @__PURE__ */ new Set();
1473
1512
  const blocks = groupIntoBlocks(prompt);
1474
1513
  const validator = cacheControlValidator || new CacheControlValidator();
@@ -1502,6 +1541,8 @@ async function convertToAnthropicMessagesPrompt({
1502
1541
  case "system": {
1503
1542
  const content = [];
1504
1543
  let toolChangeCount = 0;
1544
+ let clearAt = void 0;
1545
+ let effort = void 0;
1505
1546
  for (const { content: text, providerOptions } of block.messages) {
1506
1547
  const systemMessageOptions = await (0, import_provider_utils9.parseProviderOptions)({
1507
1548
  provider: "anthropic",
@@ -1509,7 +1550,9 @@ async function convertToAnthropicMessagesPrompt({
1509
1550
  schema: anthropicSystemMessageProviderOptions
1510
1551
  });
1511
1552
  const toolChanges = (_a = systemMessageOptions == null ? void 0 : systemMessageOptions.toolChanges) != null ? _a : [];
1512
- if (text !== "" || toolChanges.length === 0) {
1553
+ clearAt = (_b = systemMessageOptions == null ? void 0 : systemMessageOptions.clearAt) != null ? _b : clearAt;
1554
+ effort = (_c = systemMessageOptions == null ? void 0 : systemMessageOptions.effort) != null ? _c : effort;
1555
+ if (text !== "" || toolChanges.length === 0 && (systemMessageOptions == null ? void 0 : systemMessageOptions.clearAt) == null && (systemMessageOptions == null ? void 0 : systemMessageOptions.effort) == null) {
1513
1556
  content.push({
1514
1557
  type: "text",
1515
1558
  text,
@@ -1530,22 +1573,34 @@ async function convertToAnthropicMessagesPrompt({
1530
1573
  });
1531
1574
  }
1532
1575
  }
1533
- if (i === 0 || system == null && toolChangeCount === 0) {
1534
- if (toolChangeCount > 0) {
1576
+ const hasMidConversationOptions = toolChangeCount > 0 || clearAt != null || effort != null;
1577
+ if (i === 0 || system == null && !hasMidConversationOptions) {
1578
+ if (hasMidConversationOptions) {
1535
1579
  warnings.push({
1536
1580
  type: "other",
1537
- message: "tool changes on the initial system message are not supported by Anthropic. Configure the initial tool set via the tools option instead. The tool changes have been ignored."
1581
+ message: "mid-conversation Anthropic system message options on the initial system message are not supported. The options have been ignored."
1538
1582
  });
1539
1583
  }
1540
1584
  system = content.filter(
1541
1585
  (part) => part.type === "text"
1542
1586
  );
1543
1587
  } else {
1544
- messages.push({ role: "system", content });
1588
+ messages.push({
1589
+ role: "system",
1590
+ content,
1591
+ ...clearAt != null && { clear_at: clearAt },
1592
+ ...effort != null && { output_config: { effort } }
1593
+ });
1545
1594
  betas.add("mid-conversation-system-2026-04-07");
1546
1595
  if (toolChangeCount > 0) {
1547
1596
  betas.add("mid-conversation-tool-changes-2026-07-01");
1548
1597
  }
1598
+ if (clearAt != null) {
1599
+ betas.add("mid-conversation-system-clear-at-2026-08-21");
1600
+ }
1601
+ if (effort != null) {
1602
+ betas.add("mid-conversation-effort-2026-08-01");
1603
+ }
1549
1604
  }
1550
1605
  break;
1551
1606
  }
@@ -1558,10 +1613,10 @@ async function convertToAnthropicMessagesPrompt({
1558
1613
  for (let j = 0; j < content.length; j++) {
1559
1614
  const part = content[j];
1560
1615
  const isLastPart = j === content.length - 1;
1561
- const cacheControl = (_b = validator.getCacheControl(part.providerOptions, {
1616
+ const cacheControl = (_d = validator.getCacheControl(part.providerOptions, {
1562
1617
  type: "user message part",
1563
1618
  canCache: true
1564
- })) != null ? _b : isLastPart ? validator.getCacheControl(message.providerOptions, {
1619
+ })) != null ? _d : isLastPart ? validator.getCacheControl(message.providerOptions, {
1565
1620
  type: "user message",
1566
1621
  canCache: true
1567
1622
  }) : void 0;
@@ -1606,7 +1661,7 @@ async function convertToAnthropicMessagesPrompt({
1606
1661
  media_type: "application/pdf",
1607
1662
  data: (0, import_provider_utils9.convertToBase64)(part.data)
1608
1663
  },
1609
- title: (_c = metadata.title) != null ? _c : part.filename,
1664
+ title: (_e = metadata.title) != null ? _e : part.filename,
1610
1665
  ...metadata.context && { context: metadata.context },
1611
1666
  ...enableCitations && {
1612
1667
  citations: { enabled: true }
@@ -1630,7 +1685,7 @@ async function convertToAnthropicMessagesPrompt({
1630
1685
  media_type: "text/plain",
1631
1686
  data: convertToString(part.data)
1632
1687
  },
1633
- title: (_d = metadata.title) != null ? _d : part.filename,
1688
+ title: (_f = metadata.title) != null ? _f : part.filename,
1634
1689
  ...metadata.context && { context: metadata.context },
1635
1690
  ...enableCitations && {
1636
1691
  citations: { enabled: true }
@@ -1652,10 +1707,10 @@ async function convertToAnthropicMessagesPrompt({
1652
1707
  for (let i2 = 0; i2 < content.length; i2++) {
1653
1708
  const part = content[i2];
1654
1709
  const isLastPart = i2 === content.length - 1;
1655
- const cacheControl = (_e = validator.getCacheControl(part.providerOptions, {
1710
+ const cacheControl = (_g = validator.getCacheControl(part.providerOptions, {
1656
1711
  type: "tool result part",
1657
1712
  canCache: true
1658
- })) != null ? _e : isLastPart ? validator.getCacheControl(message.providerOptions, {
1713
+ })) != null ? _g : isLastPart ? validator.getCacheControl(message.providerOptions, {
1659
1714
  type: "tool result message",
1660
1715
  canCache: true
1661
1716
  }) : void 0;
@@ -1737,16 +1792,16 @@ async function convertToAnthropicMessagesPrompt({
1737
1792
  for (let k = 0; k < content.length; k++) {
1738
1793
  const part = content[k];
1739
1794
  const isLastContentPart = k === content.length - 1;
1740
- const cacheControl = (_f = validator.getCacheControl(part.providerOptions, {
1795
+ const cacheControl = (_h = validator.getCacheControl(part.providerOptions, {
1741
1796
  type: "assistant message part",
1742
1797
  canCache: true
1743
- })) != null ? _f : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
1798
+ })) != null ? _h : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
1744
1799
  type: "assistant message",
1745
1800
  canCache: true
1746
1801
  }) : void 0;
1747
1802
  switch (part.type) {
1748
1803
  case "text": {
1749
- const textMetadata = (_g = part.providerOptions) == null ? void 0 : _g.anthropic;
1804
+ const textMetadata = (_i = part.providerOptions) == null ? void 0 : _i.anthropic;
1750
1805
  if ((textMetadata == null ? void 0 : textMetadata.type) === "compaction") {
1751
1806
  anthropicContent.push({
1752
1807
  type: "compaction",
@@ -2315,7 +2370,7 @@ var AnthropicMessagesLanguageModel = class {
2315
2370
  toolChoice,
2316
2371
  providerOptions
2317
2372
  }) {
2318
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2373
+ var _a, _b, _c, _d, _e;
2319
2374
  const warnings = [];
2320
2375
  if (frequencyPenalty != null) {
2321
2376
  warnings.push({
@@ -2404,7 +2459,7 @@ var AnthropicMessagesLanguageModel = class {
2404
2459
  }
2405
2460
  }
2406
2461
  const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
2407
- const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : "jsonTool";
2462
+ const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") ? "auto" : "jsonTool";
2408
2463
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2409
2464
  const jsonResponseToolName = getJsonResponseToolName(tools);
2410
2465
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
@@ -2427,7 +2482,9 @@ var AnthropicMessagesLanguageModel = class {
2427
2482
  warnings,
2428
2483
  cacheControlValidator
2429
2484
  });
2430
- if (rejectsThinkingDisabledAboveHighEffort && ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
2485
+ const thinkingOptions = anthropicOptions == null ? void 0 : anthropicOptions.thinking;
2486
+ const thinkingType = thinkingOptions != null && "type" in thinkingOptions ? thinkingOptions.type : void 0;
2487
+ if (rejectsThinkingDisabledAboveHighEffort && thinkingType === "disabled" && anthropicOptions != null && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
2431
2488
  warnings.push({
2432
2489
  type: "unsupported-setting",
2433
2490
  setting: "providerOptions.anthropic.effort",
@@ -2435,10 +2492,10 @@ var AnthropicMessagesLanguageModel = class {
2435
2492
  });
2436
2493
  anthropicOptions.effort = "high";
2437
2494
  }
2438
- const thinkingType = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type;
2439
2495
  const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
2440
- let thinkingBudget = thinkingType === "enabled" ? (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens : void 0;
2441
- const thinkingDisplay = thinkingType === "adaptive" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.display : void 0;
2496
+ let thinkingBudget = thinkingOptions != null && "budgetTokens" in thinkingOptions ? thinkingOptions.budgetTokens : void 0;
2497
+ const thinkingDisplay = thinkingOptions != null && "display" in thinkingOptions ? thinkingOptions.display : void 0;
2498
+ const thinkingBlockBinding = thinkingOptions != null && "blockBinding" in thinkingOptions ? thinkingOptions.blockBinding : void 0;
2442
2499
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2443
2500
  const baseArgs = {
2444
2501
  // model id:
@@ -2450,11 +2507,16 @@ var AnthropicMessagesLanguageModel = class {
2450
2507
  top_p: topP,
2451
2508
  stop_sequences: stopSequences,
2452
2509
  // provider specific settings:
2453
- ...isThinking && {
2510
+ ...(isThinking || thinkingBlockBinding != null) && {
2454
2511
  thinking: {
2455
- type: thinkingType,
2512
+ ...thinkingType != null && { type: thinkingType },
2456
2513
  ...thinkingBudget != null && { budget_tokens: thinkingBudget },
2457
- ...thinkingDisplay != null && { display: thinkingDisplay }
2514
+ ...thinkingDisplay != null && { display: thinkingDisplay },
2515
+ ...thinkingBlockBinding != null && {
2516
+ block_binding: {
2517
+ prefix_mismatch_behavior: thinkingBlockBinding.prefixMismatchBehavior
2518
+ }
2519
+ }
2458
2520
  }
2459
2521
  },
2460
2522
  ...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && {
@@ -2491,14 +2553,14 @@ var AnthropicMessagesLanguageModel = class {
2491
2553
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
2492
2554
  cache_control: anthropicOptions.cacheControl
2493
2555
  },
2494
- ...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
2556
+ ...((_c = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _c.userId) != null && {
2495
2557
  metadata: { user_id: anthropicOptions.metadata.userId }
2496
2558
  },
2497
2559
  // container with agent skills:
2498
2560
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
2499
2561
  container: {
2500
2562
  id: anthropicOptions.container.id,
2501
- skills: (_h = anthropicOptions.container.skills) == null ? void 0 : _h.map((skill) => ({
2563
+ skills: (_d = anthropicOptions.container.skills) == null ? void 0 : _d.map((skill) => ({
2502
2564
  type: skill.type,
2503
2565
  skill_id: skill.skillId,
2504
2566
  version: skill.version
@@ -2624,6 +2686,12 @@ var AnthropicMessagesLanguageModel = class {
2624
2686
  if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
2625
2687
  betas.add("effort-2025-11-24");
2626
2688
  }
2689
+ if (thinkingDisplay === "updates") {
2690
+ betas.add("thinking-display-updates-2026-08-18");
2691
+ }
2692
+ if (thinkingBlockBinding != null) {
2693
+ betas.add("thinking-binding-controls-2026-08-01");
2694
+ }
2627
2695
  if (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) {
2628
2696
  betas.add("task-budgets-2026-03-13");
2629
2697
  }
@@ -2635,7 +2703,7 @@ var AnthropicMessagesLanguageModel = class {
2635
2703
  } else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
2636
2704
  betas.add("server-side-fallback-2026-06-01");
2637
2705
  }
2638
- if (useStructuredOutput) {
2706
+ if (useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
2639
2707
  betas.add("structured-outputs-2025-11-13");
2640
2708
  }
2641
2709
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
@@ -2675,7 +2743,7 @@ var AnthropicMessagesLanguageModel = class {
2675
2743
  ...betas,
2676
2744
  ...toolsBetas,
2677
2745
  ...userSuppliedBetas,
2678
- ...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
2746
+ ...(_e = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _e : []
2679
2747
  ]),
2680
2748
  jsonResponseToolName: jsonResponseTool != null ? jsonResponseToolName : void 0
2681
2749
  };
@@ -3735,7 +3803,7 @@ function getModelCapabilities(modelId) {
3735
3803
  rejectsThinkingDisabledAboveHighEffort: true,
3736
3804
  isKnownModel: true
3737
3805
  };
3738
- } else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
3806
+ } else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5-1") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
3739
3807
  return {
3740
3808
  maxOutputTokens: 128e3,
3741
3809
  supportsStructuredOutput: true,