Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(model): fixing MoonshotChatModel streaming usage (#2314)
QuadLutz4891ba7a448d
diff --git a/src/agentscope/model/_moonshot/_model.py b/src/agentscope/model/_moonshot/_model.pyindex a9bcb3178..ac1a12f77 100644--- a/src/agentscope/model/_moonshot/_model.py+++ b/src/agentscope/model/_moonshot/_model.py@@ -281,6 +281,14 @@ class MoonshotChatModel(ChatModelBase):)if not chunk.choices:+ # MoonShot emits a trailing usage-only chunk with no+ # choices; forward it as an empty-content delta so the+ # base class ``__call__`` can absorb ``usage`` into+ # ``acc_res``. The empty delta itself is filtered out+ # of the surfaced stream by ``_stream``.+ if usage is not None:+ delta_res.usage = usage+ yield delta_rescontinuechoice = chunk.choices[0]