Qwen2.5
Qwen2.5 copied to clipboard
[QUESTION] Function calling finetuning dataset sample
I want to fine-tune Qwen2 to support custom function calling, but I am stuck on how to format function calling.
I checked the implementation in qwen-agent, and the template is complicated.
Before the prompt is sent to LLM, the system prompt is as follows:
{
"role": "system",
"content": "You are a helpful assistant.
# Tools
## You have access to the following tools:
### get_current_weather
get_current_weather: Get the current weather
Parameters: {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\"}, \"format\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"], \"description\": \"The temperature unit to use. Infer this from the user's location.\"}}, \"required\": [\"location\", \"format\"]}
### get_current_time
get_current_time: Get the current time
Parameters: {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\"}}, \"required\": [\"location\"]}
## When you need to call a tool, please insert the following command in your reply, which can be called zero or multiple times according to your needs:
✿FUNCTION✿: The tool to use, should be one of [get_current_weather,get_current_time]
✿ARGS✿: The input of the tool
✿RESULT✿: Tool results
✿RETURN✿: Reply based on tool results. Images need to be rendered as "
}
What does the Final prompt sent to LLM look like for my custom function calling dataset?
Assuming the above get_current_weather and get_current_time are the functions I want to fine-tune.
Can someone give me a sample? Big Thanks for that。
I checked the official script for function finetuning of qwen1.5, which used ReAct Prompting technology and is somewhat different from the current version, so I would like to understand the function calling finetune of qwen2.
Thanks.