How to call/trigger tools in order
# support
v
I defined a prompt, I want to get the result from the 1st tool and use that result to determine if I should call the 2nd tool. But in the log sounds like to me they are being called in parallel, and the 2nd tool doesn't receive the parameter I defined. Here is the callId: 0906e2d4-a3a2-484a-a8be-639fa529ac29 Please let me know if this is possible or I need to find another way to do that. It is very important to our business.
@User please help
v
@Vinh It sounds like you're trying to implement a sequential process where the output of the first tool informs whether or not to call the second tool. If the tools are being called in parallel without considering the output of the first tool, that would indeed be an issue for your use case. To achieve the desired sequential processing, you would need to ensure that the second tool is called only after the first tool has completed its task and you've evaluated its output. This typically involves programming logic that waits for the first tool's response before deciding to execute the second tool. If you're seeing that the tools are being called in parallel despite your intention for a sequential process, it might be due to the way the multi_tool_use.parallel function is being used. The parallel function is designed to run tools simultaneously, which is not what you want in this case. To resolve this, you should call the first tool and wait for its result. Once you have the result, you can then decide whether to call the second tool based on the criteria you've set. This would be a custom implementation outside of the parallel function. If you need assistance with setting up this sequential process or if there's a specific function within VAPI that you're trying to use, please provide more details or ask for support, and I'll be happy to help you further. If there's a misunderstanding and you need to troubleshoot the current implementation, please ask support for more info on this.
You can continue this conversation by mentioning me in the message.
v
How can i SET that to not run in parallel
@User
could you please help?
s
@Vinh allow me sometime to check this.
v
yeah sure
any update @Shubham Bajaj ?
s
@Vinh check this example as reference for conditional tools calling.
Copy code
[Book Appointment]
1. Ask: "sure thing - I just want to make sure I have everything correct, could you please confirm your first name for me?"
2. Ask: "And your last name"
3. Ask: "We're gonna send you the appointment confirmation by text. Can you provide the best mobile number for you to receive text?" 
4. Trigger the 'fetchSlots' tool and map the result to {{available_slots}}.
5. Ask: "ummm would, {{available_slots}}, work better for you?"
6. <wait for user response>
7. Set the {{selectedSlot}} variable to the user's response.
8. If {{selectedSlot}} is one of the available slots (positive response): 
   - Trigger the 'bookSlot' tool with the {{selectedSlot}}.
   - <wait for 'bookSlot' tool result>
   - Inform the user of the result of the 'bookSlot' tool.
   - Proceed to the 'Call Closing' section.
9. If {{selectedSlot}} is not one of the available slots (negative response):
   - Proceed to the 'Suggest Alternate Slot' section.
v
yeah thank you @Shubham Bajaj but do you see any weird in my prompt for that callId log? I believe I did some order like this too
v
I will send you later when I find any, I have adjusted the prompt. let see.
hi @Shubham Bajaj here is the callId, you can see that function dial is called in the paraleel with function sendMessage: 8a012078-80b5-487c-845c-4537ef3bfa7b
s
@Vinh You need to work on your prompt. It's mostly related to prompting - a slight rework will improve it. If it still doesn't work, you can try different squad transfer modes such as swapping system messages. It's primarily about prompting and message history, so you'll need to experiment with it. It won't be difficult, but it will take some development time and effort. For now, I have tried to rework it, and you can try this approach as well.
Copy code
Trigger the Tools:  

1. Confirm with the customer one last time before proceeding.  

2. Use the `sendMessage` tool with the validated data:  
   - Name: `<name>`  
   - PhoneNumber: `<phone_number>`  
   - <Wait for the `sendMessage` tool response and map the result to the variable `sendMessageResult`.>  

3. If the `sendMessage` tool response indicates success:  
   - Proceed to Step 4.  
   - If the `sendMessage` tool response indicates an error:  
     - Inform the customer politely that an issue occurred.  
     - Return to Step 1 to reconfirm details or escalate appropriately.  

4. Ensure that the `dial` tool is triggered exclusively using `+15125151793`.  
   - Trigger the `dial` tool silently.  

5. If the transfer is successful:  
   - End the interaction silently.  

6. If the transfer is unsuccessful or an error occurs during the transfer:  
   - Inform the customer politely.  
   - Return to Step 1 for clarification or troubleshooting.
@Vinh Do let me know if further help is required.
v
ok thank you very much @Shubham Bajaj . I can configure it base on step number like you provided. However, i have 1 case that after the tool call is completed (I setup complete message), AI wait for customer input before execute the next step. After I removed the completed message of the tool, it works back as usual. Is there any rule regarding to the above situation?
s
@Vinh could you share: - The call ID - When exactly this happened (the timestamp) - What response you expected to get - What response you actually got instead
v
oh I will share once I encouter it again
5 Views