mirror of
https://github.com/microsoft/autogen.git
synced 2026-01-10 10:08:08 -05:00
Fix spurious </think> tags caused by empty string reasoning_content in streaming (#7025)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com> Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
This commit is contained in:
@@ -947,8 +947,8 @@ class BaseOpenAIChatCompletionClient(ChatCompletionClient):
|
||||
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 = "</think>"
|
||||
thought_deltas.append(reasoning_content)
|
||||
is_reasoning = False
|
||||
|
||||
Reference in New Issue
Block a user