-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Question
When calling streaming model, due to network issue there could be ReadTimeout error. I am just wondering if this error should also be handled by pydantic-ai (so this is a bug) or it should be handled by developers.
Check the trace:
File "/workspaces/project/.venv/lib/python3.12/site-packages/pydantic_ai/models/__init__.py", line 579, in iterator_with_final_event
async for event in iterator:
File "/workspaces/project/.venv/lib/python3.12/site-packages/pydantic_ai/models/openai.py", line 1432, in _get_event_iterator
async for chunk in self._response:
File "/workspaces/project/.venv/lib/python3.12/site-packages/pydantic_ai/_utils.py", line 307, in __anext__
return await self._source_iter.__anext__()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/project/.venv/lib/python3.12/site-packages/openai/_streaming.py", line 147, in __aiter__
async for item in self._iterator:
File "/workspaces/project/.venv/lib/python3.12/site-packages/openai/_streaming.py", line 160, in __stream__
async for sse in iterator:
File "/workspaces/project/.venv/lib/python3.12/site-packages/openai/_streaming.py", line 151, in _iter_events
async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()):
File "/workspaces/project/.venv/lib/python3.12/site-packages/openai/_streaming.py", line 302, in aiter_bytes
async for chunk in self._aiter_chunks(iterator):
File "/workspaces/project/.venv/lib/python3.12/site-packages/openai/_streaming.py", line 313, in _aiter_chunks
async for chunk in iterator:
File "/workspaces/project/.venv/lib/python3.12/site-packages/httpx/_models.py", line 997, in aiter_bytes
async for raw_bytes in self.aiter_raw():
File "/workspaces/project/.venv/lib/python3.12/site-packages/httpx/_models.py", line 1055, in aiter_raw
async for raw_stream_bytes in self.stream:
File "/workspaces/project/.venv/lib/python3.12/site-packages/httpx/_client.py", line 176, in __aiter__
async for chunk in self._stream:
File "/workspaces/project/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 270, in __aiter__
with map_httpcore_exceptions():
File "/usr/lib/python3.12/contextlib.py", line 158, in __exit__
self.gen.throw(value)
File "/workspaces/project/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ReadTimeout
Additional Context
No response
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested