If Then Statements
# support
b
We're having trouble with the prompt for If/Then statements. For example on the phoen call we ask a qualifying quesiton. If the answer is satisfactory we want to proccedd with booking an appointment. IF not we want to proceed with asking a few more questions before booking a call. Currently we can't get it to skip questions based on the answer it received. Any prompting that we shoud be using for this?
v
Hi @Brady, I'm an AI assistant for Vapi. While a team member reviews this question, I'll look through relevant sources and see if I can provide suggestions. Please tag @Vapi Support with any follow-up questions.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Glossary]() * [Outbound Sales Example]() * [Update Assistant]() * [Create Phone Call]() -----------------------------
### Answer For implementing If/Then logic in your Vapi assistant to handle calls based on user responses, you will need to utilize custom functions within your assistant's configuration. You can define custom functions that the assistant can call during a conversation. These functions can be designed to handle different scenarios based on the conversation flow, such as proceeding with booking an appointment or asking more questions based on user answers [(1)]() . However, specific implementation details or examples of prompt engineering for achieving If/Then logic directly through the assistant's conversation model are not provided in the information available. For more complex logic handling and dynamic conversation flows, it's recommended to use the custom functions feature in conjunction with your server-side logic to manage the conversation paths based on user responses. Remember, custom functions require setting up a
serverUrl
where Vapi will send information when a function is called. This allows you to handle the logic on your server, deciding whether to book an appointment directly or ask more questions based on the user's response. For further guidance on creating and managing custom functions, please refer to the documentation on [Call Functions]().
Got it. Tagging @User for additional help.
s
I would suggest you read the OpenAI prompting techniques https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/advanced-prompt-engineering?pivots=programming-language-chat-completions. Also, check out how we do it with other pre-defined templates we've created which can be found on create new assistant section.
b
Hey There, I checked out the predefined templates and none of them use If/else statements much at all... they are all very simple with no depth. I can't find a specific section on the Prompt Engineering guide about Ife/Else statements.
s
Will publish an prompting guide by tomorrow you can have a look at it.
b
I'll watch for it
I haven't seen anything yet on the prompting guide