Skip to content

Commit a4ba046

Browse files
authored
Fix bug related to Azure OpenAI model streaming response
1 parent 66fa21a commit a4ba046

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pydantic_ai_slim/pydantic_ai/models/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ async def _get_event_iterator(self) -> AsyncIterator[ModelResponseStreamEvent]:
11731173

11741174
# Handle the text part of the response
11751175
content = choice.delta.content
1176-
if content is not None:
1176+
if (delta := choice.delta) is not None and (content := delta.content) is not None:
11771177
maybe_event = self._parts_manager.handle_text_delta(
11781178
vendor_part_id='content',
11791179
content=content,

0 commit comments

Comments
 (0)