[callback,agent] enable_no_stream_callback 永远不会触发,因为RolePlay返回的response永远是生成器 #585
Open
3 tasks done
Labels
bug
Something isn't working
Initial Checks
What happened + What you expected to happen
如图所示,尽管我设置RolePlay非stream, 但是当触发run方法,执行的回调还是enable_stream_callback,RolePlay不论是stream还是non-stream 返回的永远是generator, 因为_run方法中使用了yield语句,无论是否启用流模式,只要函数体内包含 yield 语句,Python 就会将这个函数视为一个生成器。正确方法应该分开处理stream与non-stream,将像BaseChatModel的chat方法,其enable_llm_callback是正确的。Versions / Dependencies
最新版
Reproduction script
如上
Issue Severity
None
The text was updated successfully, but these errors were encountered: