AI Chat Prompt Best Practices
AI Chat is a powerful feature leverages advanced AI technology to help you interact with your private data in a seamless and secure manner. By understanding how to craft effective prompts, you can get the most out of the AI Chat and retrieve the information you need quickly and accurately.
How Does AI Chat Work?
The AI Chat utilizes your uploaded documents to provide relevant responses. When you ask a question, the AI generates search terms based on your prompt and retrieves the best-matching content from your documents. It then uses this information to generate a coherent and helpful response. The AI may may several requests for relevant content, depending on the nature of the request.
Best Practices for Crafting Prompts
To ensure the AI Chat provides accurate and helpful responses, consider the following best practices when crafting your prompts:
- Be Specific: Clearly mention relevant details such as document names, company names, dates, or any specific information that can help narrow down the search.
- Provide Context: Offer additional background information or specify the document type to guide the AI in understanding your request.
- Ask Direct Questions: Frame your queries as direct questions to get concise answers.
- Use Natural Language: Communicate as if you are speaking to a person; avoid using overly technical jargon unless necessary.
Examples of Effective Prompts
Below are examples showcasing less effective prompts and improved versions that are more likely to yield the intended responses.
Example 1: Policy Renewal Date
- Less Effective Prompt: "When does my policy renew?"
- Issue: The prompt is too general. If you have multiple policies, the AI may not know which one you're referring to.
- Improved Prompt: "When does my ABC Company Co. health insurance policy renew?"
- Why It's Better: Specifies the company and policy type, allowing the AI to retrieve the exact information.
Example 2: Contract Terms
- Less Effective Prompt: "What are the terms?"
- Issue: Vague and lacks context about which document or agreement you're referring to.
- Improved Prompt: "What are the payment terms outlined in the service agreement with XYZ Corp dated January 2023?"
- Why It's Better: Provides specific details, helping the AI to find the relevant document and information.
Example 3: Financial Reports
- Less Effective Prompt: "Show me the latest figures."
- Issue: Ambiguous; does not specify which figures or reports.
- Improved Prompt: "Provide the Q2 2023 sales figures for Product X from the financial report."
- Why It's Better: Identifies the time period, product, and document, enabling precise retrieval.
Example 4: Legal Compliance Information
- Less Effective Prompt: "Do we comply with regulations?"
- Issue: Too broad; doesn't specify which regulations or areas of compliance.
- Improved Prompt: "Summarize how our company complies with the GDPR as outlined in our 'Data Protection Policy' document."
- Why It's Better: Specifies the regulation and the document, allowing for a detailed response.
Example 5: Project Deadlines
- Less Effective Prompt: "When is the project due?"
- Issue: Unclear which project you're referring to.
- Improved Prompt: "What is the final submission deadline for the 'Alpha Project' as stated in the project timeline document?"
- Why It's Better: Specifies the project name and refers to a specific document, aiding accurate retrieval.
Example 6: Meeting Notes Retrieval
- Less Effective Prompt: "What did we discuss last time?"
- Issue: Vague and lacks context.
- Improved Prompt: "Summarize the key action items from the 'Team Meeting Minutes - September 15, 2023.'"
- Why It's Better: Specifies the meeting date and document, enabling the AI to provide a focused summary.
Example 7: Product Specifications
- Less Effective Prompt: "Tell me about the product specs."
- Issue: Non-specific; doesn't identify which product.
- Improved Prompt: "Provide the technical specifications for 'Model ZX-300' from the 'Product Specifications Sheet.'"
- Why It's Better: Identifies the product model and the source document.
Example 8: Employee Records
- Less Effective Prompt: "What's the status of John's employment?"
- Issue: Missing context about which John or what status information is needed.
- Improved Prompt: "What is John Smith's current role and tenure as per the 'Employee Records - HR Database'?"
- Why It's Better: Specifies the full name, information needed, and the source document.
Example 9: Sales Projections
- Less Effective Prompt: "What are the future sales?"
- Issue: Too broad and lacks specifics.
- Improved Prompt: "What are the Q4 2023 sales projections for 'Product Line A' according to the 'Annual Sales Forecast' document?"
- Why It's Better: Specifies the time frame, product line, and source document for accurate information.
Using Variables and Handlebars Templating
AI Chat and AI Workflows support Handlebars templating, allowing you to create dynamic prompts with variables and conditional logic.
Default Variables
Default variables are automatically available in all prompts. These variables are provided in both camelCase and snake_case formats for consistency. Use them to include dynamic information:
Universal Defaults (available in AI Chat and AI Workflows):
{{date}},{{currentDate}},{{current_date}}- Current date (YYYY-MM-DD format){{year}},{{currentYear}},{{current_year}}- Current year as string{{month}}- Current month (01-12){{day}}- Current day (01-31){{currentDateTime}},{{current_date_time}}- Full date/time (ISO format)
Chat-Specific Defaults (available in AI Chat):
{{chatName}},{{chat_name}}- Name of the chat (if available)
Workflow-Specific Defaults (available in AI Workflows):
{{workflowName}},{{workflow_name}}- Name of the workflow{{totalSteps}},{{total_steps}}- Total number of steps in the workflow{{step-previous}}- Output from the previous step{{step-1}},{{step-2}}, etc. - Output from specific steps
Workflow Job-Specific Defaults (available when running workflow jobs):
{{workflowJobName}},{{workflow_job_name}}- Name of the workflow job{{stepNumber}},{{step_number}}- Current step number (1-indexed)
Example:
Provide a summary of sales data for {{year}}. Focus on Q{{month}} results.
Conditional Logic
Use Handlebars conditionals to create dynamic prompts:
If/Else Statements:
{{#if chatName}}
Continue our discussion about {{chatName}}.
{{else}}
Let's start a new topic.
{{/if}}
Example in Workflow:
{{#if step-previous}}
Based on the previous step: {{step-previous}}
Now refine this analysis with additional context.
{{else}}
This is the first step in workflow {{workflowName}}.
{{/if}}
Example in Workflow Job (when running a workflow):
This is step {{stepNumber}} of {{totalSteps}} in workflow {{workflowName}}.
Syntax Highlighting
When editing prompts, Handlebars expressions are automatically highlighted to help you identify variables:
- Default variables (like
{{date}},{{year}}) appear in blue (primary color) - Defined variables (workflow variables, step outputs) appear in green (success color)
- Undefined variables appear in red (error color) to indicate they need to be defined
- Handlebars helpers (like
{{#if}},{{else}}) appear in the info color
This visual feedback helps you identify available variables and catch errors before running your workflow or chat.
Best Practices for Variables
- Use Default Variables: Leverage built-in variables like
{{date}}and{{year}}instead of hardcoding values - Test Conditionals: Verify that conditional logic works as expected with different variable values
- Escape Literals: If you need literal
{{characters, wrap them in backticks:`{{` - Dot Notation: Use dot notation to access nested properties:
{{step-1.address.city}} - Variable Behavior: In AI Chat, undefined variables are automatically removed from your message. In AI Workflows, undefined variables remain as placeholders so you can identify and fix them before running the workflow.
Additional Tips
- Refer to Document Titles: If you know the name of the document, include it in your prompt.
- Include Dates When Relevant: Dates can help narrow down the information, especially if documents are time-sensitive. Consider using
{{date}}or{{year}}variables for dynamic date references. - Specify the Format: If you need the information in a specific format (e.g., bullet points, summary, report), mention it in your prompt.
- Use Variables for Dynamic Content: Leverage Handlebars variables to make prompts reusable across different contexts and time periods.
Utilizing AI Chat for Document Generation
The AI Chat can also assist in creating new documents based on existing templates or styles.
Example Prompt for Document Generation
- Prompt: "Using the document titled 'Marketing Plan Template,' develop a marketing plan for Acme Corp. Ensure that all strategies are based on data relevant to Acme Corp. The template should guide the style and tone but not the content."
- Why It's Effective: Clearly states the task, specifies the template to use, and outlines expectations regarding content and style.
Conclusion
By providing clear, specific, and detailed prompts, you enable the AI Chat to deliver accurate and helpful responses tailored to your needs. Remember to:
- Be specific and provide context.
- Reference relevant documents.
- Use natural language and direct questions.