@ai-sdk/amazon-bedrock 4.0.0-beta.103 → 4.0.0-beta.105
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 +17 -0
- package/dist/index.js +40 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -92,45 +92,6 @@ var BedrockErrorSchema = z2.object({
|
|
|
92
92
|
type: z2.string().nullish()
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
// src/convert-bedrock-usage.ts
|
|
96
|
-
function convertBedrockUsage(usage) {
|
|
97
|
-
var _a, _b;
|
|
98
|
-
if (usage == null) {
|
|
99
|
-
return {
|
|
100
|
-
inputTokens: {
|
|
101
|
-
total: void 0,
|
|
102
|
-
noCache: void 0,
|
|
103
|
-
cacheRead: void 0,
|
|
104
|
-
cacheWrite: void 0
|
|
105
|
-
},
|
|
106
|
-
outputTokens: {
|
|
107
|
-
total: void 0,
|
|
108
|
-
text: void 0,
|
|
109
|
-
reasoning: void 0
|
|
110
|
-
},
|
|
111
|
-
raw: void 0
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
const inputTokens = usage.inputTokens;
|
|
115
|
-
const outputTokens = usage.outputTokens;
|
|
116
|
-
const cacheReadTokens = (_a = usage.cacheReadInputTokens) != null ? _a : 0;
|
|
117
|
-
const cacheWriteTokens = (_b = usage.cacheWriteInputTokens) != null ? _b : 0;
|
|
118
|
-
return {
|
|
119
|
-
inputTokens: {
|
|
120
|
-
total: inputTokens,
|
|
121
|
-
noCache: inputTokens - cacheReadTokens,
|
|
122
|
-
cacheRead: cacheReadTokens,
|
|
123
|
-
cacheWrite: cacheWriteTokens
|
|
124
|
-
},
|
|
125
|
-
outputTokens: {
|
|
126
|
-
total: outputTokens,
|
|
127
|
-
text: outputTokens,
|
|
128
|
-
reasoning: void 0
|
|
129
|
-
},
|
|
130
|
-
raw: usage
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
95
|
// src/bedrock-event-stream-response-handler.ts
|
|
135
96
|
import { EmptyResponseBodyError } from "@ai-sdk/provider";
|
|
136
97
|
import {
|
|
@@ -349,6 +310,45 @@ async function prepareTools({
|
|
|
349
310
|
};
|
|
350
311
|
}
|
|
351
312
|
|
|
313
|
+
// src/convert-bedrock-usage.ts
|
|
314
|
+
function convertBedrockUsage(usage) {
|
|
315
|
+
var _a, _b;
|
|
316
|
+
if (usage == null) {
|
|
317
|
+
return {
|
|
318
|
+
inputTokens: {
|
|
319
|
+
total: void 0,
|
|
320
|
+
noCache: void 0,
|
|
321
|
+
cacheRead: void 0,
|
|
322
|
+
cacheWrite: void 0
|
|
323
|
+
},
|
|
324
|
+
outputTokens: {
|
|
325
|
+
total: void 0,
|
|
326
|
+
text: void 0,
|
|
327
|
+
reasoning: void 0
|
|
328
|
+
},
|
|
329
|
+
raw: void 0
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
const inputTokens = usage.inputTokens;
|
|
333
|
+
const outputTokens = usage.outputTokens;
|
|
334
|
+
const cacheReadTokens = (_a = usage.cacheReadInputTokens) != null ? _a : 0;
|
|
335
|
+
const cacheWriteTokens = (_b = usage.cacheWriteInputTokens) != null ? _b : 0;
|
|
336
|
+
return {
|
|
337
|
+
inputTokens: {
|
|
338
|
+
total: inputTokens,
|
|
339
|
+
noCache: inputTokens - cacheReadTokens,
|
|
340
|
+
cacheRead: cacheReadTokens,
|
|
341
|
+
cacheWrite: cacheWriteTokens
|
|
342
|
+
},
|
|
343
|
+
outputTokens: {
|
|
344
|
+
total: outputTokens,
|
|
345
|
+
text: outputTokens,
|
|
346
|
+
reasoning: void 0
|
|
347
|
+
},
|
|
348
|
+
raw: usage
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
|
|
352
352
|
// src/convert-to-bedrock-chat-messages.ts
|
|
353
353
|
import {
|
|
354
354
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
@@ -1734,7 +1734,7 @@ import {
|
|
|
1734
1734
|
import { AwsV4Signer } from "aws4fetch";
|
|
1735
1735
|
|
|
1736
1736
|
// src/version.ts
|
|
1737
|
-
var VERSION = true ? "4.0.0-beta.
|
|
1737
|
+
var VERSION = true ? "4.0.0-beta.105" : "0.0.0-test";
|
|
1738
1738
|
|
|
1739
1739
|
// src/bedrock-sigv4-fetch.ts
|
|
1740
1740
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|