diff --git a/pydantic_ai_slim/pydantic_ai/models/openai.py b/pydantic_ai_slim/pydantic_ai/models/openai.py index ff148199e9..b162f76e20 100644 --- a/pydantic_ai_slim/pydantic_ai/models/openai.py +++ b/pydantic_ai_slim/pydantic_ai/models/openai.py @@ -353,8 +353,7 @@ async def _get_event_iterator(self) -> AsyncIterator[ModelResponseStreamEvent]: continue # Handle the text part of the response - content = choice.delta.content - if content is not None: + if (delta := choice.delta) is not None and (content := delta.content) is not None: yield self._parts_manager.handle_text_delta(vendor_part_id='content', content=content) for dtc in choice.delta.tool_calls or []: