@ai-sdk/anthropic 3.0.0-beta.31 → 3.0.0-beta.32
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 +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.js +52 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +51 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +51 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -256,7 +256,18 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
256
256
|
output_tokens: import_v42.z.number(),
|
|
257
257
|
cache_creation_input_tokens: import_v42.z.number().nullish(),
|
|
258
258
|
cache_read_input_tokens: import_v42.z.number().nullish()
|
|
259
|
-
})
|
|
259
|
+
}),
|
|
260
|
+
container: import_v42.z.object({
|
|
261
|
+
expires_at: import_v42.z.string(),
|
|
262
|
+
id: import_v42.z.string(),
|
|
263
|
+
skills: import_v42.z.array(
|
|
264
|
+
import_v42.z.object({
|
|
265
|
+
type: import_v42.z.union([import_v42.z.literal("anthropic"), import_v42.z.literal("custom")]),
|
|
266
|
+
skill_id: import_v42.z.string(),
|
|
267
|
+
version: import_v42.z.string()
|
|
268
|
+
})
|
|
269
|
+
).nullish()
|
|
270
|
+
}).nullish()
|
|
260
271
|
})
|
|
261
272
|
)
|
|
262
273
|
);
|
|
@@ -504,7 +515,21 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
504
515
|
type: import_v42.z.literal("message_delta"),
|
|
505
516
|
delta: import_v42.z.object({
|
|
506
517
|
stop_reason: import_v42.z.string().nullish(),
|
|
507
|
-
stop_sequence: import_v42.z.string().nullish()
|
|
518
|
+
stop_sequence: import_v42.z.string().nullish(),
|
|
519
|
+
container: import_v42.z.object({
|
|
520
|
+
expires_at: import_v42.z.string(),
|
|
521
|
+
id: import_v42.z.string(),
|
|
522
|
+
skills: import_v42.z.array(
|
|
523
|
+
import_v42.z.object({
|
|
524
|
+
type: import_v42.z.union([
|
|
525
|
+
import_v42.z.literal("anthropic"),
|
|
526
|
+
import_v42.z.literal("custom")
|
|
527
|
+
]),
|
|
528
|
+
skill_id: import_v42.z.string(),
|
|
529
|
+
version: import_v42.z.string()
|
|
530
|
+
})
|
|
531
|
+
).nullish()
|
|
532
|
+
}).nullish()
|
|
508
533
|
}),
|
|
509
534
|
usage: import_v42.z.looseObject({
|
|
510
535
|
output_tokens: import_v42.z.number(),
|
|
@@ -2060,7 +2085,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2060
2085
|
});
|
|
2061
2086
|
}
|
|
2062
2087
|
async doGenerate(options) {
|
|
2063
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2088
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2064
2089
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
|
|
2065
2090
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
2066
2091
|
const {
|
|
@@ -2343,7 +2368,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2343
2368
|
anthropic: {
|
|
2344
2369
|
usage: response.usage,
|
|
2345
2370
|
cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null,
|
|
2346
|
-
stopSequence: (_f = response.stop_sequence) != null ? _f : null
|
|
2371
|
+
stopSequence: (_f = response.stop_sequence) != null ? _f : null,
|
|
2372
|
+
container: response.container ? {
|
|
2373
|
+
expiresAt: response.container.expires_at,
|
|
2374
|
+
id: response.container.id,
|
|
2375
|
+
skills: (_h = (_g = response.container.skills) == null ? void 0 : _g.map((skill) => ({
|
|
2376
|
+
type: skill.type,
|
|
2377
|
+
skillId: skill.skill_id,
|
|
2378
|
+
version: skill.version
|
|
2379
|
+
}))) != null ? _h : null
|
|
2380
|
+
} : null
|
|
2347
2381
|
}
|
|
2348
2382
|
}
|
|
2349
2383
|
};
|
|
@@ -2374,6 +2408,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2374
2408
|
let rawUsage = void 0;
|
|
2375
2409
|
let cacheCreationInputTokens = null;
|
|
2376
2410
|
let stopSequence = null;
|
|
2411
|
+
let container = null;
|
|
2377
2412
|
let blockType = void 0;
|
|
2378
2413
|
const generateId2 = this.generateId;
|
|
2379
2414
|
return {
|
|
@@ -2383,7 +2418,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2383
2418
|
controller.enqueue({ type: "stream-start", warnings });
|
|
2384
2419
|
},
|
|
2385
2420
|
transform(chunk, controller) {
|
|
2386
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2421
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2387
2422
|
if (options.includeRawChunks) {
|
|
2388
2423
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
2389
2424
|
}
|
|
@@ -2792,6 +2827,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2792
2827
|
isJsonResponseFromTool: usesJsonResponseTool
|
|
2793
2828
|
});
|
|
2794
2829
|
stopSequence = (_h = value.delta.stop_sequence) != null ? _h : null;
|
|
2830
|
+
container = value.delta.container != null ? {
|
|
2831
|
+
expiresAt: value.delta.container.expires_at,
|
|
2832
|
+
id: value.delta.container.id,
|
|
2833
|
+
skills: (_j = (_i = value.delta.container.skills) == null ? void 0 : _i.map((skill) => ({
|
|
2834
|
+
type: skill.type,
|
|
2835
|
+
skillId: skill.skill_id,
|
|
2836
|
+
version: skill.version
|
|
2837
|
+
}))) != null ? _j : null
|
|
2838
|
+
} : null;
|
|
2795
2839
|
rawUsage = {
|
|
2796
2840
|
...rawUsage,
|
|
2797
2841
|
...value.usage
|
|
@@ -2807,7 +2851,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2807
2851
|
anthropic: {
|
|
2808
2852
|
usage: rawUsage != null ? rawUsage : null,
|
|
2809
2853
|
cacheCreationInputTokens,
|
|
2810
|
-
stopSequence
|
|
2854
|
+
stopSequence,
|
|
2855
|
+
container
|
|
2811
2856
|
}
|
|
2812
2857
|
}
|
|
2813
2858
|
});
|