Skip to content

fix: [问题/Issue] 章节7.4:my_simple_agent.py 中的 MySimpleAgent 类在调用 LLM#414

Open
JiwaniZakir wants to merge 1 commit intodatawhalechina:mainfrom
JiwaniZakir:fix/issue-413
Open

fix: [问题/Issue] 章节7.4:my_simple_agent.py 中的 MySimpleAgent 类在调用 LLM#414
JiwaniZakir wants to merge 1 commit intodatawhalechina:mainfrom
JiwaniZakir:fix/issue-413

Conversation

@JiwaniZakir
Copy link
Copy Markdown

Fixes #413

MySimpleAgent in code/chapter7/my_simple_agent.py was passing raw LLMResponse objects where strings were expected -- to Message(), _parse_tool_calls(), and as return values from run(). The root cause was missing .content extraction after calls to self.llm.invoke(). Fixes by consistently appending .content to all invoke() return values across run() and _run_with_tools(), including the fallback call at the max-iteration boundary. Verified by tracing all five affected assignment sites in the diff to confirm type correctness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant