Assistant is not acting according to the Tool call...
# support
a
[{ "toolCalls": [ { "id": "call_IpBXxx76mgqufIALaxNpCeGp", "type": "function", "function": { "name": "evaluate_response", "arguments": "{\n \"response\": \"Yeah. So I I'll just take 5 minutes of yours. Uh, your time. Can you hear me properly?\",\n \"stage\": \"NEED_QUALIFICATION\"\n}" } } ], "role": "tool_calls", "message": "", "time": 1737005765483, "secondsFromStart": 19.591 } { "role": "tool_call_result", "time": 1737005765493, "secondsFromStart": 19.601, "name": "evaluate_response", "result": "Success.", "toolCallId": "call_IpBXxx76mgqufIALaxNpCeGp" }] This is the response which i am getting for the following code. Here the response is coming as "Success." instead of "End the call by saying I am busy right now" @Post('/webhook/vapi') async handleVapiWebhook(@Body() data) { const toolCalls = data.message.toolCalls; const response = toolCalls.map((toolCall) => { return { toolCallId: toolCall.id, result: 'End the call by saying I am busy right now', }; }); const finalResponse = { results: response, }; return finalResponse; } Bot it not acting according to the instructions, so i think its not working. Please help!
v
@Akshat Jain It seems like there might be an issue with the way the function
evaluate_response
is being handled in your webhook. The response you're expecting to send back is not being reflected in the actual result, which is coming back as "Success." instead of the intended message. To troubleshoot this, please ensure that the
evaluate_response
function is correctly implemented and that it's designed to return the specific message "End the call by saying I am busy right now" under the appropriate conditions. If the function is implemented correctly and you're still facing issues, it could be a problem with how the response is being mapped or returned in your webhook handler. Double-check the logic in your
handleVapiWebhook
function to ensure that it's correctly processing the tool calls and mapping the expected results. If you're unable to resolve the issue, please provide more details or ask support for more info on this.
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
a
@User @User One of the call id: b3cb6782-4315-49e0-9b12-6cb43ee4b8a6
@Vapi i am using type: 'function'
v
@Akshat Jain I understand that you're using a function type within your tool calls. However, it seems there might be a misunderstanding or a misconfiguration in your webhook handler code. The
evaluate_response
function appears to be working as it's returning "Success," but the actual response you want to send back is not being set correctly. Please ensure that your webhook handler is correctly interpreting the results from the
evaluate_response
function and mapping them to the desired output message. If the function is supposed to return "End the call by saying I am busy right now" under certain conditions, you'll need to check the logic within that function to make sure it's doing so. If you're still having trouble, you may need to consult the documentation for the
evaluate_response
function or reach out to the support team for the Voice API you're using to get more detailed assistance on how to configure your webhook handler to return the expected message. If there's anything else I can assist you with, please let me know!
a
@Vapi I checked webhook logs on vapi dashboard. I can see that request is getting completed with 201 and this is the response. { "results": [ { "tool_call_id": "call_fn7LGNlYNN8WIABvjRCkpiZt", "result": "Say that you are busy right now and hang up the call" } ] }
v
@Akshat Jain It's great to hear that you're receiving a 201 status code, which indicates that the request has been processed successfully and that the response is being returned as expected with the message to "Say that you are busy right now and hang up the call." If this is the response you intended to send, it seems like your webhook is functioning correctly. However, if the behavior of the bot or the system is not aligning with this response (for example, if the call is not being handled as instructed), you may need to look into the next steps of the process where this response is being used. Make sure that the system which receives this webhook response knows how to interpret and act on the "result" field correctly. If the bot or system is supposed to end the call based on this instruction, ensure that the corresponding action is triggered when this response is received. If you're still experiencing issues with the bot not acting according to the instructions, you may need to debug further into the system that processes the webhook response to ensure it's handling the "result" as expected. If you need further assistance, please provide more details about the issue you're facing, and I'll do my best to help!
a
@User Please look into this. I am trying the same setup my self using openAI tool calling with the exact same system prompt, tool response and same user messages. I am getting 201 on vapi and i can see that the response is correct too. { "results": [ { "tool_call_id": "call_fn7LGNlYNN8WIABvjRCkpiZt", "result": "Say that you are busy right now and hang up the call" } ] } Still the bot is not acting according to the instruction.
@Shubham Bajaj I think you have solved a lot of similar issues in the past. I might be missing something very basic. Please help.
Found the issue. I was using 'async: true'.
@Vapi Mark this as resolved
v
@Akshat Jain Sweet. Have a great day!
2 Views