streaming_errorTier 1 · 70% confidence

ai-agents-streaming-error-assertionerror-generation-is-not-none-when-streami-360df996

agent: ai_agents

When does this happen?

IF AssertionError 'generation is not None' when streaming with AzureChatOpenAI if the model does not support streaming or the Azure content filter triggers.

How others solved it

THEN Explicitly set streaming=False when instantiating AzureChatOpenAI if the deployment does not support streaming. For content filter issues, wrap streaming calls in a try-except block to catch BadRequestError or handle gracefully. Additionally, consider increasing recursion limit or limiting input length as workarounds.

client = AzureChatOpenAI(..., streaming=False)
response = client.stream(prompt)
for chunk in response:
    print(chunk.content)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics