优化LLMs:通过函数调用进行微调
Consider a healthcare appointment assistant that interacts with patients to:
考虑一个医疗预约助手,与患者互动以:
- Confirm appointments
- 确认预约
- Send follow-up reminders
- 发送后续提醒
- Schedules callbacks if patient is busy
- 如果患者忙碌,则安排回电
Sample Conversation
示例对话
Patient: Hello? Who is this?
Health Assistant: This is Health AI Assistant. I’m calling to confirm if you’d like to schedule your annual checkup. Would you like me to book an appointment for you?
Patient: Yes, I’ve been planning to get an eye checkup done at the clinic.
Health Assistant: I can help with that. When would you like to schedule your appointment?
Patient: Maybe this Thursday at 3 PM?
Health Assistant: Sounds good! Let me schedule that for you. Please hold on.
Function Call → schedule_appointment (Thursday, 3 PM, Ophthalmologist)
患者: 你好?你是谁?
健康助手: 我是健康AI助手。我打电话是想确认您是否想安排年度体检。您希望我为您预约吗?
患者: 是的,我一直计划在诊所进行眼部检查。
健康助手: 我可以帮您安排。您想什么时候预约?
患者: 也许这个星期四下午3点?
健康助手: 听起来不错!让我为您安排。请稍等。
函数调用 → schedule_appointment (星期四, 下午3点, 眼科医生)
Structuring Fine-Tuning Data for GPT
为GPT构建微调数据
Fine-tuning data should follow OpenAI’s structured format. When an appointment needs to be scheduled, the function call should be embedded as follows:
微调数据应遵循OpenAI的结构化格式。当需要安排预约时,函数调用应嵌入如下:
{
"role": "assistant",
"content": null,
"function_call": {
"name": "schedule_appointment",
"arguments":
{
"role": "assistant",
"content": null,
"function_call": {
"name": "schedule_appointment",
"arguments":
"{ \"appointment_date\": \"This Thursday\", \"appointment_time\": \"3 PM\", \"doctor_specialty\": \"Ophthalmologist\"
"{ \"appointment_date\": \"这个星期四\", \"appointment_time\": \"下午3点\", \"doctor_specialty\": \"眼科医生\"
}"
}"
}
}
}
}
-
**role**
defines whether the speaker is the assistant or the user. -
**role**
定义说话者是助手还是用户。 -
**function_call**
contains the function nameschedule_appointment
and the required parameters “appointment_date
,appointment_time
,doctor_specialty"
-
**function_call**
包含函数名称schedule_appointment
和所需参数 “appointment_date
,appointment_time
,doctor_specialty"
For an official guide on fine-tuning (data validation, ...