mirror of
https://github.com/microsoft/autogen.git
synced 2025-09-03 05:17:07 +00:00
fix: streaming token mode cannot work in function calls and will infi… (#5396)
Fix: Prevent empty messages accumulation in streaming mode Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
This commit is contained in:
parent
901ab1276d
commit
07c5dc7514
@ -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
|
stop_reason = choice.finish_reason if chunk.usage is None and stop_reason is None else stop_reason
|
||||||
maybe_model = chunk.model
|
maybe_model = chunk.model
|
||||||
# First try get content
|
# First try get content
|
||||||
if choice.delta.content is not None:
|
if choice.delta.content:
|
||||||
content_deltas.append(choice.delta.content)
|
content_deltas.append(choice.delta.content)
|
||||||
if len(choice.delta.content) > 0:
|
if len(choice.delta.content) > 0:
|
||||||
yield choice.delta.content
|
yield choice.delta.content
|
||||||
|
Loading…
x
Reference in New Issue
Block a user