LLaMA-Factory icon indicating copy to clipboard operation
LLaMA-Factory copied to clipboard

求教react模板模板应该怎么写

Open xs818818 opened this issue 10 months ago • 3 comments

Reminder

  • [X] I have read the README and searched the existing issues.

Reproduction

目前大部分function call都在使用react模板,我尝试修改时发现不少问题,其中从外部接口再回传给模型时,"observation"和"function_call"应该如何选择,我尝试了好几次在单轮调用没问题,但是多轮调用总是失败

Expected behavior

No response

System Info

No response

Others

No response

xs818818 avatar Apr 10 '24 23:04 xs818818

{"from": "human", "value": "Answer the following questions as best you can. You have access to the following APIs:/n/nsearch_ai_file: Call this tool to interact with the pet API. What is the pet API useful for? AI服务器文件查询API,可以查询AI服务器的案例的图片或者视频.Parameters: [{"name": "case", "type": "string", "description": "查询AI服务器的案例名称", "required": false},{"name": "type", "type": "string", "description": "查询案例的文件的格式", "required": false}] Format the arguments as a JSON object./n/nopen_web: Call this tool to interact with the pet API. What is the pet API useful for? AI服务器网页控制的打开接口,可智能打开页面。Parameters: [{"name": "name", "type": "string", "description": "打开页面的名称", "required": false}] Format the arguments as a JSON object./n/nrefresh_web: Call this tool to interact with the pet API. What is the pet API useful for? AI服务器网页控制的内容切换接口,可切换显示页面的具体内容。Parameters: [{"name": "name", "type": "string", "description": "打开页面的名称", "required": false},{"name": "data_name", "type": "string", "description": "切换的具体内容。", "required": false}] Format the arguments as a JSON object./n/nQuestion: the input question you must answer/nThought: you should always think about what to do/nAction: the action to take, should be one of [search_ai_file, open_web, refresh_web]/nAction Input: the input to the action/nObservation: the result of the action/n... (this Thought/Action/Action Input/Observation can be repeated zero or more times)/nThought: I now know the final answer/nFinal Answer: the final answer to the original input question/n/nBegin!/n/nQuestion:打开仪表识别案例"}, {"from": "gpt", "value": "Thought:我要调用AI服务器网页控制的打开接口打开案例展示页面\nAction: open_web\nAction Input: {"name": "案例展示"}\nObservation:正在通过open_web打开案例展示页面"}, {"from": "observation", "value": "正在通过open_web打开案例展示页面"}, {"from": "gpt", "value": "Thought:我要调用AI服务器网页控制的内容切换接口打开仪表识别案例\nAction: refresh_web\nAction Input: {"name": "案例展示","data_name":"仪表识别"}\nObservation:"}, {"from": "observation", "value": "正在通过refresh_web打开案例展示页面的仪表识别"}, {"from": "gpt", "value": "Thought: I now know the final answer\nFinal Answer: 已在网页打开仪表识别案例"}]}, {"conversations": [{"from": "human", "value": "Answer the following questions as best you can. You have access to the following APIs:/n/nsearch_ai_file: Call this tool to interact with the pet API. What is the pet API useful for? AI服务器文件查询API,可以查询AI服务器的案例的图片或者视频.Parameters: [{"name": "case", "type": "string", "description": "查询AI服务器的案例名称", "required": false},{"name": "type", "type": "string", "description": "查询案例的文件的格式", "required": false}] Format the arguments as a JSON object./n/nopen_web: Call this tool to interact with the pet API. What is the pet API useful for? AI服务器网页控制的打开接口,可智能打开页面。Parameters: [{"name": "name", "type": "string", "description": "打开页面的名称", "required": false}] Format the arguments as a JSON object./n/nrefresh_web: Call this tool to interact with the pet API. What is the pet API useful for? AI服务器网页控制的内容切换接口,可切换显示页面的具体内容。Parameters: [{"name": "name", "type": "string", "description": "打开页面的名称", "required": false},{"name": "data_name", "type": "string", "description": "切换的具体内容。", "required": false}] Format the arguments as a JSON object./n/nQuestion: the input question you must answer/nThought: you should always think about what to do/nAction: the action to take, should be one of [search_ai_file, open_web, refresh_web]/nAction Input: the input to the action/nObservation: the result of the action/n... (this Thought/Action/Action Input/Observation can be repeated zero or more times)/nThought: I now know the final answer/nFinal Answer: the final answer to the original input question/n/nBegin!/n/nQuestion:打开宝钢吊钩流程识别案例"}, {"from": "gpt", "value": "Thought:我要调用AI服务器网页控制的打开接口打开案例展示页面\nAction: open_web\nAction Input: {"name": "案例展示"}\nObservation:正在通过open_web打开案例展示页面"}, {"from": "observation", "value": "正在通过open_web打开案例展示页面"}, {"from": "gpt", "value": "Thought:我要调用AI服务器网页控制的内容切换接口打开宝钢吊钩流程识别案例\nAction: refresh_web\nAction Input: {"name": "案例展示","data_name":"宝钢吊钩流程识别"}\nObservation:"}, {"from": "observation", "value": "正在通过refresh_web打开案例展示页面的宝钢吊钩流程识别"}, {"from": "gpt", "value": "Thought: I now know the final answer\nFinal Answer: 已在网页打开宝钢吊钩流程识别案例"}]} 这是我目前构建的数据集,是不是返回接口信息时gpt要改为function_call,其它还有要注意的吗

xs818818 avatar Apr 11 '24 00:04 xs818818

求一个适用此工程的完整react模板示例。

huchaodong avatar Apr 11 '24 01:04 huchaodong

项目内置了 glaive_toolcall 数据集,请参考这个。相关教程是 https://zhuanlan.zhihu.com/p/678989191

codemayq avatar Apr 11 '24 01:04 codemayq

@xs818818 你好,最近也在尝试做基于react的微调,想问一下你有解决涉及多轮工具调用时模型的微调问题吗,如果解决了的话数据格式大概长啥样呢?

whl2333 avatar Apr 30 '24 15:04 whl2333