@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/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "3.0.9" : "0.0.0-test";
14
+ var VERSION = true ? "3.0.11" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -680,6 +680,7 @@ var anthropicMessagesChunkSchema = lazySchema2(
680
680
  }).nullish()
681
681
  }),
682
682
  usage: z2.looseObject({
683
+ input_tokens: z2.number().nullish(),
683
684
  output_tokens: z2.number(),
684
685
  cache_creation_input_tokens: z2.number().nullish()
685
686
  })
@@ -3697,6 +3698,9 @@ var AnthropicMessagesLanguageModel = class {
3697
3698
  return;
3698
3699
  }
3699
3700
  case "message_delta": {
3701
+ if (value.usage.input_tokens != null && usage.input_tokens !== value.usage.input_tokens) {
3702
+ usage.input_tokens = value.usage.input_tokens;
3703
+ }
3700
3704
  usage.output_tokens = value.usage.output_tokens;
3701
3705
  finishReason = {
3702
3706
  unified: mapAnthropicStopReason({
@@ -4318,7 +4322,8 @@ function createAnthropic(options = {}) {
4318
4322
  fetch: options.fetch,
4319
4323
  generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
4320
4324
  supportedUrls: () => ({
4321
- "image/*": [/^https?:\/\/.*$/]
4325
+ "image/*": [/^https?:\/\/.*$/],
4326
+ "application/pdf": [/^https?:\/\/.*$/]
4322
4327
  })
4323
4328
  });
4324
4329
  };