@ai-sdk/amazon-bedrock 3.0.2 → 3.0.4

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
@@ -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
@@ -671,12 +674,6 @@ var BedrockChatLanguageModel = class {
671
674
  setting: "seed"
672
675
  });
673
676
  }
674
- if (topK != null) {
675
- warnings.push({
676
- type: "unsupported-setting",
677
- setting: "topK"
678
- });
679
- }
680
677
  if (responseFormat != null && responseFormat.type !== "text" && responseFormat.type !== "json") {
681
678
  warnings.push({
682
679
  type: "unsupported-setting",
@@ -716,6 +713,7 @@ var BedrockChatLanguageModel = class {
716
713
  ...maxOutputTokens != null && { maxOutputTokens },
717
714
  ...temperature != null && { temperature },
718
715
  ...topP != null && { topP },
716
+ ...topK != null && { topK },
719
717
  ...stopSequences != null && { stopSequences }
720
718
  };
721
719
  if (isThinking && thinkingBudget != null) {
@@ -748,6 +746,14 @@ var BedrockChatLanguageModel = class {
748
746
  details: "topP is not supported when thinking is enabled"
749
747
  });
750
748
  }
749
+ if (isThinking && inferenceConfig.topK != null) {
750
+ delete inferenceConfig.topK;
751
+ warnings.push({
752
+ type: "unsupported-setting",
753
+ setting: "topK",
754
+ details: "topK is not supported when thinking is enabled"
755
+ });
756
+ }
751
757
  const hasAnyTools = ((_f = (_e = toolConfig.tools) == null ? void 0 : _e.length) != null ? _f : 0) > 0 || additionalTools;
752
758
  let filteredPrompt = prompt;
753
759
  if (!hasAnyTools) {