@ai-sdk/amazon-bedrock 3.0.0-beta.11 → 3.0.0-beta.13
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 +16 -0
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +31 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eb173f1: chore (providers): remove model shorthand deprecation warnings
|
|
8
|
+
- Updated dependencies [dd5fd43]
|
|
9
|
+
- @ai-sdk/provider-utils@3.0.0-beta.8
|
|
10
|
+
|
|
11
|
+
## 3.0.0-beta.12
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 0893170: fix(amazon-bedrock): handle empty activeTools with tool conversation history
|
|
16
|
+
- Updated dependencies [e7fcc86]
|
|
17
|
+
- @ai-sdk/provider-utils@3.0.0-beta.7
|
|
18
|
+
|
|
3
19
|
## 3.0.0-beta.11
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -96,7 +96,6 @@ interface AmazonBedrockProvider extends ProviderV2 {
|
|
|
96
96
|
embedding(modelId: BedrockEmbeddingModelId): EmbeddingModelV2<string>;
|
|
97
97
|
/**
|
|
98
98
|
Creates a model for image generation.
|
|
99
|
-
@deprecated Use `imageModel` instead.
|
|
100
99
|
*/
|
|
101
100
|
image(modelId: BedrockImageModelId): ImageModelV2;
|
|
102
101
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -96,7 +96,6 @@ interface AmazonBedrockProvider extends ProviderV2 {
|
|
|
96
96
|
embedding(modelId: BedrockEmbeddingModelId): EmbeddingModelV2<string>;
|
|
97
97
|
/**
|
|
98
98
|
Creates a model for image generation.
|
|
99
|
-
@deprecated Use `imageModel` instead.
|
|
100
99
|
*/
|
|
101
100
|
image(modelId: BedrockImageModelId): ImageModelV2;
|
|
102
101
|
/**
|
package/dist/index.js
CHANGED
|
@@ -181,7 +181,7 @@ function prepareTools({
|
|
|
181
181
|
if (tools == null) {
|
|
182
182
|
return {
|
|
183
183
|
toolConfig: {
|
|
184
|
-
tools:
|
|
184
|
+
tools: void 0,
|
|
185
185
|
toolChoice: void 0
|
|
186
186
|
},
|
|
187
187
|
toolWarnings: []
|
|
@@ -225,7 +225,7 @@ function prepareTools({
|
|
|
225
225
|
case "none":
|
|
226
226
|
return {
|
|
227
227
|
toolConfig: {
|
|
228
|
-
tools:
|
|
228
|
+
tools: void 0,
|
|
229
229
|
toolChoice: void 0
|
|
230
230
|
},
|
|
231
231
|
toolWarnings
|
|
@@ -651,7 +651,6 @@ var BedrockChatLanguageModel = class {
|
|
|
651
651
|
description: "Respond with a JSON object.",
|
|
652
652
|
inputSchema: responseFormat.schema
|
|
653
653
|
} : void 0;
|
|
654
|
-
const { system, messages } = await convertToBedrockChatMessages(prompt);
|
|
655
654
|
const isThinking = ((_b = bedrockOptions.reasoningConfig) == null ? void 0 : _b.type) === "enabled";
|
|
656
655
|
const thinkingBudget = (_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.budgetTokens;
|
|
657
656
|
const inferenceConfig = {
|
|
@@ -690,10 +689,37 @@ var BedrockChatLanguageModel = class {
|
|
|
690
689
|
details: "topP is not supported when thinking is enabled"
|
|
691
690
|
});
|
|
692
691
|
}
|
|
692
|
+
const activeTools = jsonResponseTool != null ? [jsonResponseTool] : tools != null ? tools : [];
|
|
693
|
+
let filteredPrompt = prompt;
|
|
694
|
+
if (activeTools.length === 0) {
|
|
695
|
+
const hasToolContent = prompt.some(
|
|
696
|
+
(message) => "content" in message && Array.isArray(message.content) && message.content.some(
|
|
697
|
+
(part) => part.type === "tool-call" || part.type === "tool-result"
|
|
698
|
+
)
|
|
699
|
+
);
|
|
700
|
+
if (hasToolContent) {
|
|
701
|
+
filteredPrompt = prompt.map(
|
|
702
|
+
(message) => message.role === "system" ? message : {
|
|
703
|
+
...message,
|
|
704
|
+
content: message.content.filter(
|
|
705
|
+
(part) => part.type !== "tool-call" && part.type !== "tool-result"
|
|
706
|
+
)
|
|
707
|
+
}
|
|
708
|
+
).filter(
|
|
709
|
+
(message) => message.role === "system" || message.content.length > 0
|
|
710
|
+
);
|
|
711
|
+
warnings.push({
|
|
712
|
+
type: "unsupported-setting",
|
|
713
|
+
setting: "toolContent",
|
|
714
|
+
details: "Tool calls and results removed from conversation because Bedrock does not support tool content without active tools."
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
const { system, messages } = await convertToBedrockChatMessages(filteredPrompt);
|
|
693
719
|
const { toolConfig, toolWarnings } = prepareTools({
|
|
694
|
-
tools:
|
|
720
|
+
tools: activeTools,
|
|
695
721
|
toolChoice: jsonResponseTool != null ? { type: "tool", toolName: jsonResponseTool.name } : toolChoice,
|
|
696
|
-
prompt
|
|
722
|
+
prompt: filteredPrompt
|
|
697
723
|
});
|
|
698
724
|
const { reasoningConfig: _, ...filteredBedrockOptions } = (providerOptions == null ? void 0 : providerOptions.bedrock) || {};
|
|
699
725
|
return {
|