@ai-sdk/anthropic 3.0.116 → 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 +14 -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 +3 -3
- 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/internal/index.mjs
CHANGED
|
@@ -63,6 +63,11 @@ var anthropicToolCallCallerSchema = z2.union([
|
|
|
63
63
|
type: z2.literal("direct")
|
|
64
64
|
})
|
|
65
65
|
]);
|
|
66
|
+
var anthropicInputTransformationSchema = z2.object({
|
|
67
|
+
type: z2.string(),
|
|
68
|
+
path: z2.string(),
|
|
69
|
+
reason: z2.string()
|
|
70
|
+
});
|
|
66
71
|
var anthropicMessagesResponseSchema = lazySchema2(
|
|
67
72
|
() => zodSchema2(
|
|
68
73
|
z2.object({
|
|
@@ -342,6 +347,7 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
342
347
|
stop_reason: z2.string().nullish(),
|
|
343
348
|
stop_sequence: z2.string().nullish(),
|
|
344
349
|
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
350
|
+
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
345
351
|
usage: z2.looseObject({
|
|
346
352
|
input_tokens: z2.number(),
|
|
347
353
|
output_tokens: z2.number(),
|
|
@@ -426,6 +432,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
426
432
|
])
|
|
427
433
|
).nullish(),
|
|
428
434
|
stop_reason: z2.string().nullish(),
|
|
435
|
+
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
429
436
|
container: z2.object({
|
|
430
437
|
expires_at: z2.string(),
|
|
431
438
|
id: z2.string()
|
|
@@ -786,6 +793,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
|
|
|
786
793
|
})
|
|
787
794
|
).nullish()
|
|
788
795
|
}),
|
|
796
|
+
input_transformations: z2.array(anthropicInputTransformationSchema).nullish(),
|
|
789
797
|
context_management: z2.object({
|
|
790
798
|
applied_edits: z2.array(
|
|
791
799
|
z2.union([
|
|
@@ -893,7 +901,7 @@ var anthropicSystemMessageProviderOptions = z3.object({
|
|
|
893
901
|
).optional()
|
|
894
902
|
});
|
|
895
903
|
var anthropicThinkingBlockBinding = z3.object({
|
|
896
|
-
prefixMismatchBehavior: z3.
|
|
904
|
+
prefixMismatchBehavior: z3.enum(["error", "drop_block"])
|
|
897
905
|
});
|
|
898
906
|
var anthropicLanguageModelOptions = z3.object({
|
|
899
907
|
/**
|
|
@@ -4474,6 +4482,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4474
4482
|
cacheCreationInputTokens: (_a2 = response.usage.cache_creation_input_tokens) != null ? _a2 : null,
|
|
4475
4483
|
stopSequence: (_b2 = response.stop_sequence) != null ? _b2 : null,
|
|
4476
4484
|
...stopDetails != null ? { stopDetails } : {},
|
|
4485
|
+
...response.input_transformations != null ? { inputTransformations: response.input_transformations } : {},
|
|
4477
4486
|
iterations: response.usage.iterations ? response.usage.iterations.map(
|
|
4478
4487
|
(iter) => ({
|
|
4479
4488
|
type: iter.type,
|
|
@@ -4563,6 +4572,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4563
4572
|
let cacheCreationInputTokens = null;
|
|
4564
4573
|
let stopSequence = null;
|
|
4565
4574
|
let stopDetails = void 0;
|
|
4575
|
+
let inputTransformations;
|
|
4566
4576
|
let container = null;
|
|
4567
4577
|
let isJsonResponseFromTool = false;
|
|
4568
4578
|
let isMessageOpen = false;
|
|
@@ -5227,6 +5237,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5227
5237
|
...value.message.usage
|
|
5228
5238
|
};
|
|
5229
5239
|
cacheCreationInputTokens = (_g = value.message.usage.cache_creation_input_tokens) != null ? _g : null;
|
|
5240
|
+
if (value.message.input_transformations != null) {
|
|
5241
|
+
inputTransformations = value.message.input_transformations;
|
|
5242
|
+
}
|
|
5230
5243
|
if (value.message.container != null) {
|
|
5231
5244
|
container = {
|
|
5232
5245
|
expiresAt: value.message.container.expires_at,
|
|
@@ -5327,6 +5340,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5327
5340
|
value.context_management
|
|
5328
5341
|
);
|
|
5329
5342
|
}
|
|
5343
|
+
if (value.input_transformations != null) {
|
|
5344
|
+
inputTransformations = value.input_transformations;
|
|
5345
|
+
}
|
|
5330
5346
|
rawUsage = {
|
|
5331
5347
|
...rawUsage,
|
|
5332
5348
|
...value.usage
|
|
@@ -5341,6 +5357,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5341
5357
|
cacheCreationInputTokens,
|
|
5342
5358
|
stopSequence,
|
|
5343
5359
|
...stopDetails != null ? { stopDetails } : {},
|
|
5360
|
+
...inputTransformations != null ? { inputTransformations } : {},
|
|
5344
5361
|
iterations: usage.iterations ? usage.iterations.map(
|
|
5345
5362
|
(iter) => ({
|
|
5346
5363
|
type: iter.type,
|