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 359ddfe6c8d2..2cbb235cefa3 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 @@ -947,8 +947,8 @@ async def create_stream( is_reasoning = True thought_deltas.append(reasoning_content) yield reasoning_content - elif is_reasoning: - # Exit reasoning mode. + elif reasoning_content is None and is_reasoning: + # Exit reasoning mode only when reasoning_content is None (not when it's an empty string). reasoning_content = "" thought_deltas.append(reasoning_content) is_reasoning = False