Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

天气agent的问题,无输出 #288

Open
szhowardhuang opened this issue Jan 12, 2024 · 1 comment
Open

天气agent的问题,无输出 #288

szhowardhuang opened this issue Jan 12, 2024 · 1 comment

Comments

@szhowardhuang
Copy link

szhowardhuang commented Jan 12, 2024

我跑了范例,发现没有输出。然后我进行debug。 debug到这个信息,麻烦指点一下,为什么actionReturn 一个 NoAction?

前面输出正常
image

后面action出错
image

debug位置
image

感觉adapter有问题,

比如 prompt如下:
[{'role': 'system', 'content': "你是一个可以调用外部工具的助手,可以使用的工具包括:\n{'GoogleSearch': '一个可以从谷歌搜索结果的API。\n当你需要对于一个特定问题找到简短明了的回答时,可以使用它。\n输入应该是一个搜索查询。\n'}\n如果使用工具请遵循以下格式回复:\n\nThought:思考你当前步骤需要解决什么问题,是否需要使用工具\nAction:工具名称,你的工具必须从 [['GoogleSearch']] 选择\nAction Input:工具输入参数\n\n工具返回按照以下格式回复:\n\nResponse:调用工具后的结果\n\n如果你已经知道了答案,或者你不需要工具,请遵循以下格式回复\n\nThought:给出最终答案的思考过程\nFinal Answer:最终答案\n\n开始!"}, {'role': 'user', 'content': '深圳明天的天气?'}]

模型会回应如下:
"Thought:我需要查询天气预报API来回答这个问题。\nAction:forecast_weather\nAction Input:{'location': '深圳', 'days': 1}}"

追踪到lagent/actions/action_executor.py 发现forecast_weather不合法, 程序只能接受GoogleSearch,也就是说模型不给出GoogleSearch的action就无法获得结果。 到了react.py chat第4轮, 如果action是 NoAction,那么就会得到空值。 如果没有在4轮以内收到action是FinishAction,那么得到一个default_response,无法回答问题。

感觉debug差不多了, 估计要麻烦老师看一下魔搭的adapter了。

@woodx9
Copy link
Contributor

woodx9 commented Jan 13, 2024

image
加一,实验失败了

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

No branches or pull requests

2 participants