Functions not sending parameters
# support
u
I know that the functions are solely related to the prompting. Does anyone have a prompt that ensure the booking date and time gets submitted through most times or 99% of the time?
v
Hi @! ArduinoGuru, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Function Calling]() * [Outbound Sales Example]() * [Prompting Guide]() * [Server Events]() -----------------------------
### Answer For ensuring that the booking date and time get submitted accurately through functions, it's crucial to design your prompt with clear instructions that guide the language model on how and when to call the function. Incorporating a custom function for booking appointments into your assistant's configuration can significantly enhance the efficiency of handling date and time parameters. Here's an example based on the documentation:
Copy code
json
{
  "functions": [
    {
      "name": "bookAppointment",
      "description": "Used to book the appointment.",
      "parameters": {
        "type": "object",
        "properties": {
          "datetime": {
            "type": "string",
            "description": "The date and time of the appointment in ISO format."
          }
        }
      }
    }
  ]
}
[(1)]() This function definition tells the assistant to use the
bookAppointment
function during a conversation. To accurately capture and submit booking dates and times, your system prompt should clearly instruct the assistant on gathering this information from the user and using it to call the
bookAppointment
function at the appropriate moment. Remember to define your
serverUrl
where Vapi can send the function call information, as this will enable the actual booking action on your backend.
Copy code
json
"serverUrl": "YOUR_SERVER_URL_HERE"
Adjusting the conversational flow within the prompt can significantly improve the accuracy of date and time submissions. Ensure the assistant asks for the date and time explicitly and waits for the user's response before proceeding to call the function. For a more detailed setup and examples, you might want to explore the [Function Calling]() section in the Vapi documentation.
Got it. Tagging @User for additional help.
s
Which LLM model you are currently using?
u
gpt 4
s
Can you share me your call_id?
u
yeah i can provide you with a couple, it hasnt worked once oddly enough
ccdd0417-3610-4d42-94c9-1eb2098968f6
94743eed-e141-4a04-a3c1-1dc0b6b866ff
s
You haven't entered the parameters correctly in the dashboard.
u
should we update the function to this one here - { "functions": [ { "name": "bookAppointment", "description": "Used to book the appointment.", "parameters": { "type": "object", "properties": { "datetime": { "type": "string", "description": "The date and time of the appointment in ISO format."
s
Yup.
u
s
Now save it and try it.
u
got it thanks
i used "tomorrow" when i said it to the bot, it put in a date in 2023, any recommendations for that
otherwise i think we got it
s
Cool.
lmk if you need help with something else
u
how do we make sure the bot knows todays date?
s
By providing the current date. You can go through video tutorials about scheduling appointment you will get a proper idea about it.
u
gotchu, thanks for the help