Updated Prompt. Please Check
{
“model”: “gpt-3.5-turbo-0613”,
“messages”: [
{"role" : "system" , "content" : "1. If user do not provide receipient email address, please ask before you proceed 'send_email' function."},
{“role” : “user” , “content” : “i need you to send a email to zhihong, telling him we cancel meeting today” }
],
“functions” : [
{
"name" : "send_email",
"description" : "draft and send email to user instructed emaill address.",
"parameters": { "type": "object", "properties" : {
"email" : { "type" : "string" , "description" : "User provided receipient email address." },
"subject" : { "type" : "string" , "description" : "Email Subject" },
"content" : { "type" : "string" , "description" : "Email content with html formatted" }
},
"required" : ["email"]
}
},
{
"name" : "fallback",
"description" : "If required parameters is not found to call a function",
"parameters": { "type": "object", "properties" : {
"error_message" : { "type" : "string" , "description" : "describe the error, or any info you require to proceed the function" }}
}
}
],
“temperature” : 0.5,
“max_tokens” : 500
}
------ already added another fallback function, and system instruction to prevent ChatGPT to hallucinate email address. BUT result is here :
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"function_call": {
"name": "send_email",
"arguments": "{\n \"email\": \"peter@example.com\",\n \"subject\": \"Meeting Postponed\",\n \"content\": \"<p>Dear Peter,</p><p>We regret to inform you that the meeting scheduled for today has been postponed. We will notify you of the new date and time as soon as it is confirmed.</p><p>Thank you for your understanding.</p><p>Best regards,</p><p>Your Name</p>\"\n}"
}
},
"finish_reason": "function_call"
}