@ai-sdk/anthropic 4.0.16 → 4.0.18

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 };
@@ -3614,6 +3614,13 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
3614
3614
  supportsXhighEffort,
3615
3615
  isKnownModel
3616
3616
  } = getModelCapabilities(this.modelId);
3617
+ if (!isKnownModel && maxOutputTokens == null) {
3618
+ warnings.push({
3619
+ type: "compatibility",
3620
+ feature: "maxOutputTokens",
3621
+ details: `The model "${this.modelId}" is unknown. The max output tokens have been limited to ${maxOutputTokensForModel}. Set maxOutputTokens explicitly to override this limit.`
3622
+ });
3623
+ }
3617
3624
  if (rejectsSamplingParameters) {
3618
3625
  if (temperature != null) {
3619
3626
  warnings.push({
@@ -3651,6 +3658,13 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
3651
3658
  description: "Respond with a JSON object.",
3652
3659
  inputSchema: responseFormat.schema
3653
3660
  } : void 0;
3661
+ if (jsonResponseTool != null && (anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse) === false) {
3662
+ warnings.push({
3663
+ type: "unsupported",
3664
+ feature: "providerOptions.anthropic.disableParallelToolUse",
3665
+ details: "`disableParallelToolUse: false` is ignored when using the JSON response tool. Parallel tool use is disabled to ensure a single coherent JSON tool call."
3666
+ });
3667
+ }
3654
3668
  const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
3655
3669
  const cacheControlValidator = new CacheControlValidator();
3656
3670
  const toolNameMapping = createToolNameMapping({
@@ -6324,6 +6338,7 @@ export {
6324
6338
  AnthropicSkills,
6325
6339
  anthropicTools,
6326
6340
  getModelCapabilities,
6327
- prepareTools
6341
+ prepareTools,
6342
+ sanitizeJsonSchema
6328
6343
  };
6329
6344
  //# sourceMappingURL=index.js.map