@ai-sdk/anthropic 2.0.22 → 2.0.23

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.22" : "0.0.0-test";
13
+ var VERSION = true ? "2.0.23" : "0.0.0-test";
14
14
 
15
15
  // src/anthropic-messages-language-model.ts
16
16
  import {
@@ -1197,7 +1197,7 @@ var AnthropicMessagesLanguageModel = class {
1197
1197
  });
1198
1198
  }
1199
1199
  async doGenerate(options) {
1200
- var _a, _b, _c, _d, _e;
1200
+ var _a, _b, _c, _d, _e, _f;
1201
1201
  const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
1202
1202
  const citationDocuments = this.extractCitationDocuments(options.prompt);
1203
1203
  const {
@@ -1424,7 +1424,8 @@ var AnthropicMessagesLanguageModel = class {
1424
1424
  providerMetadata: {
1425
1425
  anthropic: {
1426
1426
  usage: response.usage,
1427
- cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null
1427
+ cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null,
1428
+ stopSequence: (_f = response.stop_sequence) != null ? _f : null
1428
1429
  }
1429
1430
  }
1430
1431
  };
@@ -1453,6 +1454,7 @@ var AnthropicMessagesLanguageModel = class {
1453
1454
  const contentBlocks = {};
1454
1455
  let rawUsage = void 0;
1455
1456
  let cacheCreationInputTokens = null;
1457
+ let stopSequence = null;
1456
1458
  let blockType = void 0;
1457
1459
  const generateId3 = this.generateId;
1458
1460
  return {
@@ -1462,7 +1464,7 @@ var AnthropicMessagesLanguageModel = class {
1462
1464
  controller.enqueue({ type: "stream-start", warnings });
1463
1465
  },
1464
1466
  transform(chunk, controller) {
1465
- var _a, _b, _c, _d, _e, _f, _g;
1467
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1466
1468
  if (options.includeRawChunks) {
1467
1469
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1468
1470
  }
@@ -1800,6 +1802,7 @@ var AnthropicMessagesLanguageModel = class {
1800
1802
  finishReason: value.delta.stop_reason,
1801
1803
  isJsonResponseFromTool: usesJsonResponseTool
1802
1804
  });
1805
+ stopSequence = (_h = value.delta.stop_sequence) != null ? _h : null;
1803
1806
  rawUsage = {
1804
1807
  ...rawUsage,
1805
1808
  ...value.usage
@@ -1814,7 +1817,8 @@ var AnthropicMessagesLanguageModel = class {
1814
1817
  providerMetadata: {
1815
1818
  anthropic: {
1816
1819
  usage: rawUsage != null ? rawUsage : null,
1817
- cacheCreationInputTokens
1820
+ cacheCreationInputTokens,
1821
+ stopSequence
1818
1822
  }
1819
1823
  }
1820
1824
  });
@@ -1932,6 +1936,7 @@ var anthropicMessagesResponseSchema = z7.object({
1932
1936
  ])
1933
1937
  ),
1934
1938
  stop_reason: z7.string().nullish(),
1939
+ stop_sequence: z7.string().nullish(),
1935
1940
  usage: z7.looseObject({
1936
1941
  input_tokens: z7.number(),
1937
1942
  output_tokens: z7.number(),
@@ -2080,7 +2085,10 @@ var anthropicMessagesChunkSchema = z7.discriminatedUnion("type", [
2080
2085
  }),
2081
2086
  z7.object({
2082
2087
  type: z7.literal("message_delta"),
2083
- delta: z7.object({ stop_reason: z7.string().nullish() }),
2088
+ delta: z7.object({
2089
+ stop_reason: z7.string().nullish(),
2090
+ stop_sequence: z7.string().nullish()
2091
+ }),
2084
2092
  usage: z7.looseObject({
2085
2093
  output_tokens: z7.number(),
2086
2094
  cache_creation_input_tokens: z7.number().nullish()