@prestyj/ai 5.24.0 → 5.25.0

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/README.md CHANGED
@@ -40,7 +40,7 @@ Tool parameters are Zod schemas. Converted to JSON Schema at the provider bounda
40
40
 
41
41
  | Provider | Models | Notes |
42
42
  |---|---|---|
43
- | `anthropic` | Claude Opus 5, Sonnet 5, Haiku 4.5 | Extended thinking, prompt caching, server-side compaction |
43
+ | `anthropic` | Claude Fable 5.1, Opus 5.5, Opus 5, Sonnet 5, Haiku 4.5 | Extended thinking, prompt caching, server-side compaction |
44
44
  | `openai` | GPT-4.1, o3, o4-mini | Supports OAuth (codex endpoint) and API keys |
45
45
  | `glm` | GLM-5.3 | Z.AI platform, OpenAI-compatible |
46
46
  | `moonshot` | Kimi K3, Kimi K2.7 Code | Moonshot platform, OpenAI-compatible |
package/dist/index.cjs CHANGED
@@ -1084,9 +1084,13 @@ function toAnthropicTools(tools, options) {
1084
1084
  return anthropicTool;
1085
1085
  });
1086
1086
  }
1087
- function toAnthropicToolChoice(choice) {
1087
+ function rejectsForcedToolUse(model) {
1088
+ return /opus-5-5|fable-5|mythos-5/.test(model);
1089
+ }
1090
+ function toAnthropicToolChoice(choice, model) {
1088
1091
  if (choice === "auto") return { type: "auto" };
1089
1092
  if (choice === "none") return { type: "none" };
1093
+ if (model && rejectsForcedToolUse(model)) return { type: "auto" };
1090
1094
  if (choice === "required") return { type: "any" };
1091
1095
  return { type: "tool", name: choice.name };
1092
1096
  }
@@ -1502,7 +1506,7 @@ async function* runStream(options) {
1502
1506
  ]
1503
1507
  };
1504
1508
  })() : {},
1505
- ...options.toolChoice && options.tools?.length ? { tool_choice: toAnthropicToolChoice(options.toolChoice) } : {},
1509
+ ...options.toolChoice && options.tools?.length ? { tool_choice: toAnthropicToolChoice(options.toolChoice, options.model) } : {},
1506
1510
  ...(() => {
1507
1511
  const contextEdits = [
1508
1512
  ...options.compaction ? [{ type: "compact_20260112" }] : [],