Rigel2475
10/23/2024, 7:30 PMvapi.on("message", (message) => {
console.log(message);
});
I get all the messages like trancripts. Also de call to the functions, but I don't get the result even it is correct.
In Advanced--> Client-Messages I have:
tool-calls-results
tool-calls
transcript
in Messages i am able to see than the function is working correctly:
{
"name": "function",
"role": "tool_call_result",
"time": 1729710451226,
"result": "Result to show",
"toolCallId": "call_zNaCG1XPLccwOhO2BtaCi6pg",
"secondsFromStart": 20.067
}
CallID: e94e5211-5afd-416f-8115-92e43b99fe56
¿What can i do?
Thanks!Vapi
10/23/2024, 7:33 PMvapi.on("message", ...) event handler, but you're not seeing the results of the function calls. Since you've confirmed that the function is working correctly and you have the tool-calls-results enabled in the Advanced --> Client-Messages settings, the issue might be related to how the results are being handled or logged.
To troubleshoot this issue, you can try the following steps:
1. Ensure that the event listener for message is set up to handle different types of messages, including tool_call_result.
2. Check if there are any filters or conditions in your code that might prevent the logging of certain messages.
3. Verify that the console.log function is not being overridden or affected by other parts of your code.
4. Make sure that there are no errors in the browser console that could be interrupting the script execution.
If you've gone through these steps and the issue persists, please provide more details or ask for further support. If there's any specific information or assistance you need regarding the VAPI, feel free to let me know!Vapi
10/23/2024, 7:33 PMRigel2475
10/23/2024, 7:39 PMRigel2475
10/23/2024, 9:38 PMVapi
10/23/2024, 9:38 PMtool_call_result messages. Your current listener should be able to handle all messages, but it might be worth double-checking that nothing is filtering out the tool_call_result messages.
2. **Review Message Handling**: Inside your event listener, make sure you are handling the different roles that a message can have. You might need to add a condition to specifically check for messages with the role tool_call_result.
Here's an example of how you might handle different message roles:
javascript
vapi.on("message", (message) => {
if (message.role === "tool_call_result") {
console.log("Function call result:", message.result);
} else {
console.log("Other message:", message);
}
});
3. **Console Output**: Confirm that the console output is not being suppressed or redirected. If you're using a browser, check the developer console for any errors or warnings that could provide clues.
4. **Check Network Activity**: Use the network tab in your browser's developer tools to monitor WebSocket or HTTP requests. Look for the incoming messages and see if the tool_call_result is being received but not logged.
5. **Update Client-Messages Settings**: Double-check your Advanced --> Client-Messages settings to ensure that tool-calls-results is indeed selected and saved.
If after these steps the problem still isn't resolved, it might be a more complex issue that requires direct support. Please ask support for more info on this, and provide them with the CallID and any other relevant information you have gathered during your troubleshooting process.