Skip to content

A programming framework for agentic AI

fix: streaming token mode cannot work in function calls and will infi… (#5396)

so2liu07c5dc751485
diff --git a/python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py b/python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py
index e6f8da279..b1f23e104 100644
--- a/python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py
+++ b/python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py
@@ -767,7 +767,7 @@ class BaseOpenAIChatCompletionClient(ChatCompletionClient):
stop_reason = choice.finish_reason if chunk.usage is None and stop_reason is None else stop_reason
maybe_model = chunk.model
# First try get content
- if choice.delta.content is not None:
+ if choice.delta.content:
content_deltas.append(choice.delta.content)
if len(choice.delta.content) > 0:
yield choice.delta.content