Function call replaced by Tools call
# support
d
I've replaced my old way of function calling by the new Tools API. The original reason was to be able to change the wait messages, but I saw that Functions were becoming deprecated so i decided to switch entirely. It was quite a struggle to get this far because the docs were missing some information. But now that the Tools and my backend are up and running, my assistant doesn't seem to be able to handle them at all. The call will be successful (I receive the request in my backend and handle it appropriately) But after that, the assistant will no longer talk and hang up after the silence timeout has been reached. I'm wondering if my response structure is not correct, curious to hear how I can fix this. Call ID: c1457a2e-d2c3-4b1d-a7b6-ffad6d951436
v
@DaVenthus I'm glad to hear that you've successfully integrated the new Tools API and that your backend is receiving and handling the requests appropriately. It sounds like you're on the right track! Regarding the issue with the assistant not responding after the call to your backend, it could indeed be related to the response structure that your backend is sending back to the assistant. The assistant expects a specific format to continue the conversation flow. If the response doesn't match the expected structure, the assistant might not know how to proceed, leading to silence and eventually a timeout. Here are a few things you can check and ensure in your response structure: 1. **Status Code**: Make sure that your backend is returning a successful HTTP status code (e.g., 200 OK). 2. **Content Type**: The response should have the
Content-Type
header set to
application/json
. 3. **Response Body**: The JSON response body should match the expected schema, including any required fields and proper data types. 4. **Actionable Data**: If the assistant is expected to say something or perform an action based on the response, ensure that the necessary information is included and clearly defined. 5. **Error Handling**: If there's an error, your backend should send an appropriate error message or code that the assistant can understand and communicate to the user. If you've checked all these points and the issue persists, it might be helpful to look at the logs or any debugging information you have for the call ID you provided. This could give you more insight into what's happening after your backend sends the response. If you're unable to resolve the issue with this information, please ask support for more info on this. They might need to look into the specific call ID and the interaction details to provide a more targeted solution.
You can continue this conversation by mentioning me in the message.
d
Currently I have tried the following two structures, but neither of them seemed to work with the assistant. Approach 1:
Copy code
{
  "results": [
    {
      "result": {
        "is_available": false
      },
      "toolCallId": "call_Cqk5GAfs35yXuMygcEziY15A"
    }
  ]
}
Approach 2: { "results": [ { "result": "{\\"is_available\\": false}", "toolCallId": "call_Cqk5GAfs35yXuMygcEziY15A" } ] }
Okay new update: Apparently the assistant does get the response. I see in the logs in the backend that it does return the data. But the assistant doesn't react once she gets the new data, She just stays silent, I then need to ask if she get a response and only after I ask her about it will she tell me more. What is going wrong here?
s
@DaVenthus can you send me the latest call_id?
also timestamp when this issue occured
in voice recording
d
This is one of the latest ones where I was using Tools API: adb884bd-b969-445e-82ce-6e18fc442b8d
from the 30th second or so she stops responding
Also, this call had issues at multiple times during the call: edfb9302-2b15-4f5c-b25c-c9db8b0a649a
e
s
Please join the OH and get your question answered https://discord.gg/Q4kmWaKq?event=1288127751869431950 @DaVenthus
s
checking in @DaVenthus is it resolved for you?
d
No
I reverted back to Function calls because this was not working for me
If there is a fix for it I'd love to get updated about it, I like the customisability of Tools more
s
@DaVenthus check this doc: https://docs.vapi.ai/tools-calling#server-response-format-providing-results-and-context and return response in single line without new line breaks.
3 Views