How to prompt with conditional statements based on...
# support
a
I'm trying to create a prompt with a step where the agent needs to decide between 3 scenarios. That decision will be based on a variable that i pass in. How would you suggest setting up the prompt? I'm having trouble getting the agent to comply. For example if i pass in customer_type = "business" i want it to say one thing, and if i pass in customer_type="consumer" i want it to say another.
v
@amir Certainly! To create a prompt that allows the agent to decide between scenarios based on the
customer_type
variable, you can structure your prompt to include conditional logic. Here's a suggestion on how you can set it up: 1. Start with a clear introduction that explains what the agent is expected to do. 2. Define the variable
customer_type
and explain its possible values. 3. Use conditional statements to outline the different scenarios and responses for each
customer_type
. Here's an example of how the prompt could look:
Copy code
Given the variable `customer_type`, which can be either "business" or "consumer", the agent will provide a tailored response based on the following scenarios:

- If `customer_type` is "business", the agent will say: "We offer a range of services tailored to meet the needs of your business, including bulk discounts and dedicated support."

- If `customer_type` is "consumer", the agent will say: "Our products are designed with the consumer in mind, ensuring quality and affordability for your personal use."

- If `customer_type` is not specified or is any other value, the agent will ask for clarification: "Could you please specify if you are inquiring as a business or a consumer?"

Please proceed with the appropriate response based on the `customer_type` provided.
When you pass in the variable, the agent will check the value of
customer_type
and respond accordingly. If the agent is not complying, make sure that the conditional logic is clearly defined and that there are no ambiguities in the instructions. If you continue to face issues, please provide more details so I can assist you further.
You can continue this conversation by mentioning me in the message.
s
@amir check our prompting guide https://docs.vapi.ai/prompting-guide#additional-tips it has answers to all of your questions. Do let me know if you require further help.
9 Views