@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.
@@ -224,7 +224,18 @@ var anthropicMessagesResponseSchema = lazySchema2(
224
224
  output_tokens: z2.number(),
225
225
  cache_creation_input_tokens: z2.number().nullish(),
226
226
  cache_read_input_tokens: z2.number().nullish()
227
- })
227
+ }),
228
+ container: z2.object({
229
+ expires_at: z2.string(),
230
+ id: z2.string(),
231
+ skills: z2.array(
232
+ z2.object({
233
+ type: z2.union([z2.literal("anthropic"), z2.literal("custom")]),
234
+ skill_id: z2.string(),
235
+ version: z2.string()
236
+ })
237
+ ).nullish()
238
+ }).nullish()
228
239
  })
229
240
  )
230
241
  );
@@ -454,7 +465,21 @@ var anthropicMessagesChunkSchema = lazySchema2(
454
465
  type: z2.literal("message_delta"),
455
466
  delta: z2.object({
456
467
  stop_reason: z2.string().nullish(),
457
- stop_sequence: z2.string().nullish()
468
+ stop_sequence: z2.string().nullish(),
469
+ container: z2.object({
470
+ expires_at: z2.string(),
471
+ id: z2.string(),
472
+ skills: z2.array(
473
+ z2.object({
474
+ type: z2.union([
475
+ z2.literal("anthropic"),
476
+ z2.literal("custom")
477
+ ]),
478
+ skill_id: z2.string(),
479
+ version: z2.string()
480
+ })
481
+ ).nullish()
482
+ }).nullish()
458
483
  }),
459
484
  usage: z2.looseObject({
460
485
  output_tokens: z2.number(),
@@ -1955,7 +1980,7 @@ var AnthropicMessagesLanguageModel = class {
1955
1980
  });
1956
1981
  }
1957
1982
  async doGenerate(options) {
1958
- var _a, _b, _c, _d, _e, _f;
1983
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1959
1984
  const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
1960
1985
  const citationDocuments = this.extractCitationDocuments(options.prompt);
1961
1986
  const {
@@ -2206,7 +2231,16 @@ var AnthropicMessagesLanguageModel = class {
2206
2231
  anthropic: {
2207
2232
  usage: response.usage,
2208
2233
  cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null,
2209
- stopSequence: (_f = response.stop_sequence) != null ? _f : null
2234
+ stopSequence: (_f = response.stop_sequence) != null ? _f : null,
2235
+ container: response.container ? {
2236
+ expiresAt: response.container.expires_at,
2237
+ id: response.container.id,
2238
+ skills: (_h = (_g = response.container.skills) == null ? void 0 : _g.map((skill) => ({
2239
+ type: skill.type,
2240
+ skillId: skill.skill_id,
2241
+ version: skill.version
2242
+ }))) != null ? _h : null
2243
+ } : null
2210
2244
  }
2211
2245
  }
2212
2246
  };
@@ -2236,6 +2270,7 @@ var AnthropicMessagesLanguageModel = class {
2236
2270
  let rawUsage = void 0;
2237
2271
  let cacheCreationInputTokens = null;
2238
2272
  let stopSequence = null;
2273
+ let container = null;
2239
2274
  let blockType = void 0;
2240
2275
  const generateId2 = this.generateId;
2241
2276
  return {
@@ -2245,7 +2280,7 @@ var AnthropicMessagesLanguageModel = class {
2245
2280
  controller.enqueue({ type: "stream-start", warnings });
2246
2281
  },
2247
2282
  transform(chunk, controller) {
2248
- var _a, _b, _c, _d, _e, _f, _g, _h;
2283
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2249
2284
  if (options.includeRawChunks) {
2250
2285
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2251
2286
  }
@@ -2626,6 +2661,15 @@ var AnthropicMessagesLanguageModel = class {
2626
2661
  isJsonResponseFromTool: usesJsonResponseTool
2627
2662
  });
2628
2663
  stopSequence = (_h = value.delta.stop_sequence) != null ? _h : null;
2664
+ container = value.delta.container != null ? {
2665
+ expiresAt: value.delta.container.expires_at,
2666
+ id: value.delta.container.id,
2667
+ skills: (_j = (_i = value.delta.container.skills) == null ? void 0 : _i.map((skill) => ({
2668
+ type: skill.type,
2669
+ skillId: skill.skill_id,
2670
+ version: skill.version
2671
+ }))) != null ? _j : null
2672
+ } : null;
2629
2673
  rawUsage = {
2630
2674
  ...rawUsage,
2631
2675
  ...value.usage
@@ -2641,7 +2685,8 @@ var AnthropicMessagesLanguageModel = class {
2641
2685
  anthropic: {
2642
2686
  usage: rawUsage != null ? rawUsage : null,
2643
2687
  cacheCreationInputTokens,
2644
- stopSequence
2688
+ stopSequence,
2689
+ container
2645
2690
  }
2646
2691
  }
2647
2692
  });