A method shaped like a generated streaming method, whose response is `body`.
(
client: AsyncAnthropic, body: Body, *, stream_cls: type[AsyncStream[object]] = AsyncStream[object]
)
| 240 | |
| 241 | |
| 242 | def async_requester( |
| 243 | client: AsyncAnthropic, body: Body, *, stream_cls: type[AsyncStream[object]] = AsyncStream[object] |
| 244 | ) -> AsyncRequest: |
| 245 | """A method shaped like a generated streaming method, whose response is `body`.""" |
| 246 | client = client.with_options(http_client=httpx2.AsyncClient(transport=body.transport())) |
| 247 | |
| 248 | async def request(*, extra_headers: Headers | None = None) -> AsyncStream[object]: |
| 249 | return await client.get( |
| 250 | "/stream", |
| 251 | cast_to=object, |
| 252 | options=make_request_options(extra_headers=extra_headers), |
| 253 | stream=True, |
| 254 | stream_cls=stream_cls, |
| 255 | ) |
| 256 | |
| 257 | return request |
| 258 | |
| 259 | |
| 260 | @contextlib.contextmanager |