Skip to content

fix:修复 chapter1 Finish 解析因模型未能遵循 Action 格式里不换行要求导致的失败(实测 claude opus 4.8 未能遵循)#654

Open
smresnf wants to merge 1 commit into
datawhalechina:mainfrom
smresnf:fix-chapter1-finish-parsing
Open

fix:修复 chapter1 Finish 解析因模型未能遵循 Action 格式里不换行要求导致的失败(实测 claude opus 4.8 未能遵循)#654
smresnf wants to merge 1 commit into
datawhalechina:mainfrom
smresnf:fix-chapter1-finish-parsing

Conversation

@smresnf

@smresnf smresnf commented Jun 2, 2026

Copy link
Copy Markdown

--- 循环 3 ---

正在调用大语言模型...
大语言模型响应成功。
模型输出:
Thought: 我已经获取了北京的天气信息和适合的旅游景点推荐。现在可以整合这些信息回答用户的问题了。北京今天天气局部多云、气温37摄氏度比较炎热,推荐的景点包括故宫、中国国家博物馆和什刹海,其中中国国家博物馆是室内景点,特别适合炎热天气避暑参观。
Action: Finish[您好!我已经为您查询了北京今天的天气和推荐景点:

🌤️ 北京今日天气

  • 天气状况:局部多云(Partly Cloudy)
  • 气温:37摄氏度(较为炎热)

🏛️ 推荐旅游景点
考虑到今天天气炎热,为您推荐以下几个适合的景点:

  1. 中国国家博物馆 ⭐(最推荐):室内景点,有空调,非常适合炎热天气避暑,同时可以欣赏丰富的历史文物展览。

  2. 故宫:虽然是户外为主,但局部多云的天气不会太晒,是北京必游的标志性景点,建议早上或傍晚前往。

  3. 什刹海:可以泛舟湖上,临水而行较为凉爽,傍晚时分游览更加惬意。

💡 贴心提示:由于今天气温高达37度,建议您:

  • 优先选择中国国家博物馆等室内景点避暑
  • 如游览户外景点,请做好防晒、多补充水分
  • 错开正午高温时段,选择上午或傍晚出行

祝您在北京游玩愉快!]

Traceback (most recent call last):
File "/Users/fansang/Desktop/hello-agents/code/chapter1/FirstAgentTest.py", line 193, in
final_answer = re.match(r"Finish[(.*)]", action_str).group(1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant