Function call and Tool-call together in one API ca...
# support
s
Hi, I am looking for a solution where the assistant should be able to ask and save customer detail and if customer asks for call transfer, it does so too. I tried but it only transfers the call even if I am asking to save the detail. Here is my call ID: ec85105b-1d45-40b6-aaa5-29ca324c4f0a If you can check and let me know the way it is being handled. That would be great.
v
Hi @Shahzad, 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**: * [Create Phone Call]() * [Get Call]() * [List Calls]() * [Inbound Support Example]() -----------------------------
### Answer To address the issue where the assistant only transfers the call instead of also saving customer details, you may need to adjust the implementation of your assistant's logic. Ensure that your assistant's configuration properly handles both saving details and transferring calls based on the customer's requests. You can use the
function
and
transferCall
types in your tool configuration to manage these actions. Hereโ€™s a basic example of how you might structure this:
Copy code
json
{
  "tools": [
    {
      "type": "function",
      "name": "saveCustomerDetails",
      "parameters": {
        "customerData": {
          "name": "{customer_name}",
          "detail": "{customer_detail}"
        }
      }
    },
    {
      "type": "transferCall",
      "destinations": [
        {
          "type": "assistant",
          "assistantName": "TransferService",
          "message": "Transferring your call now."
        }
      ]
    }
  ]
}
In this setup: - **Function Tool**: This is configured to save customer details. Ensure that your backend service can handle these parameters appropriately. - **Transfer Call Tool**: This tool transfers the call to another service or assistant based on the customer's request. You also need to ensure that the assistant logic correctly parses customer inputs to trigger the right tool. If the assistant prematurely triggers the call transfer, check the conditions set for executing the
transferCall
tool. Unfortunately, without access to backend logs or specific details about the call handling logic set on your Vapi dashboard, I can't provide a precise solution. You might want to review the call logs for the specific call ID provided or check the configuration in your Vapi dashboard to ensure that the tools and conditions are set up correctly. If you continue experiencing issues, consider revisiting the assistant configuration, especially the parts where tools are defined and triggered.
s
But I have predefined 'forwardingPhoneNumbers' already set. How does that work with tools
@Sahil can you jump into this one please?
s
It is already converted into tools. So, you don't have to worry about it.
Also, for the save the detail issue sounds like a prompting issue. Can you provide me timestamp in the audio where you faced this issue?
s
If you listen to this call ec85105b-1d45-40b6-aaa5-29ca324c4f0a from 0:55. I am giving my email and name but it is transferring the call. Here is the prompt given "After first message, Misha will ask the customer their name, email and phone number one by one. Misha will pass this data as object to function-call _registerCustomercollects and ask client. What can I do for you. You are Stepney, your job is to handle phone calls from customers and transfer them to different departments "
s
Check DM. It had some error. Change your function name, provide the function parameter is correct order.
s
@Sahil I have changed my code and I was able to get the tool-call. However I am getting this error again. Check this short call a9bace4f-da7e-4fc4-a169-e2c8033be6ac from 0:18 where I am telling my name and email while the assistant is transferring the call. I want to know what is causing this so I can fix if this is on my side. Please
s
Sorry for the delay, are you still facing this issue?
s
I got it fixed ๐Ÿ™‚ Thanks for checking back.
e
How did you fix?
s
So the URL I was passing to Vapi was the same that was for inbound call. It seems it should be different. I made a different controller method and it started working. Not sure if this is the solution or what ๐Ÿ™‚
4 Views