Open
Conversation
|
徐梓凡 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
1.0.10-SNAPSHOT
Description
issue: #884
在 OpenAIChatModel.Builder中,stream字段默认为 null(位于 OpenAIChatModel.java:202):
因此,当使用最简配置(如 issue 中的示例)时,构造器生成的 effectiveOptions中的 stream也为 null(OpenAIChatModel.Builder.effectiveOptions即 OpenAIChatModel.configuredOptions)
调用 ReactAgent.stream(msg)时,ReactAgent.steam实际执行的是 AgentBase.steam(AgentBase.java:659-662),传入的 options是 StreamableAgent.steam(StreamableAgent:74-76)所给的默认 StreamOptions.defaults(),即为空。因此,options.stream和 configuredOptions.stream都是 null,合并后的 effectiveOptions.stream也是 null。
在兜底逻辑中,stream被判断为 false(OpenAIChatModel.java:107-108):
最终,实际调用的是 call方法请求非流式模型,导致流式响应失效。
Repair plan
其他 ChatModel或者在方法参数中传递 stream(调用时写死 true和 false),或者作为构造参数传入。由于此处 Builder中有 stream参数,因此模仿 DashScopeChatModel将默认 stream设置为 true以修复此 issue。
Tips
在修复前的版本中,可以通过 defaultOptions指定 stream为 true临时处理该问题。