@ai-sdk/anthropic 2.0.33 → 2.0.34

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/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  } from "@ai-sdk/provider-utils";
11
11
 
12
12
  // src/version.ts
13
- var VERSION = true ? "2.0.33" : "0.0.0-test";
13
+ var VERSION = true ? "2.0.34" : "0.0.0-test";
14
14
 
15
15
  // src/anthropic-messages-language-model.ts
16
16
  import {
@@ -238,7 +238,18 @@ var anthropicMessagesResponseSchema = lazySchema2(
238
238
  output_tokens: z2.number(),
239
239
  cache_creation_input_tokens: z2.number().nullish(),
240
240
  cache_read_input_tokens: z2.number().nullish()
241
- })
241
+ }),
242
+ container: z2.object({
243
+ expires_at: z2.string(),
244
+ id: z2.string(),
245
+ skills: z2.array(
246
+ z2.object({
247
+ type: z2.union([z2.literal("anthropic"), z2.literal("custom")]),
248
+ skill_id: z2.string(),
249
+ version: z2.string()
250
+ })
251
+ ).nullish()
252
+ }).nullish()
242
253
  })
243
254
  )
244
255
  );
@@ -468,7 +479,21 @@ var anthropicMessagesChunkSchema = lazySchema2(
468
479
  type: z2.literal("message_delta"),
469
480
  delta: z2.object({
470
481
  stop_reason: z2.string().nullish(),
471
- stop_sequence: z2.string().nullish()
482
+ stop_sequence: z2.string().nullish(),
483
+ container: z2.object({
484
+ expires_at: z2.string(),
485
+ id: z2.string(),
486
+ skills: z2.array(
487
+ z2.object({
488
+ type: z2.union([
489
+ z2.literal("anthropic"),
490
+ z2.literal("custom")
491
+ ]),
492
+ skill_id: z2.string(),
493
+ version: z2.string()
494
+ })
495
+ ).nullish()
496
+ }).nullish()
472
497
  }),
473
498
  usage: z2.looseObject({
474
499
  output_tokens: z2.number(),
@@ -1969,7 +1994,7 @@ var AnthropicMessagesLanguageModel = class {
1969
1994
  });
1970
1995
  }
1971
1996
  async doGenerate(options) {
1972
- var _a, _b, _c, _d, _e, _f;
1997
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1973
1998
  const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
1974
1999
  const citationDocuments = this.extractCitationDocuments(options.prompt);
1975
2000
  const {
@@ -2220,7 +2245,16 @@ var AnthropicMessagesLanguageModel = class {
2220
2245
  anthropic: {
2221
2246
  usage: response.usage,
2222
2247
  cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null,
2223
- stopSequence: (_f = response.stop_sequence) != null ? _f : null
2248
+ stopSequence: (_f = response.stop_sequence) != null ? _f : null,
2249
+ container: response.container ? {
2250
+ expiresAt: response.container.expires_at,
2251
+ id: response.container.id,
2252
+ skills: (_h = (_g = response.container.skills) == null ? void 0 : _g.map((skill) => ({
2253
+ type: skill.type,
2254
+ skillId: skill.skill_id,
2255
+ version: skill.version
2256
+ }))) != null ? _h : null
2257
+ } : null
2224
2258
  }
2225
2259
  }
2226
2260
  };
@@ -2250,6 +2284,7 @@ var AnthropicMessagesLanguageModel = class {
2250
2284
  let rawUsage = void 0;
2251
2285
  let cacheCreationInputTokens = null;
2252
2286
  let stopSequence = null;
2287
+ let container = null;
2253
2288
  let blockType = void 0;
2254
2289
  const generateId3 = this.generateId;
2255
2290
  return {
@@ -2259,7 +2294,7 @@ var AnthropicMessagesLanguageModel = class {
2259
2294
  controller.enqueue({ type: "stream-start", warnings });
2260
2295
  },
2261
2296
  transform(chunk, controller) {
2262
- var _a, _b, _c, _d, _e, _f, _g, _h;
2297
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2263
2298
  if (options.includeRawChunks) {
2264
2299
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2265
2300
  }
@@ -2640,6 +2675,15 @@ var AnthropicMessagesLanguageModel = class {
2640
2675
  isJsonResponseFromTool: usesJsonResponseTool
2641
2676
  });
2642
2677
  stopSequence = (_h = value.delta.stop_sequence) != null ? _h : null;
2678
+ container = value.delta.container != null ? {
2679
+ expiresAt: value.delta.container.expires_at,
2680
+ id: value.delta.container.id,
2681
+ skills: (_j = (_i = value.delta.container.skills) == null ? void 0 : _i.map((skill) => ({
2682
+ type: skill.type,
2683
+ skillId: skill.skill_id,
2684
+ version: skill.version
2685
+ }))) != null ? _j : null
2686
+ } : null;
2643
2687
  rawUsage = {
2644
2688
  ...rawUsage,
2645
2689
  ...value.usage
@@ -2655,7 +2699,8 @@ var AnthropicMessagesLanguageModel = class {
2655
2699
  anthropic: {
2656
2700
  usage: rawUsage != null ? rawUsage : null,
2657
2701
  cacheCreationInputTokens,
2658
- stopSequence
2702
+ stopSequence,
2703
+ container
2659
2704
  }
2660
2705
  }
2661
2706
  });