@ai-sdk/anthropic 3.0.9 → 3.0.11

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 8c1c6e3: fix(anthropic): add application/json type regex matching
8
+
9
+ ## 3.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - 02d9b68: fix `input_tokens` compatibility
14
+
3
15
  ## 3.0.9
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
32
32
  var import_provider_utils22 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.9" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.11" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
@@ -686,6 +686,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
686
686
  }).nullish()
687
687
  }),
688
688
  usage: import_v42.z.looseObject({
689
+ input_tokens: import_v42.z.number().nullish(),
689
690
  output_tokens: import_v42.z.number(),
690
691
  cache_creation_input_tokens: import_v42.z.number().nullish()
691
692
  })
@@ -3674,6 +3675,9 @@ var AnthropicMessagesLanguageModel = class {
3674
3675
  return;
3675
3676
  }
3676
3677
  case "message_delta": {
3678
+ if (value.usage.input_tokens != null && usage.input_tokens !== value.usage.input_tokens) {
3679
+ usage.input_tokens = value.usage.input_tokens;
3680
+ }
3677
3681
  usage.output_tokens = value.usage.output_tokens;
3678
3682
  finishReason = {
3679
3683
  unified: mapAnthropicStopReason({
@@ -4259,7 +4263,8 @@ function createAnthropic(options = {}) {
4259
4263
  fetch: options.fetch,
4260
4264
  generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils22.generateId,
4261
4265
  supportedUrls: () => ({
4262
- "image/*": [/^https?:\/\/.*$/]
4266
+ "image/*": [/^https?:\/\/.*$/],
4267
+ "application/pdf": [/^https?:\/\/.*$/]
4263
4268
  })
4264
4269
  });
4265
4270
  };