Skip to main content
Prompt engineering is the art and science of crafting effective instructions for AI models. Well-designed prompts dramatically improve response quality, accuracy, and reliability in your Flowise workflows.

What is Prompt Engineering?

Prompt engineering involves:
  • Instruction Design: How you tell the AI what to do
  • Context Provision: What information you provide
  • Output Formatting: How you structure responses
  • Constraint Setting: What boundaries you establish
  • Example Usage: Demonstrations of desired behavior
In Flowise, prompts appear in multiple places: system messages, prompt templates, tool descriptions, and node configurations.

Prompt Fundamentals

Anatomy of a Good Prompt

Effective prompts contain these elements:
1

Role Definition

Tell the AI what role it should play:“You are an expert financial advisor with 20 years of experience…”
2

Task Description

Clearly state what you want:“Analyze the provided financial data and identify potential risks…”
3

Context & Constraints

Provide relevant information and limitations:“Consider market conditions in 2024. Focus only on US equities. Limit response to 3 paragraphs.”
4

Output Format

Specify how to structure the response:“Provide your analysis in this format:\n1. Summary\n2. Risks\n3. Recommendations”
5

Examples (Optional)

Show examples of good responses:“Example analysis: [sample output here]“

Basic Prompt Structure

You are a helpful customer support agent for a SaaS company.

User Question: {question}

Respond in a friendly, professional tone. If you don't know the answer, 
admit it and offer to escalate to a human agent. Keep responses under 150 words.

Response:

Prompts in Flowise

Chat Model Prompts

Set system messages in chat model nodes:
1

Add Chat Model Node

Add a Chat Model node (ChatOpenAI, ChatAnthropic, etc.) to your canvas.
2

Configure System Message

Double-click the node and find the System Message field:
You are an AI assistant helping with data analysis.

Guidelines:
- Provide accurate, data-driven insights
- Cite sources when making claims
- Ask clarifying questions when needed
- Format responses with clear headings
3

Use Variables

Reference variables in your prompts:
You are assisting {userName} with their {projectType} project.

Prompt Templates

Use Prompt Template nodes for structured prompts:
Analyze the following customer review:

Review: {review}
Product: {productName}
Rating: {rating}/5

Provide:
1. Sentiment (Positive/Negative/Neutral)
2. Key themes (max 3)
3. Actionable insights for product team

Format as JSON:
{{
  "sentiment": "...",
  "themes": [...],
  "insights": [...]
}}

Chain Prompts

Conversational chains have specific prompt structures:
{chat_history}

Human: {input}
AI: Let me help you with that.

[Internal reasoning]

Response:
The {chat_history} variable is automatically populated from memory.

Tool Descriptions

Tool descriptions are prompts for the agent:
Searches academic papers on ArXiv.

Use this tool when the user asks about:
- Recent research or scientific papers
- Academic publications or studies  
- Technical concepts with citations needed

Input: Search query with relevant keywords (e.g., "neural networks", "quantum computing")
Output: List of papers with titles, authors, and abstracts

Do NOT use for:
- General web search
- News articles
- Non-academic content

Advanced Techniques

Chain of Thought Prompting

Encourage step-by-step reasoning:
Solve this problem step by step:

Problem: {problem}

Let's break it down:
1. First, identify what we know
2. Then, determine what we need to find  
3. Finally, work through the solution

Show your reasoning for each step before providing the final answer.
This improves accuracy on complex reasoning tasks.

Few-Shot Prompting

Provide examples of desired behavior:
Classify customer messages as: URGENT, NORMAL, or LOW_PRIORITY

Examples:

Message: "My account is locked and I can't access anything!"
Classification: URGENT
Reason: Account access issue requiring immediate attention

Message: "How do I change my email address?"
Classification: NORMAL
Reason: Standard account management question

Message: "Any plans to add dark mode?"
Classification: LOW_PRIORITY
Reason: Feature request, not time-sensitive

Now classify this message:
Message: {userMessage}
Classification:

Role-Based Prompting

Assign specific personas for better responses:
You are a senior software architect with expertise in 
distributed systems and cloud infrastructure.

Provide technical, detailed responses with code examples.
Use industry-standard terminology. Reference best practices.

ReAct Prompting

For agents with tools, use Reason + Act pattern:
You have access to these tools:
- search: Search the web
- calculate: Perform calculations
- database: Query customer database

For each user request:

1. THINK: Reason about what information you need
2. ACT: Use appropriate tool(s) to gather information  
3. OBSERVE: Review the tool results
4. RESPOND: Provide a helpful answer based on observations

Always explain your reasoning before acting.

Structured Output Prompting

Force specific output formats:
Extract key information and return ONLY valid JSON:

{
  "name": "full name",
  "email": "email address or null",
  "intent": "primary intent of message",
  "sentiment": "positive|negative|neutral",
  "urgency": "high|medium|low"
}

Text: {inputText}

JSON:

Prompt Optimization Techniques

Be Specific and Explicit

Summarize the article in exactly 3 bullet points.
Each bullet should be 10-15 words.
Focus on key findings, not background.

Use Delimiters

Clearly separate different parts:
Analyze the document below.

### DOCUMENT START ###
{document}
### DOCUMENT END ###

### INSTRUCTIONS ###
1. Identify main themes
2. Extract key statistics
3. Summarize conclusions

### OUTPUT FORMAT ###
Themes: [list]
Statistics: [list]  
Conclusions: [paragraph]

Set Constraints

Define clear boundaries:
Constraints:
- Maximum response length: 200 words
- Do not mention competitors by name
- Only reference information from provided context
- If unsure, say "I don't have enough information" 
- Maintain professional, neutral tone

Specify Tone and Style

Tone: Professional yet approachable, like a knowledgeable colleague

Style Guidelines:
- Use "we" and "our" (inclusive)
- Avoid jargon unless necessary
- Use active voice
- Include specific examples
- End with a clear call-to-action

Prompt Variables

Flowise supports dynamic prompt variables:

Standard Variables

You are helping {userName} on {currentDate}.

User's role: {userRole}
User's timezone: {timezone}
Previous context: {context}

User's question: {question}

Memory Variables

Conversation history:
{chat_history}

Current message: {input}

Respond considering the conversation context above.

Custom Variables

Define custom variables in your application:
// API request with custom variables
{
  "question": "What's the weather?",
  "overrideConfig": {
    "vars": {
      "userName": "Alice",
      "location": "New York",
      "preferences": "celsius"
    }
  }
}
Reference in prompts:
User: {userName}
Location: {location}
Units: {preferences}

Provide weather information accordingly.

Prompt Testing and Iteration

A/B Testing Prompts

1

Create Variations

Develop 2-3 different prompt variations for the same task.
2

Test with Examples

Run each variation against a set of test cases.
3

Measure Performance

Track metrics:
  • Response accuracy
  • User satisfaction
  • Task completion rate
  • Response time
  • Token usage
4

Iterate

Combine the best elements from each variation.

Common Issues and Fixes

Fix:
  • Add explicit length constraints
  • Use “Be concise” or “Brief response only”
  • Specify exact format (bullet points, word count)
  • Example: “Respond in 50 words or less”
Fix:
  • Add: “Only use information from the provided context”
  • Include: “If you don’t know, say ‘I don’t have that information’”
  • Use retrieval-augmented generation (RAG)
  • Request citations: “Cite sources for all claims”
Fix:
  • Provide more examples (few-shot prompting)
  • Use structured output formats (JSON, tables)
  • Set explicit tone and style guidelines
  • Reduce temperature parameter
Fix:
  • Repeat important instructions multiple times
  • Use delimiters to separate instructions from content
  • Place critical instructions at the start AND end
  • Test with different models (some follow better)
Fix:
  • Summarize long context before including
  • Use conversation summary memory
  • Extract only relevant sections
  • Upgrade to models with larger context windows

Model-Specific Considerations

GPT-4 / GPT-3.5

  • Strengths: Instruction following, structured output
  • Tips:
    • Can handle complex, multi-step prompts
    • Responds well to role-based prompting
    • Good at maintaining tone and style

Claude

  • Strengths: Long context, nuanced understanding
  • Tips:
    • Excels at analysis and reasoning tasks
    • Use XML-style tags for structure
    • Very good at following ethical guidelines

Open Source Models (Llama, Mistral)

  • Strengths: Cost-effective, customizable
  • Tips:
    • Simpler, more direct prompts work better
    • Provide more examples (few-shot)
    • May need more explicit constraints
    • Test thoroughly for consistency

Prompt Templates Library

Customer Support

You are a customer support agent for {companyName}.

Guidelines:
1. Be empathetic and acknowledge the customer's concern
2. Provide clear, actionable solutions
3. If you can't help, escalate appropriately
4. Always end by asking if there's anything else you can help with

Customer message: {message}

Your response:

Content Generation

Write a {contentType} about {topic}.

Target audience: {audience}
Tone: {tone}
Length: {wordCount} words
Key points to cover:
{keyPoints}

Include:
- Compelling introduction
- Clear structure with headings
- Specific examples or case studies
- Strong conclusion with call-to-action

Content:

Data Analysis

Analyze the following data:

{data}

Provide:
1. Summary statistics
2. Key trends or patterns
3. Anomalies or outliers
4. Insights and recommendations

Present findings in a clear, executive-friendly format.

Analysis:

Code Review

Review this code:

```{language}
{code}
Provide feedback on:
  1. Code quality and best practices
  2. Potential bugs or issues
  3. Performance considerations
  4. Security concerns
  5. Suggested improvements
Be constructive and specific. Review:

### Translation

```text
Translate the following text from {sourceLanguage} to {targetLanguage}.

Considerations:
- Maintain the original tone and intent
- Use culturally appropriate expressions
- Keep formatting (markdown, line breaks)
- Preserve any technical terms or brand names

Source text:
{text}

Translation:

Best Practices Summary

Be Specific

Provide explicit, detailed instructions. Vague prompts yield inconsistent results.

Provide Context

Include relevant background information. Context improves response quality.

Use Examples

Show examples of desired outputs. Few-shot learning is highly effective.

Set Constraints

Define boundaries and limitations. Prevents unwanted behavior.

Format Output

Specify exact format needed. Structured outputs are easier to process.

Test and Iterate

Continuously refine based on results. Prompt engineering is iterative.

Next Steps

Build docs developers (and LLMs) love