Skip to content

Commit

Permalink
fix(bedrock): update streaming util import
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie committed Jan 23, 2025
1 parent c12540b commit 255c059
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const pkgJson = require('../dist/package.json');
for (const dep in pkgJson.dependencies) {
// ensure we point to NPM instead of a local directory
if (dep === '@anthropic-ai/sdk') {
pkgJson.dependencies[dep] = '>=0.35 <1';
pkgJson.dependencies[dep] = '>=0.36 <1';
}
}

Expand Down
9 changes: 3 additions & 6 deletions packages/bedrock-sdk/src/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import { EventStreamMarshaller } from '@smithy/eventstream-serde-node';
import { fromBase64, toBase64 } from '@smithy/util-base64';
import { streamCollector } from '@smithy/fetch-http-handler';
import { EventStreamSerdeContext, SerdeContext } from '@smithy/types';
import {
Stream as CoreStream,
readableStreamAsyncIterable,
ServerSentEvent,
} from '@anthropic-ai/sdk/streaming';
import { Stream as CoreStream, ServerSentEvent } from '@anthropic-ai/sdk/streaming';
import { ReadableStreamToAsyncIterable } from '@anthropic-ai/sdk/internal/stream-utils';
import { AnthropicError } from '@anthropic-ai/sdk/error';
import { APIError } from '@anthropic-ai/sdk';
import { createResponseHeaders, safeJSON } from '@anthropic-ai/sdk/core';
Expand Down Expand Up @@ -42,7 +39,7 @@ export class Stream<Item> extends CoreStream<Item> {
throw new AnthropicError(`Attempted to iterate over a response with no body`);
}

const responseBodyIter = readableStreamAsyncIterable<Bytes>(response.body);
const responseBodyIter = ReadableStreamToAsyncIterable<Bytes>(response.body);
const eventStream = de_ResponseStream(responseBodyIter, getMinimalSerdeContext());
for await (const event of eventStream) {
if (event.chunk && event.chunk.bytes) {
Expand Down
6 changes: 0 additions & 6 deletions packages/bedrock-sdk/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
form-data-encoder "1.7.2"
formdata-node "^4.3.2"
node-fetch "^2.6.7"
web-streams-polyfill "^3.2.1"

"@aws-crypto/crc32@3.0.0":
version "3.0.0"
Expand Down Expand Up @@ -4212,11 +4211,6 @@ web-streams-polyfill@4.0.0-beta.3:
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz#2898486b74f5156095e473efe989dcf185047a38"
integrity sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==

web-streams-polyfill@^3.2.1:
version "3.3.2"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz#32e26522e05128203a7de59519be3c648004343b"
integrity sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
Expand Down

0 comments on commit 255c059

Please sign in to comment.