dec
07/12/2024, 9:46 AM{
"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:
{
"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!Vapi
07/12/2024, 9:47 AMVapi
07/12/2024, 9:47 AMdec
07/12/2024, 9:50 AMVapi
07/12/2024, 9:50 AMdec
07/12/2024, 9:52 AMdec
07/12/2024, 10:07 AM<?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.Shubham Bajaj
07/12/2024, 2:35 PMShubham Bajaj
07/12/2024, 2:36 PMdec
07/12/2024, 3:30 PMdec
07/12/2024, 3:37 PM{
"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! š¦dec
07/12/2024, 3:49 PMstdClass 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&dec
07/12/2024, 3:54 PMShubham Bajaj
07/13/2024, 11:41 AMThe weather in location is.
Remove from messages array message of type request-complete.
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"}
}
}
}
]dec
07/13/2024, 2:17 PMShubham Bajaj
07/19/2024, 11:05 PM