ToolCalls webhook response for multiple values
# support
n
I keep receiving error message that unable to get recommendations from the webhook response (call id is 0b1d6e97-1311-4a34-bfb6-4659bdedd563). The tool calls is triggering multiple functions so updated the webhook response to send multiple responses but that is still not resolving the issue. So two questions: - 1. Is there a way to force the toolCalls to send both car descriptions inside of one function, or is this parallel function calling something not configurable by Vapi? - 2. If 1 is not possible, then I figured I could send Vapi back multiple responses for it to pick the correct one. However, the Assistant is responding that it's unable to get car recommendations. Thanks. https://cdn.discordapp.com/attachments/1243957322439458836/1243957322615750737/ToolCallCarRecommendation.jpg?ex=66535d09&is=66520b89&hm=ed1e419e4489817839d4e8d499ceefd95e802a5ef2dadb4f5f213a147deb78e4&
v
Hi @nicksi0555, 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**: * [Tools Calling]() * [Server Events]() * [Function Calling]() * [Get Assistant]() -----------------------------
### Answer For your situation: 1. **Combining Responses into One Function**: Vapi's design allows for flexible configurations of tool calls, but each tool call is typically configured to handle a specific function call independently. You can, however, structure your server's logic to aggregate responses (for instance, car descriptions) and return them in a single response. This would mean adjusting your backend to compile the necessary data into one cohesive response before sending it back to Vapi. Unfortunately, the capability to handle parallel function calls directly within a single tool call isn't explicitly supported as per the current documentation [(1)]() . 2. **Handling Multiple Responses**: If sending multiple responses is essential, make sure that your server's response structure aligns with what Vapi expects. According to the Vapi documentation, the server should send back a response in a JSON format that includes a "results" array, where each result is associated with a "toolCallId". This setup helps the Vapi system to understand and process multiple results correctly . Here’s an example response format that your server might use to send multiple car details:
Copy code
json
{
  "results": [
    {
      "toolCallId": "call_XYZ",
      "result": "Description of car A"
    },
    {
      "toolCallId": "call_XYZ",
      "result": "Description of car B"
    }
  ]
}
Ensure your system uses the
"toolCallId"
correctly to correlate requests and responses accurately, as mismatches in these identifiers can lead to the issues you're experiencing. If adjustments to these configurations do not resolve the issue, it may be beneficial to review the server and network logs to identify any potential discrepancies in request handling or data transmission .
n
However, would be ideal if 1 was possible through Vapi's side. Or maybe I can update the prompt to do this. Because if I try the AI suggestion above, I would be passing the same results twice in the "result" value, which would increase by token usage significantly.
Since the docs above are telling me that I should combine them all into one webhook response, I will try that as well. Maybe pass the full result only once in the first result and nothing in any other toolcalls functions that come through.
s

https://www.youtube.com/watch?v=gN6CsDtLnMs

Watch this video
n
Cool thanks for the video. Yes I have been using the Swagger API and got my first appointment booking assistant working nicely using the Tool Calls using similar logic as shown in that video. I never had it send two toolCalls in the same webhook request like it is doing with this car recommendation assistant. When I say two cars (a black car A and white car B), it is occasionally sending them as an array of two separate Tool Calls. So that is requiring me to aggregate both text values into my formula generator which then sends an API call to get car availability for car A and car B. Then, I have to send two result values inside the "results" object as shown in the AI example response above. However, to avoid duplication, I would only need to fill in the first result. Since there is always a code workaround and seeing how many make.com operations this back and forth logic is taking, I am going to just execute a server call and do custom code for this workflow. Ultimately, what I was wondering was the following: - 1. What is triggering Vapi to generate this car description of "Car A and Car B" as either one or two Tool Calls? - 2. Is there a way where we can force Vapi to only generate this as one Tool Calls?
I tweaked the prompt to specify to only execute the function once for all of the selected vehicles and that looks to have solved the multiple Tool Calls issue. This explicit statement wasn't required for my previous booking assistant but seems since I'm stating two vehicles it is generating these as multiples. Still curious on whether this trigger is coming from Vapi side or the LLM itself.
s
Can you send me your exact only tools payload?
n
I am able to hit all my tool functions and only seeing one vice multiple tools calls in one webhook request so I am good. In case anyone else mentions, tweaking the prompt should hopefully resolve it as it did for me.
v
Glad I could be helpful. Feel free to create a new thread with any new questions you may have.
n
It seems because I was saying multiple items, it wanted to send as multiple tool calls. I can still provide the tools payload if you'd like. It only has three functions all working with no issues after the prompt was updated.
19 Views