A method shaped like a generated streaming method, whose response is `body`.
(
client: AsyncAnthropic, body: Body, *, stream_cls: type[AsyncStream[object]] = AsyncStream[object]
)
| 258 | |
| 259 | |
| 260 | def async_requester( |
| 261 | client: AsyncAnthropic, body: Body, *, stream_cls: type[AsyncStream[object]] = AsyncStream[object] |
| 262 | ) -> AsyncRequest: |
| 263 | """A method shaped like a generated streaming method, whose response is `body`.""" |
| 264 | client = client.with_options(http_client=httpx2.AsyncClient(transport=body.transport())) |
| 265 | |
| 266 | async def request(*, extra_headers: Headers | None = None) -> AsyncStream[object]: |
| 267 | return await client.get( |
| 268 | "/stream", |
| 269 | cast_to=object, |
| 270 | options=make_request_options(extra_headers=extra_headers), |
| 271 | stream=True, |
| 272 | stream_cls=stream_cls, |
| 273 | ) |
| 274 | |
| 275 | return request |
| 276 | |
| 277 | |
| 278 | @contextlib.contextmanager |