Designing Prompts with Dynamic Variable Input
DigiAI Agent's dynamic variable feature allows you to create interactive and personalized prompts. Here's how to
effectively design prompts that leverage this capability:
1. Identify Variable Opportunities:
- Personalization: Determine where user-specific information is needed to tailor the output. This could include names,
preferences, locations, or any other relevant details.
- Dynamic Content: Identify elements of the prompt that might change based on user input. This could be the type of
task, the data to be processed, or the format of the output.
- Interactive Flow: Consider how you can use variables to create a more engaging and conversational experience. This
could involve asking the user questions, providing choices, or adapting the prompt based on their responses.
2. Define Variables:
- Choose Descriptive Names: Use clear and concise names that indicate the purpose of the variable (e.g., {user_name},
{product_type}, {desired_output}).
- Consistent Syntax: Adhere to DigiAI Agent's specified syntax for variables, typically using curly braces {}.
- Data Types: Consider the type of data the variable will hold (e.g., text, number, date) and any formatting
requirements.
3. Incorporate Variables into the Prompt:
- Strategic Placement: Place variables within the prompt where the user-provided values should be dynamically
inserted.
- Clear Instructions: Provide clear instructions to the user on when and how to input the variable values. Use phrases
like:
- "Please provide your..."
- "What is your..."
- "Tell me about..."
- Example: "To begin, please tell me your name. {user_name}. Great, thanks {user_name}! Now, tell me what city you
live in. {city}"
4. Structure the Prompt Flow:
- Logical Sequence: Guide the user through the variable input process in a logical sequence. Ask for information in a
way that makes sense for the task.
- Conditional Logic: Consider using conditional statements (e.g., "if...then...") to adapt the prompt flow based on
user input.
- Example: "What kind of pet do you have? {pet_type}. If your {pet_type} is a dog, what breed is it? {dog_breed}"
5. Handle Variable Values:
- Data Validation: If possible, include instructions for DigiAI Agent to validate the user's input. This could involve
checking for data types, ranges, or specific formats.
- Error Handling: Provide instructions on how DigiAI Agent should handle invalid or missing values. This could involve
prompting the user to re-enter the information or providing default values.
- Dynamic Response: Ensure that the prompt is structured to use the variable values dynamically to generate
personalized responses, perform calculations, or access relevant information.
6. Test and Refine:
- Iterative Process: Test your prompt with different variable values and refine the instructions, flow, and error
handling as needed.
- User Feedback: Gather feedback from users to identify areas for improvement.
Example Prompt (Travel Itinerary Planner):
You are a travel itinerary planner. You need to ask the user for some information to create a personalized itinerary.
** Step 1, you need to ask the user for their desired destination: {destination}*
** Step 2, you need to ask the user for their expected trip duration: {trip_duration}*
** Step 3, you need to ask the user about their interests to ensure the itinerary includes activities they'll love
(e.g., history, adventure, relaxation, food, nightlife, culture, art, etc.). The user can provide multiple interests.
{travel_interests}*
** Step 4, you need to ask the user about their preferred daily budget to help you suggest appropriate accommodations
and activities (e.g., $50, $100, $200, etc.). {daily_budget}*
** Step 5, you need to use the information you gather from the user above, and generate a travelling plan for the user.*
By following these guidelines, you can effectively design prompts that leverage DigiAI Agent's dynamic variable input
capabilities to create interactive, personalized, and engaging experiences.