Skip to content

Commit 74ac8c4

Browse files
authored
Apply fix as in #932
1 parent 4d39c9b commit 74ac8c4

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pydantic_ai_slim/pydantic_ai/models/openai.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,12 +1171,8 @@ async def _get_event_iterator(self) -> AsyncIterator[ModelResponseStreamEvent]:
11711171
except IndexError:
11721172
continue
11731173

1174-
if choice.delta is None:
1175-
continue
1176-
11771174
# Handle the text part of the response
1178-
content = choice.delta.content
1179-
if content is not None:
1175+
if (delta := choice.delta) is not None and (content := delta.content) is not None:
11801176
maybe_event = self._parts_manager.handle_text_delta(
11811177
vendor_part_id='content',
11821178
content=content,

0 commit comments

Comments
 (0)