@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.js
CHANGED
|
@@ -73,6 +73,11 @@ var anthropicToolCallCallerSchema = import_v42.z.union([
|
|
|
73
73
|
type: import_v42.z.literal("direct")
|
|
74
74
|
})
|
|
75
75
|
]);
|
|
76
|
+
var anthropicInputTransformationSchema = import_v42.z.object({
|
|
77
|
+
type: import_v42.z.string(),
|
|
78
|
+
path: import_v42.z.string(),
|
|
79
|
+
reason: import_v42.z.string()
|
|
80
|
+
});
|
|
76
81
|
var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
77
82
|
() => (0, import_provider_utils2.zodSchema)(
|
|
78
83
|
import_v42.z.object({
|
|
@@ -352,6 +357,7 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
352
357
|
stop_reason: import_v42.z.string().nullish(),
|
|
353
358
|
stop_sequence: import_v42.z.string().nullish(),
|
|
354
359
|
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
360
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
355
361
|
usage: import_v42.z.looseObject({
|
|
356
362
|
input_tokens: import_v42.z.number(),
|
|
357
363
|
output_tokens: import_v42.z.number(),
|
|
@@ -436,6 +442,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
436
442
|
])
|
|
437
443
|
).nullish(),
|
|
438
444
|
stop_reason: import_v42.z.string().nullish(),
|
|
445
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
439
446
|
container: import_v42.z.object({
|
|
440
447
|
expires_at: import_v42.z.string(),
|
|
441
448
|
id: import_v42.z.string()
|
|
@@ -796,6 +803,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
796
803
|
})
|
|
797
804
|
).nullish()
|
|
798
805
|
}),
|
|
806
|
+
input_transformations: import_v42.z.array(anthropicInputTransformationSchema).nullish(),
|
|
799
807
|
context_management: import_v42.z.object({
|
|
800
808
|
applied_edits: import_v42.z.array(
|
|
801
809
|
import_v42.z.union([
|
|
@@ -903,7 +911,7 @@ var anthropicSystemMessageProviderOptions = import_v43.z.object({
|
|
|
903
911
|
).optional()
|
|
904
912
|
});
|
|
905
913
|
var anthropicThinkingBlockBinding = import_v43.z.object({
|
|
906
|
-
prefixMismatchBehavior: import_v43.z.
|
|
914
|
+
prefixMismatchBehavior: import_v43.z.enum(["error", "drop_block"])
|
|
907
915
|
});
|
|
908
916
|
var anthropicLanguageModelOptions = import_v43.z.object({
|
|
909
917
|
/**
|
|
@@ -4432,6 +4440,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4432
4440
|
cacheCreationInputTokens: (_a2 = response.usage.cache_creation_input_tokens) != null ? _a2 : null,
|
|
4433
4441
|
stopSequence: (_b2 = response.stop_sequence) != null ? _b2 : null,
|
|
4434
4442
|
...stopDetails != null ? { stopDetails } : {},
|
|
4443
|
+
...response.input_transformations != null ? { inputTransformations: response.input_transformations } : {},
|
|
4435
4444
|
iterations: response.usage.iterations ? response.usage.iterations.map(
|
|
4436
4445
|
(iter) => ({
|
|
4437
4446
|
type: iter.type,
|
|
@@ -4521,6 +4530,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4521
4530
|
let cacheCreationInputTokens = null;
|
|
4522
4531
|
let stopSequence = null;
|
|
4523
4532
|
let stopDetails = void 0;
|
|
4533
|
+
let inputTransformations;
|
|
4524
4534
|
let container = null;
|
|
4525
4535
|
let isJsonResponseFromTool = false;
|
|
4526
4536
|
let isMessageOpen = false;
|
|
@@ -5185,6 +5195,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5185
5195
|
...value.message.usage
|
|
5186
5196
|
};
|
|
5187
5197
|
cacheCreationInputTokens = (_g = value.message.usage.cache_creation_input_tokens) != null ? _g : null;
|
|
5198
|
+
if (value.message.input_transformations != null) {
|
|
5199
|
+
inputTransformations = value.message.input_transformations;
|
|
5200
|
+
}
|
|
5188
5201
|
if (value.message.container != null) {
|
|
5189
5202
|
container = {
|
|
5190
5203
|
expiresAt: value.message.container.expires_at,
|
|
@@ -5285,6 +5298,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5285
5298
|
value.context_management
|
|
5286
5299
|
);
|
|
5287
5300
|
}
|
|
5301
|
+
if (value.input_transformations != null) {
|
|
5302
|
+
inputTransformations = value.input_transformations;
|
|
5303
|
+
}
|
|
5288
5304
|
rawUsage = {
|
|
5289
5305
|
...rawUsage,
|
|
5290
5306
|
...value.usage
|
|
@@ -5299,6 +5315,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5299
5315
|
cacheCreationInputTokens,
|
|
5300
5316
|
stopSequence,
|
|
5301
5317
|
...stopDetails != null ? { stopDetails } : {},
|
|
5318
|
+
...inputTransformations != null ? { inputTransformations } : {},
|
|
5302
5319
|
iterations: usage.iterations ? usage.iterations.map(
|
|
5303
5320
|
(iter) => ({
|
|
5304
5321
|
type: iter.type,
|