@ai-sdk/amazon-bedrock 4.0.11 → 4.0.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 +12 -0
- package/dist/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -335,8 +335,8 @@ function convertBedrockUsage(usage) {
|
|
|
335
335
|
const cacheWriteTokens = (_b = usage.cacheWriteInputTokens) != null ? _b : 0;
|
|
336
336
|
return {
|
|
337
337
|
inputTokens: {
|
|
338
|
-
total: inputTokens,
|
|
339
|
-
noCache: inputTokens
|
|
338
|
+
total: inputTokens + cacheReadTokens + cacheWriteTokens,
|
|
339
|
+
noCache: inputTokens,
|
|
340
340
|
cacheRead: cacheReadTokens,
|
|
341
341
|
cacheWrite: cacheWriteTokens
|
|
342
342
|
},
|
|
@@ -840,16 +840,24 @@ var BedrockChatLanguageModel = class {
|
|
|
840
840
|
});
|
|
841
841
|
}
|
|
842
842
|
const maxReasoningEffort = (_f = bedrockOptions.reasoningConfig) == null ? void 0 : _f.maxReasoningEffort;
|
|
843
|
+
const isOpenAIModel = this.modelId.startsWith("openai.");
|
|
843
844
|
if (maxReasoningEffort != null && !isAnthropicModel) {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
845
|
+
if (isOpenAIModel) {
|
|
846
|
+
bedrockOptions.additionalModelRequestFields = {
|
|
847
|
+
...bedrockOptions.additionalModelRequestFields,
|
|
848
|
+
reasoning_effort: maxReasoningEffort
|
|
849
|
+
};
|
|
850
|
+
} else {
|
|
851
|
+
bedrockOptions.additionalModelRequestFields = {
|
|
852
|
+
...bedrockOptions.additionalModelRequestFields,
|
|
853
|
+
reasoningConfig: {
|
|
854
|
+
...((_g = bedrockOptions.reasoningConfig) == null ? void 0 : _g.type) != null && {
|
|
855
|
+
type: bedrockOptions.reasoningConfig.type
|
|
856
|
+
},
|
|
857
|
+
maxReasoningEffort
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
}
|
|
853
861
|
} else if (maxReasoningEffort != null && isAnthropicModel) {
|
|
854
862
|
warnings.push({
|
|
855
863
|
type: "unsupported",
|
|
@@ -1751,7 +1759,7 @@ import {
|
|
|
1751
1759
|
import { AwsV4Signer } from "aws4fetch";
|
|
1752
1760
|
|
|
1753
1761
|
// src/version.ts
|
|
1754
|
-
var VERSION = true ? "4.0.
|
|
1762
|
+
var VERSION = true ? "4.0.13" : "0.0.0-test";
|
|
1755
1763
|
|
|
1756
1764
|
// src/bedrock-sigv4-fetch.ts
|
|
1757
1765
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|