@ai-sdk/amazon-bedrock 4.0.113 → 4.0.115

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.
@@ -35,7 +35,7 @@ var import_provider_utils = require("@ai-sdk/provider-utils");
35
35
  var import_aws4fetch = require("aws4fetch");
36
36
 
37
37
  // src/version.ts
38
- var VERSION = true ? "4.0.113" : "0.0.0-test";
38
+ var VERSION = true ? "4.0.115" : "0.0.0-test";
39
39
 
40
40
  // src/bedrock-sigv4-fetch.ts
41
41
  function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
@@ -23,7 +23,7 @@ import {
23
23
  import { AwsV4Signer } from "aws4fetch";
24
24
 
25
25
  // src/version.ts
26
- var VERSION = true ? "4.0.113" : "0.0.0-test";
26
+ var VERSION = true ? "4.0.115" : "0.0.0-test";
27
27
 
28
28
  // src/bedrock-sigv4-fetch.ts
29
29
  function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
@@ -1586,6 +1586,7 @@ const result = await generateText({
1586
1586
 
1587
1587
  Anthropic has reasoning support for Claude 3.7 and Claude 4 models on Bedrock, including:
1588
1588
 
1589
+ - `us.anthropic.claude-fable-5`
1589
1590
  - `us.anthropic.claude-opus-4-8`
1590
1591
  - `us.anthropic.claude-opus-4-7`
1591
1592
  - `us.anthropic.claude-opus-4-6-v1`
@@ -1624,6 +1625,7 @@ on how to integrate reasoning into your chatbot.
1624
1625
 
1625
1626
  | Model | Image Input | Object Generation | Tool Usage | Computer Use | Reasoning |
1626
1627
  | ---------------------------------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
1628
+ | `us.anthropic.claude-fable-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
1627
1629
  | `us.anthropic.claude-opus-4-8` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
1628
1630
  | `us.anthropic.claude-opus-4-7` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
1629
1631
  | `us.anthropic.claude-opus-4-6-v1` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/amazon-bedrock",
3
- "version": "4.0.113",
3
+ "version": "4.0.115",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -44,8 +44,8 @@
44
44
  "@smithy/eventstream-codec": "^4.0.1",
45
45
  "@smithy/util-utf8": "^4.0.0",
46
46
  "aws4fetch": "^1.0.20",
47
- "@ai-sdk/anthropic": "3.0.81",
48
- "@ai-sdk/openai": "3.0.68",
47
+ "@ai-sdk/anthropic": "3.0.82",
48
+ "@ai-sdk/openai": "3.0.69",
49
49
  "@ai-sdk/provider": "3.0.10",
50
50
  "@ai-sdk/provider-utils": "4.0.27"
51
51
  },
@@ -1,4 +1,5 @@
1
1
  export type BedrockAnthropicModelId =
2
+ | 'anthropic.claude-fable-5'
2
3
  | 'anthropic.claude-opus-4-8'
3
4
  | 'anthropic.claude-opus-4-7'
4
5
  | 'anthropic.claude-opus-4-6-v1'
@@ -16,6 +17,7 @@ export type BedrockAnthropicModelId =
16
17
  | 'anthropic.claude-3-opus-20240229-v1:0'
17
18
  | 'anthropic.claude-3-sonnet-20240229-v1:0'
18
19
  | 'anthropic.claude-3-haiku-20240307-v1:0'
20
+ | 'us.anthropic.claude-fable-5'
19
21
  | 'us.anthropic.claude-opus-4-8'
20
22
  | 'us.anthropic.claude-opus-4-7'
21
23
  | 'us.anthropic.claude-opus-4-6-v1'
@@ -324,10 +324,11 @@ export function createBedrockAnthropic(
324
324
  // Bedrock Anthropic doesn't support URL sources, force download and base64 conversion
325
325
  supportedUrls: () => ({}),
326
326
  // native structured output via output_config.format is supported on Bedrock
327
- // Bedrock rejects `output_config.format` for `claude-opus-4-7` and `claude-opus-4-8`
327
+ // Bedrock rejects `output_config.format` for `claude-opus-4-7`, `claude-opus-4-8`, and `claude-fable-5`
328
328
  supportsNativeStructuredOutput:
329
329
  !modelId.includes('claude-opus-4-7') &&
330
- !modelId.includes('claude-opus-4-8'),
330
+ !modelId.includes('claude-opus-4-8') &&
331
+ !modelId.includes('claude-fable-5'),
331
332
  });
332
333
 
333
334
  const provider = function (modelId: BedrockAnthropicModelId) {
@@ -7,6 +7,7 @@ export type BedrockChatModelId =
7
7
  | 'anthropic.claude-v2'
8
8
  | 'anthropic.claude-v2:1'
9
9
  | 'anthropic.claude-instant-v1'
10
+ | 'anthropic.claude-fable-5'
10
11
  | 'anthropic.claude-opus-4-8'
11
12
  | 'anthropic.claude-opus-4-7'
12
13
  | 'anthropic.claude-opus-4-6-v1'
@@ -56,6 +57,7 @@ export type BedrockChatModelId =
56
57
  | 'us.anthropic.claude-3-5-haiku-20241022-v1:0'
57
58
  | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0'
58
59
  | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0'
60
+ | 'us.anthropic.claude-fable-5'
59
61
  | 'us.anthropic.claude-opus-4-8'
60
62
  | 'us.anthropic.claude-opus-4-7'
61
63
  | 'us.anthropic.claude-opus-4-6-v1'
@@ -104,7 +104,7 @@ export class BedrockEmbeddingModel implements EmbeddingModelV3 {
104
104
  };
105
105
 
106
106
  const url = this.getUrl(this.modelId);
107
- const { value: response } = await postJsonToApi({
107
+ const { value: response, responseHeaders } = await postJsonToApi({
108
108
  url,
109
109
  headers: await resolve(
110
110
  combineHeaders(await resolve(this.config.headers), headers),
@@ -145,12 +145,15 @@ export class BedrockEmbeddingModel implements EmbeddingModelV3 {
145
145
  }
146
146
 
147
147
  // Extract token count based on response format
148
+ const headerTokenCount = Number(
149
+ responseHeaders?.['x-amzn-bedrock-input-token-count'],
150
+ );
148
151
  const tokens =
149
152
  'inputTextTokenCount' in response
150
153
  ? response.inputTextTokenCount // Titan response
151
154
  : 'inputTokenCount' in response
152
155
  ? (response.inputTokenCount ?? 0) // Nova response
153
- : NaN; // Cohere doesn't return token count
156
+ : headerTokenCount;
154
157
 
155
158
  return {
156
159
  embeddings: [embedding],