@ai-sdk/anthropic 3.0.62 → 3.0.64
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 +18 -4
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +20 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +20 -3
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +6 -0
- package/package.json +2 -4
- package/src/anthropic-messages-language-model.ts +3 -0
- package/src/anthropic-messages-options.ts +17 -0
package/dist/internal/index.js
CHANGED
|
@@ -861,6 +861,20 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
861
861
|
type: import_v43.z.literal("ephemeral"),
|
|
862
862
|
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
863
863
|
}).optional(),
|
|
864
|
+
/**
|
|
865
|
+
* Metadata to include with the request.
|
|
866
|
+
*
|
|
867
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
868
|
+
*/
|
|
869
|
+
metadata: import_v43.z.object({
|
|
870
|
+
/**
|
|
871
|
+
* An external identifier for the user associated with the request.
|
|
872
|
+
*
|
|
873
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
874
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
875
|
+
*/
|
|
876
|
+
userId: import_v43.z.string().optional()
|
|
877
|
+
}).optional(),
|
|
864
878
|
/**
|
|
865
879
|
* MCP servers to be utilized in this request.
|
|
866
880
|
*/
|
|
@@ -2870,7 +2884,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2870
2884
|
providerOptions,
|
|
2871
2885
|
stream
|
|
2872
2886
|
}) {
|
|
2873
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2887
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2874
2888
|
const warnings = [];
|
|
2875
2889
|
if (frequencyPenalty != null) {
|
|
2876
2890
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3008,6 +3022,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3008
3022
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
3009
3023
|
cache_control: anthropicOptions.cacheControl
|
|
3010
3024
|
},
|
|
3025
|
+
...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
|
|
3026
|
+
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
3027
|
+
},
|
|
3011
3028
|
// mcp servers:
|
|
3012
3029
|
...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
|
|
3013
3030
|
mcp_servers: anthropicOptions.mcpServers.map((server) => ({
|
|
@@ -3178,7 +3195,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3178
3195
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
|
|
3179
3196
|
betas.add("fast-mode-2026-02-01");
|
|
3180
3197
|
}
|
|
3181
|
-
if (stream && ((
|
|
3198
|
+
if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
|
|
3182
3199
|
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
3183
3200
|
}
|
|
3184
3201
|
const {
|
|
@@ -3217,7 +3234,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3217
3234
|
...betas,
|
|
3218
3235
|
...toolsBetas,
|
|
3219
3236
|
...userSuppliedBetas,
|
|
3220
|
-
...(
|
|
3237
|
+
...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
|
|
3221
3238
|
]),
|
|
3222
3239
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
3223
3240
|
toolNameMapping,
|