@ai-sdk/amazon-bedrock 4.0.144 → 4.0.146
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 +13 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mantle/index.js +1 -1
- package/dist/mantle/index.mjs +1 -1
- package/docs/08-amazon-bedrock.mdx +10 -0
- package/package.json +2 -2
- package/src/bedrock-chat-language-model.ts +5 -3
- package/src/bedrock-prepare-tools.ts +8 -0
package/dist/mantle/index.js
CHANGED
|
@@ -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.
|
|
38
|
+
var VERSION = true ? "4.0.146" : "0.0.0-test";
|
|
39
39
|
|
|
40
40
|
// src/bedrock-sigv4-fetch.ts
|
|
41
41
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|
package/dist/mantle/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { AwsV4Signer } from "aws4fetch";
|
|
24
24
|
|
|
25
25
|
// src/version.ts
|
|
26
|
-
var VERSION = true ? "4.0.
|
|
26
|
+
var VERSION = true ? "4.0.146" : "0.0.0-test";
|
|
27
27
|
|
|
28
28
|
// src/bedrock-sigv4-fetch.ts
|
|
29
29
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|
|
@@ -536,6 +536,11 @@ console.log(amazonResult.reasoningText); // reasoning text
|
|
|
536
536
|
console.log(amazonResult.text); // text response
|
|
537
537
|
```
|
|
538
538
|
|
|
539
|
+
For Anthropic models, Bedrock's `maxTokens` limit includes both thinking and
|
|
540
|
+
final text. The provider therefore adds `budgetTokens` to `maxOutputTokens`
|
|
541
|
+
when setting `maxTokens`. When `maxOutputTokens` is omitted, the provider adds
|
|
542
|
+
`budgetTokens` to the default of `4096`.
|
|
543
|
+
|
|
539
544
|
See [AI SDK UI: Chatbot](/docs/ai-sdk-ui/chatbot#reasoning) for more details
|
|
540
545
|
on how to integrate reasoning into your chatbot.
|
|
541
546
|
|
|
@@ -1619,6 +1624,11 @@ console.log(reasoning); // reasoning details including redacted reasoning
|
|
|
1619
1624
|
console.log(text); // text response
|
|
1620
1625
|
```
|
|
1621
1626
|
|
|
1627
|
+
Anthropic's `max_tokens` limit includes both thinking and final text. To reserve
|
|
1628
|
+
room for both, the provider adds `budgetTokens` to `maxOutputTokens` when
|
|
1629
|
+
setting `max_tokens`. For known models, the combined value is capped at the
|
|
1630
|
+
model's maximum output token limit.
|
|
1631
|
+
|
|
1622
1632
|
See [AI SDK UI: Chatbot](/docs/ai-sdk-ui/chatbot#reasoning) for more details
|
|
1623
1633
|
on how to integrate reasoning into your chatbot.
|
|
1624
1634
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/amazon-bedrock",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.146",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
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.
|
|
47
|
+
"@ai-sdk/anthropic": "3.0.105",
|
|
48
48
|
"@ai-sdk/openai": "3.0.90",
|
|
49
49
|
"@ai-sdk/provider": "3.0.14",
|
|
50
50
|
"@ai-sdk/provider-utils": "4.0.41"
|
|
@@ -38,7 +38,10 @@ import {
|
|
|
38
38
|
amazonBedrockLanguageModelOptions,
|
|
39
39
|
type BedrockChatModelId,
|
|
40
40
|
} from './bedrock-chat-options';
|
|
41
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
supportsNativeStructuredOutput,
|
|
43
|
+
supportsStrictTools,
|
|
44
|
+
} from './bedrock-anthropic-model-support';
|
|
42
45
|
import { BedrockErrorSchema } from './bedrock-error';
|
|
43
46
|
import { createBedrockEventStreamResponseHandler } from './bedrock-event-stream-response-handler';
|
|
44
47
|
import { prepareTools } from './bedrock-prepare-tools';
|
|
@@ -164,8 +167,7 @@ export class BedrockChatLanguageModel implements LanguageModelV3 {
|
|
|
164
167
|
|
|
165
168
|
const useJsonInstructionForStructuredOutput =
|
|
166
169
|
isAnthropicModel &&
|
|
167
|
-
(this.modelId
|
|
168
|
-
this.modelId.includes('claude-opus-4-8')) &&
|
|
170
|
+
!supportsStrictTools(this.modelId) &&
|
|
169
171
|
responseFormat?.type === 'json' &&
|
|
170
172
|
responseFormat.schema != null &&
|
|
171
173
|
tools != null &&
|
|
@@ -137,6 +137,14 @@ export async function prepareTools({
|
|
|
137
137
|
const supportsStrictOnTools = supportsStrictTools(modelId);
|
|
138
138
|
|
|
139
139
|
for (const tool of filteredFunctionTools) {
|
|
140
|
+
if (!supportsStrictOnTools && tool.strict != null) {
|
|
141
|
+
toolWarnings.push({
|
|
142
|
+
type: 'unsupported',
|
|
143
|
+
feature: 'strict',
|
|
144
|
+
details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this model on Amazon Bedrock. The strict property will be ignored.`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
140
148
|
bedrockTools.push({
|
|
141
149
|
toolSpec: {
|
|
142
150
|
name: tool.name,
|