@ai-sdk/anthropic 4.0.16 → 4.0.17

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.
@@ -1122,6 +1122,15 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
1122
1122
  betas: Set<string>;
1123
1123
  }>;
1124
1124
 
1125
+ /**
1126
+ * Removes JSON Schema keywords that Anthropic rejects in
1127
+ * `output_config.format.schema`.
1128
+ *
1129
+ * The full original schema is still used by AI SDK result validation. This
1130
+ * only relaxes the schema sent to Anthropic's constrained decoder.
1131
+ */
1132
+ declare function sanitizeJsonSchema(schema: JSONSchema7): JSONSchema7;
1133
+
1125
1134
  interface AnthropicSkillsConfig {
1126
1135
  provider: string;
1127
1136
  baseURL: string;
@@ -1138,4 +1147,4 @@ declare class AnthropicSkills implements SkillsV4 {
1138
1147
  uploadSkill(params: Parameters<SkillsV4['uploadSkill']>[0]): Promise<Awaited<ReturnType<SkillsV4['uploadSkill']>>>;
1139
1148
  }
1140
1149
 
1141
- export { AnthropicFiles, AnthropicLanguageModel, AnthropicLanguageModel as AnthropicMessagesLanguageModel, type AnthropicModelId as AnthropicMessagesModelId, type AnthropicModelId, AnthropicSkills, anthropicTools, getModelCapabilities, prepareTools };
1150
+ export { AnthropicFiles, AnthropicLanguageModel, AnthropicLanguageModel as AnthropicMessagesLanguageModel, type AnthropicModelId as AnthropicMessagesModelId, type AnthropicModelId, AnthropicSkills, anthropicTools, getModelCapabilities, prepareTools, sanitizeJsonSchema };
@@ -3651,6 +3651,13 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
3651
3651
  description: "Respond with a JSON object.",
3652
3652
  inputSchema: responseFormat.schema
3653
3653
  } : void 0;
3654
+ if (jsonResponseTool != null && (anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse) === false) {
3655
+ warnings.push({
3656
+ type: "unsupported",
3657
+ feature: "providerOptions.anthropic.disableParallelToolUse",
3658
+ details: "`disableParallelToolUse: false` is ignored when using the JSON response tool. Parallel tool use is disabled to ensure a single coherent JSON tool call."
3659
+ });
3660
+ }
3654
3661
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
3655
3662
  const cacheControlValidator = new CacheControlValidator();
3656
3663
  const toolNameMapping = createToolNameMapping({
@@ -6324,6 +6331,7 @@ export {
6324
6331
  AnthropicSkills,
6325
6332
  anthropicTools,
6326
6333
  getModelCapabilities,
6327
- prepareTools
6334
+ prepareTools,
6335
+ sanitizeJsonSchema
6328
6336
  };
6329
6337
  //# sourceMappingURL=index.js.map