@ai-sdk/anthropic 3.0.0-beta.87 → 3.0.0-beta.88

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/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "3.0.0-beta.87" : "0.0.0-test";
14
+ var VERSION = true ? "3.0.0-beta.88" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -1043,6 +1043,9 @@ async function prepareTools({
1043
1043
  )
1044
1044
  } : {}
1045
1045
  });
1046
+ if (supportsStructuredOutput === true) {
1047
+ betas.add("structured-outputs-2025-11-13");
1048
+ }
1046
1049
  if (tool.inputExamples != null) {
1047
1050
  betas.add("advanced-tool-use-2025-11-20");
1048
1051
  }
@@ -2212,7 +2215,7 @@ var AnthropicMessagesLanguageModel = class {
2212
2215
  providerOptions,
2213
2216
  stream
2214
2217
  }) {
2215
- var _a, _b, _c, _d, _e, _f;
2218
+ var _a, _b, _c, _d, _e, _f, _g;
2216
2219
  const warnings = [];
2217
2220
  if (frequencyPenalty != null) {
2218
2221
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -2254,10 +2257,11 @@ var AnthropicMessagesLanguageModel = class {
2254
2257
  });
2255
2258
  const {
2256
2259
  maxOutputTokens: maxOutputTokensForModel,
2257
- supportsStructuredOutput,
2260
+ supportsStructuredOutput: modelSupportsStructuredOutput,
2258
2261
  isKnownModel
2259
2262
  } = getModelCapabilities(this.modelId);
2260
- const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : "auto";
2263
+ const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
2264
+ const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
2261
2265
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2262
2266
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2263
2267
  type: "function",
@@ -2289,13 +2293,13 @@ var AnthropicMessagesLanguageModel = class {
2289
2293
  });
2290
2294
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
2291
2295
  prompt,
2292
- sendReasoning: (_b = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _b : true,
2296
+ sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
2293
2297
  warnings,
2294
2298
  cacheControlValidator,
2295
2299
  toolNameMapping
2296
2300
  });
2297
- const isThinking = ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "enabled";
2298
- let thinkingBudget = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.budgetTokens;
2301
+ const isThinking = ((_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type) === "enabled";
2302
+ let thinkingBudget = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens;
2299
2303
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2300
2304
  const baseArgs = {
2301
2305
  // model id:
@@ -2337,7 +2341,7 @@ var AnthropicMessagesLanguageModel = class {
2337
2341
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
2338
2342
  container: {
2339
2343
  id: anthropicOptions.container.id,
2340
- skills: (_e = anthropicOptions.container.skills) == null ? void 0 : _e.map((skill) => ({
2344
+ skills: (_f = anthropicOptions.container.skills) == null ? void 0 : _f.map((skill) => ({
2341
2345
  type: skill.type,
2342
2346
  skill_id: skill.skillId,
2343
2347
  version: skill.version
@@ -2456,10 +2460,11 @@ var AnthropicMessagesLanguageModel = class {
2456
2460
  if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
2457
2461
  betas.add("effort-2025-11-24");
2458
2462
  }
2459
- if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
2463
+ if (stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true)) {
2460
2464
  betas.add("fine-grained-tool-streaming-2025-05-14");
2461
2465
  }
2462
- if (useStructuredOutput) {
2466
+ const usingNativeOutputFormat = useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
2467
+ if (usingNativeOutputFormat) {
2463
2468
  betas.add("structured-outputs-2025-11-13");
2464
2469
  }
2465
2470
  const {