@ai-sdk/amazon-bedrock 3.0.116 → 3.0.117

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
@@ -8,7 +8,7 @@ import {
8
8
  } from "@ai-sdk/provider-utils";
9
9
 
10
10
  // src/version.ts
11
- var VERSION = true ? "3.0.116" : "0.0.0-test";
11
+ var VERSION = true ? "3.0.117" : "0.0.0-test";
12
12
 
13
13
  // src/bedrock-provider.ts
14
14
  import { anthropicTools as anthropicTools2 } from "@ai-sdk/anthropic/internal";
@@ -145,17 +145,20 @@ function createBedrockEventStreamDecoder(body, processEvent) {
145
145
  if (buffer.length < totalLength) {
146
146
  break;
147
147
  }
148
- try {
149
- const subView = buffer.subarray(0, totalLength);
150
- const decoded = codec.decode(subView);
151
- buffer = buffer.slice(totalLength);
152
- const messageType = (_a = decoded.headers[":message-type"]) == null ? void 0 : _a.value;
153
- const eventType = (_b = decoded.headers[":event-type"]) == null ? void 0 : _b.value;
154
- const data = textDecoder.decode(decoded.body);
155
- await processEvent({ messageType, eventType, data }, controller);
156
- } catch (e) {
157
- break;
158
- }
148
+ const subView = buffer.subarray(0, totalLength);
149
+ const decoded = codec.decode(subView);
150
+ buffer = buffer.slice(totalLength);
151
+ const messageType = (_a = decoded.headers[":message-type"]) == null ? void 0 : _a.value;
152
+ const eventType = (_b = decoded.headers[":event-type"]) == null ? void 0 : _b.value;
153
+ const data = textDecoder.decode(decoded.body);
154
+ await processEvent({ messageType, eventType, data }, controller);
155
+ }
156
+ },
157
+ flush() {
158
+ if (buffer.length > 0) {
159
+ throw new Error(
160
+ `Incomplete Amazon Bedrock event-stream frame: ${buffer.length} buffered bytes remain at end of stream.`
161
+ );
159
162
  }
160
163
  }
161
164
  })