@ai-sdk/amazon-bedrock 4.0.155 → 4.0.157
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 +14 -0
- package/dist/anthropic/index.js +15 -12
- package/dist/anthropic/index.js.map +1 -1
- package/dist/anthropic/index.mjs +15 -12
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/index.js +15 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -12
- package/dist/index.mjs.map +1 -1
- package/dist/mantle/index.js +1 -1
- package/dist/mantle/index.mjs +1 -1
- package/package.json +2 -2
- package/src/bedrock-event-stream-decoder.ts +14 -12
package/dist/index.mjs
CHANGED
|
@@ -161,17 +161,20 @@ function createBedrockEventStreamDecoder(body, processEvent) {
|
|
|
161
161
|
if (buffer.length < totalLength) {
|
|
162
162
|
break;
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
164
|
+
const subView = buffer.subarray(0, totalLength);
|
|
165
|
+
const decoded = codec.decode(subView);
|
|
166
|
+
buffer = buffer.slice(totalLength);
|
|
167
|
+
const messageType = (_a = decoded.headers[":message-type"]) == null ? void 0 : _a.value;
|
|
168
|
+
const eventType = (_b = decoded.headers[":event-type"]) == null ? void 0 : _b.value;
|
|
169
|
+
const data = textDecoder.decode(decoded.body);
|
|
170
|
+
await processEvent({ messageType, eventType, data }, controller);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
flush() {
|
|
174
|
+
if (buffer.length > 0) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
`Incomplete Amazon Bedrock event-stream frame: ${buffer.length} buffered bytes remain at end of stream.`
|
|
177
|
+
);
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
})
|
|
@@ -2193,7 +2196,7 @@ import {
|
|
|
2193
2196
|
import { AwsV4Signer } from "aws4fetch";
|
|
2194
2197
|
|
|
2195
2198
|
// src/version.ts
|
|
2196
|
-
var VERSION = true ? "4.0.
|
|
2199
|
+
var VERSION = true ? "4.0.157" : "0.0.0-test";
|
|
2197
2200
|
|
|
2198
2201
|
// src/bedrock-sigv4-fetch.ts
|
|
2199
2202
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|