@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.
@@ -238,7 +238,18 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
238
238
  output_tokens: import_v42.z.number(),
239
239
  cache_creation_input_tokens: import_v42.z.number().nullish(),
240
240
  cache_read_input_tokens: import_v42.z.number().nullish()
241
- })
241
+ }),
242
+ container: import_v42.z.object({
243
+ expires_at: import_v42.z.string(),
244
+ id: import_v42.z.string(),
245
+ skills: import_v42.z.array(
246
+ import_v42.z.object({
247
+ type: import_v42.z.union([import_v42.z.literal("anthropic"), import_v42.z.literal("custom")]),
248
+ skill_id: import_v42.z.string(),
249
+ version: import_v42.z.string()
250
+ })
251
+ ).nullish()
252
+ }).nullish()
242
253
  })
243
254
  )
244
255
  );
@@ -468,7 +479,21 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
468
479
  type: import_v42.z.literal("message_delta"),
469
480
  delta: import_v42.z.object({
470
481
  stop_reason: import_v42.z.string().nullish(),
471
- stop_sequence: import_v42.z.string().nullish()
482
+ stop_sequence: import_v42.z.string().nullish(),
483
+ container: import_v42.z.object({
484
+ expires_at: import_v42.z.string(),
485
+ id: import_v42.z.string(),
486
+ skills: import_v42.z.array(
487
+ import_v42.z.object({
488
+ type: import_v42.z.union([
489
+ import_v42.z.literal("anthropic"),
490
+ import_v42.z.literal("custom")
491
+ ]),
492
+ skill_id: import_v42.z.string(),
493
+ version: import_v42.z.string()
494
+ })
495
+ ).nullish()
496
+ }).nullish()
472
497
  }),
473
498
  usage: import_v42.z.looseObject({
474
499
  output_tokens: import_v42.z.number(),
@@ -1945,7 +1970,7 @@ var AnthropicMessagesLanguageModel = class {
1945
1970
  });
1946
1971
  }
1947
1972
  async doGenerate(options) {
1948
- var _a, _b, _c, _d, _e, _f;
1973
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1949
1974
  const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
1950
1975
  const citationDocuments = this.extractCitationDocuments(options.prompt);
1951
1976
  const {
@@ -2196,7 +2221,16 @@ var AnthropicMessagesLanguageModel = class {
2196
2221
  anthropic: {
2197
2222
  usage: response.usage,
2198
2223
  cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null,
2199
- stopSequence: (_f = response.stop_sequence) != null ? _f : null
2224
+ stopSequence: (_f = response.stop_sequence) != null ? _f : null,
2225
+ container: response.container ? {
2226
+ expiresAt: response.container.expires_at,
2227
+ id: response.container.id,
2228
+ skills: (_h = (_g = response.container.skills) == null ? void 0 : _g.map((skill) => ({
2229
+ type: skill.type,
2230
+ skillId: skill.skill_id,
2231
+ version: skill.version
2232
+ }))) != null ? _h : null
2233
+ } : null
2200
2234
  }
2201
2235
  }
2202
2236
  };
@@ -2226,6 +2260,7 @@ var AnthropicMessagesLanguageModel = class {
2226
2260
  let rawUsage = void 0;
2227
2261
  let cacheCreationInputTokens = null;
2228
2262
  let stopSequence = null;
2263
+ let container = null;
2229
2264
  let blockType = void 0;
2230
2265
  const generateId2 = this.generateId;
2231
2266
  return {
@@ -2235,7 +2270,7 @@ var AnthropicMessagesLanguageModel = class {
2235
2270
  controller.enqueue({ type: "stream-start", warnings });
2236
2271
  },
2237
2272
  transform(chunk, controller) {
2238
- var _a, _b, _c, _d, _e, _f, _g, _h;
2273
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2239
2274
  if (options.includeRawChunks) {
2240
2275
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2241
2276
  }
@@ -2616,6 +2651,15 @@ var AnthropicMessagesLanguageModel = class {
2616
2651
  isJsonResponseFromTool: usesJsonResponseTool
2617
2652
  });
2618
2653
  stopSequence = (_h = value.delta.stop_sequence) != null ? _h : null;
2654
+ container = value.delta.container != null ? {
2655
+ expiresAt: value.delta.container.expires_at,
2656
+ id: value.delta.container.id,
2657
+ skills: (_j = (_i = value.delta.container.skills) == null ? void 0 : _i.map((skill) => ({
2658
+ type: skill.type,
2659
+ skillId: skill.skill_id,
2660
+ version: skill.version
2661
+ }))) != null ? _j : null
2662
+ } : null;
2619
2663
  rawUsage = {
2620
2664
  ...rawUsage,
2621
2665
  ...value.usage
@@ -2631,7 +2675,8 @@ var AnthropicMessagesLanguageModel = class {
2631
2675
  anthropic: {
2632
2676
  usage: rawUsage != null ? rawUsage : null,
2633
2677
  cacheCreationInputTokens,
2634
- stopSequence
2678
+ stopSequence,
2679
+ container
2635
2680
  }
2636
2681
  }
2637
2682
  });