@ai-sdk/anthropic 4.0.0-beta.10 → 4.0.0-beta.11
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.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 +1 -1
- package/src/anthropic-messages-language-model.ts +3 -0
- package/src/anthropic-messages-options.ts +17 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -149,6 +149,9 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
149
149
|
type: z.ZodLiteral<"ephemeral">;
|
|
150
150
|
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
151
151
|
}, z.core.$strip>>;
|
|
152
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>>;
|
|
152
155
|
mcpServers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
153
156
|
type: z.ZodLiteral<"url">;
|
|
154
157
|
name: z.ZodString;
|
package/dist/index.d.ts
CHANGED
|
@@ -149,6 +149,9 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
149
149
|
type: z.ZodLiteral<"ephemeral">;
|
|
150
150
|
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
151
151
|
}, z.core.$strip>>;
|
|
152
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>>;
|
|
152
155
|
mcpServers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
153
156
|
type: z.ZodLiteral<"url">;
|
|
154
157
|
name: z.ZodString;
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
32
32
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "4.0.0-beta.
|
|
35
|
+
var VERSION = true ? "4.0.0-beta.11" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -869,6 +869,20 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
869
869
|
type: import_v43.z.literal("ephemeral"),
|
|
870
870
|
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
871
871
|
}).optional(),
|
|
872
|
+
/**
|
|
873
|
+
* Metadata to include with the request.
|
|
874
|
+
*
|
|
875
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
876
|
+
*/
|
|
877
|
+
metadata: import_v43.z.object({
|
|
878
|
+
/**
|
|
879
|
+
* An external identifier for the user associated with the request.
|
|
880
|
+
*
|
|
881
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
882
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
883
|
+
*/
|
|
884
|
+
userId: import_v43.z.string().optional()
|
|
885
|
+
}).optional(),
|
|
872
886
|
/**
|
|
873
887
|
* MCP servers to be utilized in this request.
|
|
874
888
|
*/
|
|
@@ -2879,7 +2893,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2879
2893
|
providerOptions,
|
|
2880
2894
|
stream
|
|
2881
2895
|
}) {
|
|
2882
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2896
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2883
2897
|
const warnings = [];
|
|
2884
2898
|
if (frequencyPenalty != null) {
|
|
2885
2899
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3032,6 +3046,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3032
3046
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
3033
3047
|
cache_control: anthropicOptions.cacheControl
|
|
3034
3048
|
},
|
|
3049
|
+
...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
|
|
3050
|
+
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
3051
|
+
},
|
|
3035
3052
|
// mcp servers:
|
|
3036
3053
|
...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
|
|
3037
3054
|
mcp_servers: anthropicOptions.mcpServers.map((server) => ({
|
|
@@ -3202,7 +3219,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3202
3219
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
|
|
3203
3220
|
betas.add("fast-mode-2026-02-01");
|
|
3204
3221
|
}
|
|
3205
|
-
if (stream && ((
|
|
3222
|
+
if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
|
|
3206
3223
|
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
3207
3224
|
}
|
|
3208
3225
|
const {
|
|
@@ -3241,7 +3258,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3241
3258
|
...betas,
|
|
3242
3259
|
...toolsBetas,
|
|
3243
3260
|
...userSuppliedBetas,
|
|
3244
|
-
...(
|
|
3261
|
+
...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
|
|
3245
3262
|
]),
|
|
3246
3263
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
3247
3264
|
toolNameMapping,
|