@ai-sdk/anthropic 3.0.117 → 3.0.118
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 +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +18 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +18 -1
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +11 -4
- package/package.json +1 -1
- package/src/anthropic-message-metadata.ts +12 -0
- package/src/anthropic-messages-api.ts +15 -0
- package/src/anthropic-messages-language-model.ts +15 -0
- package/src/anthropic-messages-options.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
13
|
|
|
14
14
|
// src/version.ts
|
|
15
|
-
var VERSION = true ? "3.0.
|
|
15
|
+
var VERSION = true ? "3.0.118" : "0.0.0-test";
|
|
16
16
|
|
|
17
17
|
// src/anthropic-messages-language-model.ts
|
|
18
18
|
import {
|
|
@@ -79,6 +79,11 @@ var anthropicToolCallCallerSchema = z2.union([
|
|
|
79
79
|
type: z2.literal("direct")
|
|
80
80
|
})
|
|
81
81
|
]);
|
|
82
|
+
var anthropicInputTransformationSchema = z2.object({
|
|
83
|
+
type: z2.string(),
|
|
84
|
+
path: z2.string(),
|
|
85
|
+
reason: z2.string()
|
|
86
|
+
});
|
|
82
87
|
var anthropicMessagesResponseSchema = lazySchema2(
|
|
83
88
|
() => zodSchema2(
|
|
84
89
|
z2.object({
|
|
@@ -358,6 +363,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
358
363
|
stop_reason: z2.string().nullish(),
|
|
359
364
|
stop_sequence: z2.string().nullish(),
|
|
360
365
|
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
366
|
+
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
361
367
|
usage: z2.looseObject({
|
|
362
368
|
input_tokens: z2.number(),
|
|
363
369
|
output_tokens: z2.number(),
|
|
@@ -442,6 +448,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
442
448
|
])
|
|
443
449
|
).nullish(),
|
|
444
450
|
stop_reason: z2.string().nullish(),
|
|
451
|
+
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
445
452
|
container: z2.object({
|
|
446
453
|
expires_at: z2.string(),
|
|
447
454
|
id: z2.string()
|
|
@@ -802,6 +809,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
802
809
|
})
|
|
803
810
|
).nullish()
|
|
804
811
|
}),
|
|
812
|
+
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
805
813
|
context_management: z2.object({
|
|
806
814
|
applied_edits: z2.array(
|
|
807
815
|
z2.union([
|
|
@@ -909,7 +917,7 @@ var anthropicSystemMessageProviderOptions = z3.object({
|
|
|
909
917
|
).optional()
|
|
910
918
|
});
|
|
911
919
|
var anthropicThinkingBlockBinding = z3.object({
|
|
912
|
-
prefixMismatchBehavior: z3.
|
|
920
|
+
prefixMismatchBehavior: z3.enum(["error", "drop_block"])
|
|
913
921
|
});
|
|
914
922
|
var anthropicLanguageModelOptions = z3.object({
|
|
915
923
|
/**
|
|
@@ -4490,6 +4498,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4490
4498
|
cacheCreationInputTokens: (_a2 = response.usage.cache_creation_input_tokens) != null ? _a2 : null,
|
|
4491
4499
|
stopSequence: (_b2 = response.stop_sequence) != null ? _b2 : null,
|
|
4492
4500
|
...stopDetails != null ? { stopDetails } : {},
|
|
4501
|
+
...response.input_transformations != null ? { inputTransformations: response.input_transformations } : {},
|
|
4493
4502
|
iterations: response.usage.iterations ? response.usage.iterations.map(
|
|
4494
4503
|
(iter) => ({
|
|
4495
4504
|
type: iter.type,
|
|
@@ -4579,6 +4588,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4579
4588
|
let cacheCreationInputTokens = null;
|
|
4580
4589
|
let stopSequence = null;
|
|
4581
4590
|
let stopDetails = void 0;
|
|
4591
|
+
let inputTransformations;
|
|
4582
4592
|
let container = null;
|
|
4583
4593
|
let isJsonResponseFromTool = false;
|
|
4584
4594
|
let isMessageOpen = false;
|
|
@@ -5243,6 +5253,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5243
5253
|
...value.message.usage
|
|
5244
5254
|
};
|
|
5245
5255
|
cacheCreationInputTokens = (_g = value.message.usage.cache_creation_input_tokens) != null ? _g : null;
|
|
5256
|
+
if (value.message.input_transformations != null) {
|
|
5257
|
+
inputTransformations = value.message.input_transformations;
|
|
5258
|
+
}
|
|
5246
5259
|
if (value.message.container != null) {
|
|
5247
5260
|
container = {
|
|
5248
5261
|
expiresAt: value.message.container.expires_at,
|
|
@@ -5343,6 +5356,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5343
5356
|
value.context_management
|
|
5344
5357
|
);
|
|
5345
5358
|
}
|
|
5359
|
+
if (value.input_transformations != null) {
|
|
5360
|
+
inputTransformations = value.input_transformations;
|
|
5361
|
+
}
|
|
5346
5362
|
rawUsage = {
|
|
5347
5363
|
...rawUsage,
|
|
5348
5364
|
...value.usage
|
|
@@ -5357,6 +5373,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5357
5373
|
cacheCreationInputTokens,
|
|
5358
5374
|
stopSequence,
|
|
5359
5375
|
...stopDetails != null ? { stopDetails } : {},
|
|
5376
|
+
...inputTransformations != null ? { inputTransformations } : {},
|
|
5360
5377
|
iterations: usage.iterations ? usage.iterations.map(
|
|
5361
5378
|
(iter) => ({
|
|
5362
5379
|
type: iter.type,
|