@ai-sdk/anthropic 4.0.17 → 4.0.19
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 +12 -0
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +26 -1
- package/dist/internal/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-language-model.ts +35 -1
package/dist/internal/index.js
CHANGED
|
@@ -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({
|
|
@@ -3640,7 +3647,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3640
3647
|
topP = void 0;
|
|
3641
3648
|
}
|
|
3642
3649
|
}
|
|
3643
|
-
const isAnthropicModel = isKnownModel || this.modelId.
|
|
3650
|
+
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
3644
3651
|
const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
|
|
3645
3652
|
const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3646
3653
|
const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
|
|
@@ -5486,6 +5493,24 @@ function getModelCapabilities(modelId) {
|
|
|
5486
5493
|
supportsXhighEffort: false,
|
|
5487
5494
|
isKnownModel: true
|
|
5488
5495
|
};
|
|
5496
|
+
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
5497
|
+
return {
|
|
5498
|
+
maxOutputTokens: 4096,
|
|
5499
|
+
supportsStructuredOutput: false,
|
|
5500
|
+
supportsAdaptiveThinking: false,
|
|
5501
|
+
rejectsSamplingParameters: false,
|
|
5502
|
+
supportsXhighEffort: false,
|
|
5503
|
+
isKnownModel: false
|
|
5504
|
+
};
|
|
5505
|
+
} else if (modelId.includes("claude-")) {
|
|
5506
|
+
return {
|
|
5507
|
+
maxOutputTokens: 128e3,
|
|
5508
|
+
supportsStructuredOutput: true,
|
|
5509
|
+
supportsAdaptiveThinking: true,
|
|
5510
|
+
rejectsSamplingParameters: true,
|
|
5511
|
+
supportsXhighEffort: true,
|
|
5512
|
+
isKnownModel: false
|
|
5513
|
+
};
|
|
5489
5514
|
} else {
|
|
5490
5515
|
return {
|
|
5491
5516
|
maxOutputTokens: 4096,
|