@ai-sdk/anthropic 2.0.87 → 2.0.89

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.
@@ -707,4 +707,13 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
707
707
  betas: Set<string>;
708
708
  }>;
709
709
 
710
- export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools };
710
+ /**
711
+ * Removes JSON Schema keywords that Anthropic rejects in
712
+ * `output_config.format.schema`.
713
+ *
714
+ * The full original schema is still used by AI SDK result validation. This
715
+ * only relaxes the schema sent to Anthropic's constrained decoder.
716
+ */
717
+ declare function sanitizeJsonSchema(schema: JSONSchema7): JSONSchema7;
718
+
719
+ export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools, sanitizeJsonSchema };
@@ -707,4 +707,13 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
707
707
  betas: Set<string>;
708
708
  }>;
709
709
 
710
- export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools };
710
+ /**
711
+ * Removes JSON Schema keywords that Anthropic rejects in
712
+ * `output_config.format.schema`.
713
+ *
714
+ * The full original schema is still used by AI SDK result validation. This
715
+ * only relaxes the schema sent to Anthropic's constrained decoder.
716
+ */
717
+ declare function sanitizeJsonSchema(schema: JSONSchema7): JSONSchema7;
718
+
719
+ export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools, sanitizeJsonSchema };
@@ -22,7 +22,8 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
24
24
  anthropicTools: () => anthropicTools,
25
- prepareTools: () => prepareTools
25
+ prepareTools: () => prepareTools,
26
+ sanitizeJsonSchema: () => sanitizeJsonSchema
26
27
  });
27
28
  module.exports = __toCommonJS(index_exports);
28
29
 
@@ -2262,6 +2263,12 @@ var AnthropicMessagesLanguageModel = class {
2262
2263
  rejectsSamplingParameters,
2263
2264
  isKnownModel
2264
2265
  } = getModelCapabilities(this.modelId);
2266
+ if (!isKnownModel && maxOutputTokens == null) {
2267
+ warnings.push({
2268
+ type: "other",
2269
+ message: `The model "${this.modelId}" is unknown. The max output tokens have been limited to ${maxOutputTokensForModel}. Set maxOutputTokens explicitly to override this limit.`
2270
+ });
2271
+ }
2265
2272
  if (rejectsSamplingParameters) {
2266
2273
  if (temperature != null) {
2267
2274
  warnings.push({
@@ -2297,6 +2304,13 @@ var AnthropicMessagesLanguageModel = class {
2297
2304
  description: "Respond with a JSON object.",
2298
2305
  inputSchema: responseFormat.schema
2299
2306
  } : void 0;
2307
+ if (jsonResponseTool != null && (anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse) === false) {
2308
+ warnings.push({
2309
+ type: "unsupported-setting",
2310
+ setting: "providerOptions",
2311
+ details: "`disableParallelToolUse: false` is ignored when using the JSON response tool. Parallel tool use is disabled to ensure a single coherent JSON tool call."
2312
+ });
2313
+ }
2300
2314
  const cacheControlValidator = new CacheControlValidator();
2301
2315
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
2302
2316
  prompt,
@@ -4122,6 +4136,7 @@ var anthropicTools = {
4122
4136
  0 && (module.exports = {
4123
4137
  AnthropicMessagesLanguageModel,
4124
4138
  anthropicTools,
4125
- prepareTools
4139
+ prepareTools,
4140
+ sanitizeJsonSchema
4126
4141
  });
4127
4142
  //# sourceMappingURL=index.js.map