Skip to content

Conversation

@frednijsvrt
Copy link
Contributor

@frednijsvrt frednijsvrt commented Sep 2, 2025

Solves: #797

This PR fixes an issue happening with Azure OpenAI streaming Response causing the raise of an AttributeError. This fix is identical as the one in PR #932.

As stated on the #797, the error occurs in pydantic-ai's OpenAI model implementation where it assumes every delta in the streaming response contains a content field. However, with Azure OpenAI's API, some deltas (like role initialization) may not include content, resulting in choice.delta.content being None when an async content filter is enabled (https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/content-filter?tabs=warning%2Cuser-prompt%2Cpython-new#asynchronous-filter).

@frednijsvrt frednijsvrt marked this pull request as draft September 2, 2025 12:15
@frednijsvrt frednijsvrt closed this Sep 2, 2025
@frednijsvrt
Copy link
Contributor Author

Create PR from other branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant