(
content: Iterator[bytes],
*,
sync: bool,
client: Anthropic,
async_client: AsyncAnthropic,
)
| 242 | await iter_next(iter) |
| 243 | |
| 244 | |
| 245 | def make_event_iterator( |
| 246 | content: Iterator[bytes], |
| 247 | *, |
| 248 | sync: bool, |
| 249 | client: Anthropic, |
| 250 | async_client: AsyncAnthropic, |
| 251 | ) -> Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]: |
| 252 | if sync: |
| 253 | return Stream(cast_to=object, client=client, response=httpx.Response(200, content=content))._iter_events() |
| 254 | |
| 255 | return AsyncStream( |
| 256 | cast_to=object, client=async_client, response=httpx.Response(200, content=to_aiter(content)) |
| 257 | )._iter_events() |
no test coverage detected