Skip to content

Commit 81edab1

Browse files
authored
_stream in async client raises RuntimeError processing HTTP errors (#266)
Fixes a bug processing errors in async client. When response in _stream has an HTTP error, the process raises a RuntimeError("Attempted to call a sync iterator on an async stream.") due to use of e.response.read() instead of await e.response.aread()
1 parent d98f646 commit 81edab1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ollama/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ async def inner():
495495
try:
496496
r.raise_for_status()
497497
except httpx.HTTPStatusError as e:
498-
e.response.read()
498+
await e.response.aread()
499499
raise ResponseError(e.response.text, e.response.status_code) from None
500500

501501
async for line in r.aiter_lines():

0 commit comments

Comments
 (0)