fix: 修复 chapter4/chapter7/chapter8 多个代码问题#482
Open
zichuanxu wants to merge 1 commit intodatawhalechina:mainfrom
Open
fix: 修复 chapter4/chapter7/chapter8 多个代码问题#482zichuanxu wants to merge 1 commit intodatawhalechina:mainfrom
zichuanxu wants to merge 1 commit intodatawhalechina:mainfrom
Conversation
修复以下Issue: - Issue datawhalechina#425: llm_client.py 流式响应空choices导致IndexError 添加 chunk.choices 空检查 - Issue datawhalechina#413: my_simple_agent.py LLMResponse类型错误 将 response 改为 response.content (5处修复) - Issue datawhalechina#400: my_react_agent.py super().__init__参数漏传 添加缺失的 tool_registry 参数 - Issue datawhalechina#478: 文档中 WorkingMemory 等调用参数与定义不一致 移除多余的 self.store 参数 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
你好,请问有验证过吗,没问题的话我来合入 |
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.
Summary
修复以下Issue报告的代码问题:
llm_client.py流式响应中choices可能为空数组,直接访问choices[0]导致IndexErrormy_simple_agent.py中llm.invoke()返回LLMResponse对象,但代码直接当str使用,导致类型错误my_react_agent.py调用super().__init__()时漏传tool_registry参数WorkingMemory、EpisodicMemory等调用时传递了多余的self.store参数,与类定义不一致Changes
code/chapter4/llm_client.py
code/chapter7/my_simple_agent.py
code/chapter7/my_react_agent.py
docs/chapter8/*.md
Test plan
llm_client.py流式响应在choices为空时不再崩溃my_simple_agent.py正常处理LLMResponse对象my_react_agent.py初始化时tool_registry正确传递🤖 Generated with Claude Code