(
request: HttpClientRequest.HttpClientRequest,
schema: Schema.Schema<A, I, R>
)
| 144 | ) |
| 145 | |
| 146 | const streamRequest = <A, I, R>( |
| 147 | request: HttpClientRequest.HttpClientRequest, |
| 148 | schema: Schema.Schema<A, I, R> |
| 149 | ): Stream.Stream<A, AiError.AiError, R> => |
| 150 | httpClientOk.execute(request).pipe( |
| 151 | Effect.map((r) => r.stream), |
| 152 | Stream.unwrapScoped, |
| 153 | Stream.pipeThroughChannel(EventStreamEncoding.makeChannel(schema)), |
| 154 | Stream.catchTags({ |
| 155 | RequestError: (error) => |
| 156 | AiError.HttpRequestError.fromRequestError({ |
| 157 | module: "AmazonBedrockClient", |
| 158 | method: "streamRequest", |
| 159 | error |
| 160 | }), |
| 161 | ResponseError: (error) => |
| 162 | AiError.HttpResponseError.fromResponseError({ |
| 163 | module: "AmazonBedrockClient", |
| 164 | method: "streamRequest", |
| 165 | error |
| 166 | }), |
| 167 | ParseError: (error) => |
| 168 | AiError.MalformedOutput.fromParseError({ |
| 169 | module: "AmazonBedrockClient", |
| 170 | method: "streamRequest", |
| 171 | error |
| 172 | }) |
| 173 | }) |
| 174 | ) |
| 175 | |
| 176 | const converseStream = (options: { |
| 177 | readonly params?: { "anthropic-beta"?: string | undefined } | undefined |
no test coverage detected