@ai-sdk/anthropic 3.0.100 → 3.0.101
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 +6 -0
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +13 -1
- package/dist/internal/index.d.ts +13 -1
- package/dist/internal/index.js +17 -1
- 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 +21 -2
- package/src/internal/index.ts +4 -1
|
@@ -46,6 +46,18 @@ declare class AnthropicMessagesLanguageModel implements LanguageModelV3 {
|
|
|
46
46
|
doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
|
|
47
47
|
doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns the capabilities of a Claude model that are used for defaults and feature selection.
|
|
51
|
+
*
|
|
52
|
+
* @see https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table
|
|
53
|
+
* @see https://platform.claude.com/docs/en/build-with-claude/structured-outputs
|
|
54
|
+
*/
|
|
55
|
+
declare function getModelCapabilities(modelId: string): {
|
|
56
|
+
maxOutputTokens: number;
|
|
57
|
+
supportsStructuredOutput: boolean;
|
|
58
|
+
rejectsSamplingParameters: boolean;
|
|
59
|
+
isKnownModel: boolean;
|
|
60
|
+
};
|
|
49
61
|
|
|
50
62
|
declare const anthropicTools: {
|
|
51
63
|
/**
|
|
@@ -1043,4 +1055,4 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
1043
1055
|
*/
|
|
1044
1056
|
declare function sanitizeJsonSchema(schema: JSONSchema7): JSONSchema7;
|
|
1045
1057
|
|
|
1046
|
-
export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools, sanitizeJsonSchema };
|
|
1058
|
+
export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, getModelCapabilities, prepareTools, sanitizeJsonSchema };
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -46,6 +46,18 @@ declare class AnthropicMessagesLanguageModel implements LanguageModelV3 {
|
|
|
46
46
|
doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
|
|
47
47
|
doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns the capabilities of a Claude model that are used for defaults and feature selection.
|
|
51
|
+
*
|
|
52
|
+
* @see https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table
|
|
53
|
+
* @see https://platform.claude.com/docs/en/build-with-claude/structured-outputs
|
|
54
|
+
*/
|
|
55
|
+
declare function getModelCapabilities(modelId: string): {
|
|
56
|
+
maxOutputTokens: number;
|
|
57
|
+
supportsStructuredOutput: boolean;
|
|
58
|
+
rejectsSamplingParameters: boolean;
|
|
59
|
+
isKnownModel: boolean;
|
|
60
|
+
};
|
|
49
61
|
|
|
50
62
|
declare const anthropicTools: {
|
|
51
63
|
/**
|
|
@@ -1043,4 +1055,4 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
1043
1055
|
*/
|
|
1044
1056
|
declare function sanitizeJsonSchema(schema: JSONSchema7): JSONSchema7;
|
|
1045
1057
|
|
|
1046
|
-
export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, prepareTools, sanitizeJsonSchema };
|
|
1058
|
+
export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, getModelCapabilities, prepareTools, sanitizeJsonSchema };
|
package/dist/internal/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
|
|
24
24
|
anthropicTools: () => anthropicTools,
|
|
25
|
+
getModelCapabilities: () => getModelCapabilities,
|
|
25
26
|
prepareTools: () => prepareTools,
|
|
26
27
|
sanitizeJsonSchema: () => sanitizeJsonSchema
|
|
27
28
|
});
|
|
@@ -3422,7 +3423,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3422
3423
|
topP = void 0;
|
|
3423
3424
|
}
|
|
3424
3425
|
}
|
|
3425
|
-
const isAnthropicModel = isKnownModel || this.modelId.
|
|
3426
|
+
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
3426
3427
|
const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
|
|
3427
3428
|
const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3428
3429
|
const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
|
|
@@ -5240,6 +5241,20 @@ function getModelCapabilities(modelId) {
|
|
|
5240
5241
|
rejectsSamplingParameters: false,
|
|
5241
5242
|
isKnownModel: true
|
|
5242
5243
|
};
|
|
5244
|
+
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
5245
|
+
return {
|
|
5246
|
+
maxOutputTokens: 4096,
|
|
5247
|
+
supportsStructuredOutput: false,
|
|
5248
|
+
rejectsSamplingParameters: false,
|
|
5249
|
+
isKnownModel: false
|
|
5250
|
+
};
|
|
5251
|
+
} else if (modelId.includes("claude-")) {
|
|
5252
|
+
return {
|
|
5253
|
+
maxOutputTokens: 128e3,
|
|
5254
|
+
supportsStructuredOutput: true,
|
|
5255
|
+
rejectsSamplingParameters: true,
|
|
5256
|
+
isKnownModel: false
|
|
5257
|
+
};
|
|
5243
5258
|
} else {
|
|
5244
5259
|
return {
|
|
5245
5260
|
maxOutputTokens: 4096,
|
|
@@ -5830,6 +5845,7 @@ var anthropicTools = {
|
|
|
5830
5845
|
0 && (module.exports = {
|
|
5831
5846
|
AnthropicMessagesLanguageModel,
|
|
5832
5847
|
anthropicTools,
|
|
5848
|
+
getModelCapabilities,
|
|
5833
5849
|
prepareTools,
|
|
5834
5850
|
sanitizeJsonSchema
|
|
5835
5851
|
});
|