@ai-sdk/anthropic 3.0.98 → 3.0.100
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 +13 -0
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +10 -1
- package/dist/internal/index.d.ts +10 -1
- package/dist/internal/index.js +18 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +16 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-messages-language-model.ts +24 -0
- package/src/internal/index.ts +1 -0
|
@@ -1034,4 +1034,13 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
1034
1034
|
betas: Set<string>;
|
|
1035
1035
|
}>;
|
|
1036
1036
|
|
|
1037
|
-
|
|
1037
|
+
/**
|
|
1038
|
+
* Removes JSON Schema keywords that Anthropic rejects in
|
|
1039
|
+
* `output_config.format.schema`.
|
|
1040
|
+
*
|
|
1041
|
+
* The full original schema is still used by AI SDK result validation. This
|
|
1042
|
+
* only relaxes the schema sent to Anthropic's constrained decoder.
|
|
1043
|
+
*/
|
|
1044
|
+
declare function sanitizeJsonSchema(schema: JSONSchema7): JSONSchema7;
|
|
1045
|
+
|
|
1046
|
+
export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools, sanitizeJsonSchema };
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1034,4 +1034,13 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
1034
1034
|
betas: Set<string>;
|
|
1035
1035
|
}>;
|
|
1036
1036
|
|
|
1037
|
-
|
|
1037
|
+
/**
|
|
1038
|
+
* Removes JSON Schema keywords that Anthropic rejects in
|
|
1039
|
+
* `output_config.format.schema`.
|
|
1040
|
+
*
|
|
1041
|
+
* The full original schema is still used by AI SDK result validation. This
|
|
1042
|
+
* only relaxes the schema sent to Anthropic's constrained decoder.
|
|
1043
|
+
*/
|
|
1044
|
+
declare function sanitizeJsonSchema(schema: JSONSchema7): JSONSchema7;
|
|
1045
|
+
|
|
1046
|
+
export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools, sanitizeJsonSchema };
|
package/dist/internal/index.js
CHANGED
|
@@ -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
|
|
|
@@ -3388,6 +3389,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3388
3389
|
rejectsSamplingParameters,
|
|
3389
3390
|
isKnownModel
|
|
3390
3391
|
} = getModelCapabilities(this.modelId);
|
|
3392
|
+
if (!isKnownModel && maxOutputTokens == null) {
|
|
3393
|
+
warnings.push({
|
|
3394
|
+
type: "compatibility",
|
|
3395
|
+
feature: "maxOutputTokens",
|
|
3396
|
+
details: `The model "${this.modelId}" is unknown. The max output tokens have been limited to ${maxOutputTokensForModel}. Set maxOutputTokens explicitly to override this limit.`
|
|
3397
|
+
});
|
|
3398
|
+
}
|
|
3391
3399
|
if (rejectsSamplingParameters) {
|
|
3392
3400
|
if (temperature != null) {
|
|
3393
3401
|
warnings.push({
|
|
@@ -3425,6 +3433,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3425
3433
|
description: "Respond with a JSON object.",
|
|
3426
3434
|
inputSchema: responseFormat.schema
|
|
3427
3435
|
} : void 0;
|
|
3436
|
+
if (jsonResponseTool != null && (anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse) === false) {
|
|
3437
|
+
warnings.push({
|
|
3438
|
+
type: "unsupported",
|
|
3439
|
+
feature: "providerOptions.anthropic.disableParallelToolUse",
|
|
3440
|
+
details: "`disableParallelToolUse: false` is ignored when using the JSON response tool. Parallel tool use is disabled to ensure a single coherent JSON tool call."
|
|
3441
|
+
});
|
|
3442
|
+
}
|
|
3428
3443
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
3429
3444
|
const cacheControlValidator = new CacheControlValidator();
|
|
3430
3445
|
const toolNameMapping = (0, import_provider_utils15.createToolNameMapping)({
|
|
@@ -5815,6 +5830,7 @@ var anthropicTools = {
|
|
|
5815
5830
|
0 && (module.exports = {
|
|
5816
5831
|
AnthropicMessagesLanguageModel,
|
|
5817
5832
|
anthropicTools,
|
|
5818
|
-
prepareTools
|
|
5833
|
+
prepareTools,
|
|
5834
|
+
sanitizeJsonSchema
|
|
5819
5835
|
});
|
|
5820
5836
|
//# sourceMappingURL=index.js.map
|