@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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.0-beta.88
4
+
5
+ ### Patch Changes
6
+
7
+ - 87db851: fix(vertex/anthropic): passing beta header only for structured outputs
8
+
3
9
  ## 3.0.0-beta.87
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
31
31
  var import_provider_utils22 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "3.0.0-beta.87" : "0.0.0-test";
34
+ var VERSION = true ? "3.0.0-beta.88" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -1038,6 +1038,9 @@ async function prepareTools({
1038
1038
  )
1039
1039
  } : {}
1040
1040
  });
1041
+ if (supportsStructuredOutput === true) {
1042
+ betas.add("structured-outputs-2025-11-13");
1043
+ }
1041
1044
  if (tool.inputExamples != null) {
1042
1045
  betas.add("advanced-tool-use-2025-11-20");
1043
1046
  }
@@ -2188,7 +2191,7 @@ var AnthropicMessagesLanguageModel = class {
2188
2191
  providerOptions,
2189
2192
  stream
2190
2193
  }) {
2191
- var _a, _b, _c, _d, _e, _f;
2194
+ var _a, _b, _c, _d, _e, _f, _g;
2192
2195
  const warnings = [];
2193
2196
  if (frequencyPenalty != null) {
2194
2197
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -2230,10 +2233,11 @@ var AnthropicMessagesLanguageModel = class {
2230
2233
  });
2231
2234
  const {
2232
2235
  maxOutputTokens: maxOutputTokensForModel,
2233
- supportsStructuredOutput,
2236
+ supportsStructuredOutput: modelSupportsStructuredOutput,
2234
2237
  isKnownModel
2235
2238
  } = getModelCapabilities(this.modelId);
2236
- const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : "auto";
2239
+ const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
2240
+ const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
2237
2241
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2238
2242
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
2239
2243
  type: "function",
@@ -2265,13 +2269,13 @@ var AnthropicMessagesLanguageModel = class {
2265
2269
  });
2266
2270
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
2267
2271
  prompt,
2268
- sendReasoning: (_b = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _b : true,
2272
+ sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
2269
2273
  warnings,
2270
2274
  cacheControlValidator,
2271
2275
  toolNameMapping
2272
2276
  });
2273
- const isThinking = ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "enabled";
2274
- let thinkingBudget = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.budgetTokens;
2277
+ const isThinking = ((_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type) === "enabled";
2278
+ let thinkingBudget = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens;
2275
2279
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2276
2280
  const baseArgs = {
2277
2281
  // model id:
@@ -2313,7 +2317,7 @@ var AnthropicMessagesLanguageModel = class {
2313
2317
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
2314
2318
  container: {
2315
2319
  id: anthropicOptions.container.id,
2316
- skills: (_e = anthropicOptions.container.skills) == null ? void 0 : _e.map((skill) => ({
2320
+ skills: (_f = anthropicOptions.container.skills) == null ? void 0 : _f.map((skill) => ({
2317
2321
  type: skill.type,
2318
2322
  skill_id: skill.skillId,
2319
2323
  version: skill.version
@@ -2432,10 +2436,11 @@ var AnthropicMessagesLanguageModel = class {
2432
2436
  if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
2433
2437
  betas.add("effort-2025-11-24");
2434
2438
  }
2435
- if (stream && ((_f = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _f : true)) {
2439
+ if (stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true)) {
2436
2440
  betas.add("fine-grained-tool-streaming-2025-05-14");
2437
2441
  }
2438
- if (useStructuredOutput) {
2442
+ const usingNativeOutputFormat = useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
2443
+ if (usingNativeOutputFormat) {
2439
2444
  betas.add("structured-outputs-2025-11-13");
2440
2445
  }
2441
2446
  const {