The tool that I am trying to implement don't provi...
# support
d
I am trying to setup a tool in a VAPI assistant, and, apparently everything is fine, except that the assistant did not reproduce the expected tool response. The call ID is: 05fdd8ea-c3e9-4f68-b856-cc7f123da892 I try to follow the documentation, and, apparently the tool is certainly called, and, I receive the request to the expected "Server URL". However, even when the server response is like below:
Copy code
{
  "results": [
    {
      "toolCallId": [Here the right call ID],
      "result": "The expected weather is sunny for all day!"
    }
  ]
}
Finally I can't get reproduced by the assistant the "result", that is, the phrase: "The expected weather is sunny for all day!" is never reproduced by the assistant. Looking at the call information something is funny to me, because we can see this extract:
Copy code
{
            "role":"bot",
            "time":1720775982426.9995,
            "source":"",
            "endTime":1720775986087.682,
            "message":"Checking the weather forecast, please wait. The weather in location is",
            "secondsFromStart":6.6699996
        },
        {
            "name":"getWeather",
            "role":"tool_call_result",
            "time":1720775984675,
            "result":"The expected weather is sunny for all day!",
            "toolCallId":"call_CKElOzJ7Ia3BBsMtxX79Atk8",
            "secondsFromStart":9.213
        }
So I am crazy about this, because, apparently all is fine, but, I don't get the assistant reproducing the "result" of the server URL response as expected. The response content type header is "application/json", the response code is 200, but, as I say, the assistant never reproduces the phrase placed in the response "result". Can anybody please help me with this? Thanks in advance for any help!
v
@dec It seems like everything is set up correctly on your end, and the server is responding with the appropriate JSON format. The issue might be related to how the VAPI assistant is handling the response. Since the tool call result is being logged correctly with the expected result, but the assistant is not vocalizing the response, there might be a problem with the assistant's configuration or a bug in the system. To troubleshoot this issue, please ensure that the assistant's configuration is set to vocalize the tool's response. If the configuration seems correct and the problem persists, it may be necessary to contact support for further assistance. If you believe everything is configured correctly and would like to proceed with contacting support, I can help you close this ticket. Would you like me to close the ticket for you now?
You can continue this conversation by mentioning me in the message.
d
This message, unfortunately, don't help me at all. The assistant apparently is well configured, it's triggering the tool, but, never "say" to the user the "result" provided in the tool server URL response. As I already say, I follow all the documentation that I can, and, everything is right implemented (if I am not wrong), but, for a reason that I can't handle the "result" of the tool server URL response is never reproduced as expected.
v
@dec I understand the frustration you're experiencing. It seems like there might be an issue with the assistant's integration of the tool response into the conversation flow. Here are a few steps you can take to troubleshoot the problem: 1. **Check Integration Points**: Ensure that the assistant's script or code is designed to handle the tool response correctly. There should be a point in the script where the assistant is instructed to vocalize the result from the tool. 2. **Review Assistant Logs**: Look for any errors or warnings in the assistant's logs that might indicate why the result is not being vocalized. 3. **Test with a Simplified Response**: Try sending a simplified response from your server to see if the assistant vocalizes it. This can help determine if the issue is with the content of the response or the way it's being handled. 4. **Contact Support**: If the above steps do not resolve the issue, it may be necessary to reach out to the VAPI support team with details of your implementation and the issue you're facing. Since the tool's response is being received but not vocalized, it's likely an issue with how the assistant is programmed to handle the response. If you've already checked the configuration and documentation, the next step would be to seek assistance from the support team who may need to look into the system more deeply. Would you like me to assist you in any other way, or shall I proceed with closing this ticket for you?
d
No help at all... unfortunately... I will wait for another possible response from a real person who deal with this and want to help me with this issue.
Please, don't hesitate to ask if more information is required! For example, here is the PHP script who is used by the tool to provide the response:
Copy code
<?php

$json_args = \json_decode(file_get_contents('php://input'));

http_response_code(200);
header('Content-Type: application/json');

$output = array(
  'results' => array(
    array (
      'toolCallId' => $json_args->message->toolCalls[0]->id,
      'result' => 'The expected weather is sunny for all day!'
    )
  )
);

echo \json_encode($output);
exit;
The request JSON is retrieved as expected, I mean, the $json_args->message->toolCalls[0]->id is certainly the expected value.
s
@dec you ended the call i guess.
please test it again.
d
Thanks for your reply, @Shubham Bajaj No, I did not ended the call.. I mean.. the assistant "says": "Checking the weather forecast, please wait. The weather in location is"... and that's all... the call is not ended, and, even if I wait... I did not get the assistant saying: "The expected weather is sunny for all day!"... 😫
May you said that, @Shubham Bajaj, because, certainly, in the call information, we can see that the user "end the call", but, that is because I end the call... but after I see that there is no the expected reply by the assistant... so yes... I ended the call... but without getting the expected reply, which is in fact in the call information JSON...
Copy code
{
  "name": "getWeather",
  "role": "tool_call_result",
  "time": 1720775984675,
  "result": "The expected weather is sunny for all day!",
  "toolCallId": "call_CKElOzJ7Ia3BBsMtxX79Atk8",
  "secondsFromStart": 9.213
}
... but I never hear that "result" from the assistant... Any help is appreciate, since I really don't know what more to do! 😦
To provide a bit more information, this is what I get in the tool server URL script. Specifically this take my attention:
Copy code
stdClass Object
    (
        [role] => assistant
        [content] => 
        [tool_calls] => Array
            (
                [0] => stdClass Object
                    (
                        [type] => function
                        [id] => call_PwWzzYeHPQzgJnUlPjZE0WXS
                        [function] => stdClass Object
                            (
                                [name] => getWeather
                                [arguments] => {"location": "New York"}
                            )
                    )
            )
    )
This take my attention, because, the "content" propery is empty... it's like if that is what the assistant will reproduce / say, but, it's empty. But of course I did not understand why the "content" property is empty... I just think that I am making everthing as expected, following the documentation, but, for some reason this is not working as expected. https://cdn.discordapp.com/attachments/1261257438024302643/1261348706490253343/log.txt?ex=6692a206&is=66915086&hm=232f620233d33f63d48b5ff8a6c664b5f602780b5ffdd1bdec3e03300eb7a44e&
s
@dec you have set the request-complete message and if it is set to some content-string or empty-string it is used over the returned result message. So, it always says
The weather in location is
. Remove from messages array message of type request-complete.
Copy code
json
šŸ”µ 15:44:56:115 Getting Tool Message "request-failed". For Tools [
  {
    "type": "function",
    "function": {
      "name": "getWeather",
      "parameters": {
        "type": "object",
        "properties": {"location": {"type": "string"}}
      },
      "description": "Retrieves the current weather for a specified location."
    },
    "async": false,
    "server": {
      "url": "https://www.decsoftutils.com/impulsmedia/vapi-getweather-tool-response.php"
    },
    "messages": [
      {
        "type": "request-start",
        "content": "Checking the weather forecast. Please wait..."
      },
      {
        "type": "request-complete",
        "content": "The weather in location is"
      },
      {
        "type": "request-failed",
        "content": "I couldn't get the weather information right now."
      },
      {
        "type": "request-response-delayed",
        "content": "It appears there is some delay in communication with the weather API."
      }
    ],
    "toolCall": {
      "id": "call_PwWzzYeHPQzgJnUlPjZE0WXS",
      "type": "function",
      "function": {
        "name": "getWeather",
        "arguments": {"location": "New Door"}
      }
    }
  }
]
d
Thanks very, very, very much @Shubham Bajaj , certainly, that's is! I remove the "request-complete" from the tool JSON, as you suggest, and, the assistant is now telling the user the expected "result" from the tool server URL. Thanks very, very much again, @Shubham Bajaj , I really appreciate your help! Maybe this can help to other people in the same scenario. Thanks again, sir!
s
no response closing the ticket.
3 Views