@ai-sdk/amazon-bedrock 3.0.3 → 3.0.5
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 +12 -0
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -448,6 +448,9 @@ async function convertToBedrockChatMessages(prompt) {
|
|
|
448
448
|
const isLastContentPart = k === content.length - 1;
|
|
449
449
|
switch (part.type) {
|
|
450
450
|
case "text": {
|
|
451
|
+
if (!part.text.trim()) {
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
451
454
|
bedrockContent.push({
|
|
452
455
|
text: (
|
|
453
456
|
// trim the last text part if it's the last message in the block
|
|
@@ -707,17 +710,17 @@ var BedrockChatLanguageModel = class {
|
|
|
707
710
|
const isThinking = ((_b = bedrockOptions.reasoningConfig) == null ? void 0 : _b.type) === "enabled";
|
|
708
711
|
const thinkingBudget = (_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.budgetTokens;
|
|
709
712
|
const inferenceConfig = {
|
|
710
|
-
...maxOutputTokens != null && { maxOutputTokens },
|
|
713
|
+
...maxOutputTokens != null && { maxTokens: maxOutputTokens },
|
|
711
714
|
...temperature != null && { temperature },
|
|
712
715
|
...topP != null && { topP },
|
|
713
716
|
...topK != null && { topK },
|
|
714
717
|
...stopSequences != null && { stopSequences }
|
|
715
718
|
};
|
|
716
719
|
if (isThinking && thinkingBudget != null) {
|
|
717
|
-
if (inferenceConfig.
|
|
718
|
-
inferenceConfig.
|
|
720
|
+
if (inferenceConfig.maxTokens != null) {
|
|
721
|
+
inferenceConfig.maxTokens += thinkingBudget;
|
|
719
722
|
} else {
|
|
720
|
-
inferenceConfig.
|
|
723
|
+
inferenceConfig.maxTokens = thinkingBudget + 4096;
|
|
721
724
|
}
|
|
722
725
|
bedrockOptions.additionalModelRequestFields = {
|
|
723
726
|
...bedrockOptions.additionalModelRequestFields,
|