@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.64
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 05b8ca2: feat (provider/anthropic): support passing metadata.user_id
|
|
8
|
+
|
|
9
|
+
## 3.0.63
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 055cd68: fix: publish v6 to latest npm dist tag
|
|
14
|
+
- Updated dependencies [055cd68]
|
|
15
|
+
- @ai-sdk/provider-utils@4.0.21
|
|
16
|
+
|
|
3
17
|
## 3.0.62
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -440,13 +454,13 @@
|
|
|
440
454
|
Before
|
|
441
455
|
|
|
442
456
|
```ts
|
|
443
|
-
model.textEmbeddingModel(
|
|
457
|
+
model.textEmbeddingModel("my-model-id");
|
|
444
458
|
```
|
|
445
459
|
|
|
446
460
|
After
|
|
447
461
|
|
|
448
462
|
```ts
|
|
449
|
-
model.embeddingModel(
|
|
463
|
+
model.embeddingModel("my-model-id");
|
|
450
464
|
```
|
|
451
465
|
|
|
452
466
|
- f33a018: chore: add model ID for Haiku 4.5
|
|
@@ -786,13 +800,13 @@
|
|
|
786
800
|
Before
|
|
787
801
|
|
|
788
802
|
```ts
|
|
789
|
-
model.textEmbeddingModel(
|
|
803
|
+
model.textEmbeddingModel("my-model-id");
|
|
790
804
|
```
|
|
791
805
|
|
|
792
806
|
After
|
|
793
807
|
|
|
794
808
|
```ts
|
|
795
|
-
model.embeddingModel(
|
|
809
|
+
model.embeddingModel("my-model-id");
|
|
796
810
|
```
|
|
797
811
|
|
|
798
812
|
- Updated dependencies [8d9e8ad]
|
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 ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.64" : "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
|
*/
|
|
@@ -2878,7 +2892,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2878
2892
|
providerOptions,
|
|
2879
2893
|
stream
|
|
2880
2894
|
}) {
|
|
2881
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2895
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2882
2896
|
const warnings = [];
|
|
2883
2897
|
if (frequencyPenalty != null) {
|
|
2884
2898
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3016,6 +3030,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3016
3030
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
3017
3031
|
cache_control: anthropicOptions.cacheControl
|
|
3018
3032
|
},
|
|
3033
|
+
...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
|
|
3034
|
+
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
3035
|
+
},
|
|
3019
3036
|
// mcp servers:
|
|
3020
3037
|
...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
|
|
3021
3038
|
mcp_servers: anthropicOptions.mcpServers.map((server) => ({
|
|
@@ -3186,7 +3203,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3186
3203
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
|
|
3187
3204
|
betas.add("fast-mode-2026-02-01");
|
|
3188
3205
|
}
|
|
3189
|
-
if (stream && ((
|
|
3206
|
+
if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
|
|
3190
3207
|
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
3191
3208
|
}
|
|
3192
3209
|
const {
|
|
@@ -3225,7 +3242,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3225
3242
|
...betas,
|
|
3226
3243
|
...toolsBetas,
|
|
3227
3244
|
...userSuppliedBetas,
|
|
3228
|
-
...(
|
|
3245
|
+
...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
|
|
3229
3246
|
]),
|
|
3230
3247
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
3231
3248
|
toolNameMapping,
|