graph LR
A[Complete Prompt] --> B[Goal/Task]
A --> C[Return Format]
A --> D[Constraints/Warnings]
A --> E[Context]
style A fill:#3498db,stroke:#2980b9,color:white,stroke-width:2px
style B fill:#2ecc71,stroke:#27ae60,color:white,stroke-width:2px
style C fill:#4a69bd,stroke:#3c6382,color:white,stroke-width:2px
style D fill:#e74c3c,stroke:#c0392b,color:white,stroke-width:2px
style E fill:#95a5a6,stroke:#7f8c8d,color:white,stroke-width:2px
Component | Purpose | Example |
---|---|---|
π― Goal/Task | Define what you want | "List 3 medium-length hikes near SF with unique views" |
π Return Format | Specify output structure | "For each: name, location, distance, time, features" |
Prevent errors | "Verify trail names and ensure they're currently open" | |
π Context | Add background info | "I'm an intermediate hiker who prefers less crowded trails" |
Source: @benhylak on x
graph TD
A[Prompting Strategies] --> B[Zero-Shot]
A --> C[Few-Shot]
A --> D[Chain of Thought]
style A fill:#3498db,stroke:#2980b9,color:white,stroke-width:2px
style B fill:#e74c3c,stroke:#c0392b,color:white,stroke-width:2px
style C fill:#2ecc71,stroke:#27ae60,color:white,stroke-width:2px
style D fill:#9b59b6,stroke:#8e44ad,color:white,stroke-width:2px
Zero-Shot | Few-Shot |
---|---|
No examples provided | Provides examples first |
"Recommend a hiking trail near SF with ocean views" | "Criteria: Family trail, Marin County Answer: Muir Woods... Criteria: Dog-friendly, waterfalls Answer: Alamere Falls... Criteria: Panoramic views, transit access Answer: ?" |
Simple but less specific | More verbose but better pattern matching |
Type | Description | Example |
---|---|---|
Zero-Shot CoT | Add "Let's think step by step" | "What's the best hiking trail for seeing wildflowers in April? Let's think step by step." |
Few-Shot CoT | Show reasoning process examples | "Question: Best dog-friendly trail? Reasoning: 1) Check dog policies 2) Find appropriate length... Answer: Waterfall Loop Trail" |
graph TD
subgraph Bad[Bad Prompt]
BP["Find hiking trails"]
end
subgraph Good[Good Prompt]
GP1["GOAL: Recommend 3 moderate trails(4-8 miles)"]
GP2["near Oakland with views<br>Include: difficulty, location, features"]
GP3["For context:<br>Im Training for backpacking<br>heres my last runs<br>run 1, from foo to bar. did xyz.<br>run 2, from foo to baz. did xyz."]
GP1 --> GP2 --> GP3
end
Bad --> Good
style Bad fill:#990000,stroke:#660000,color:white,stroke-width:2px
style Good fill:#006600,stroke:#004400,color:white,stroke-width:2px
style BP fill:#990000,stroke:#660000,color:white
style GP1 fill:#006600,stroke:#004400,color:white,font-weight:bold
style GP2 fill:#006600,stroke:#004400,color:white
style GP3 fill:#006600,stroke:#004400,color:white
graph TD
A[Input] --> B1[Thought 1]
A --> B2[Thought 2]
A --> B3[Thought 3]
B1 --> C1[Thought 1.1]
B1 --> C2[Thought 1.2]
B2 --> C3[Thought 2.1]
B2 --> C4[Thought 2.2]
B3 --> C5[Thought 3.1]
C1 --> D1[Thought 1.1.1]
C1 --> D2[Thought 1.1.2]
C4 --> D3[Thought 2.2.1]
D3 --> Z[Output]
style A fill:#ffffff,stroke:#000000
style B1 fill:#d9f6d9,stroke:#2e8b57
style B2 fill:#009900,stroke:#006600,color:white
style B3 fill:#ffcccb,stroke:#e74c3c
style C1 fill:#d9f6d9,stroke:#2e8b57
style C2 fill:#ffcccb,stroke:#e74c3c
style C3 fill:#ffcccb,stroke:#e74c3c
style C4 fill:#009900,stroke:#006600,color:white
style C5 fill:#ffcccb,stroke:#e74c3c
style D1 fill:#ffcccb,stroke:#e74c3c
style D2 fill:#ffcccb,stroke:#e74c3c
style D3 fill:#009900,stroke:#006600,color:white
style Z fill:#d9f6d9,stroke:#2e8b57
Prompting Method | Description | Good For |
---|---|---|
Input-Output | Direct prompting | Simple, straightforward tasks |
Chain of Thought (CoT) | Single reasoning path | Step-by-step problems |
Tree of Thoughts (ToT) | Multiple reasoning paths | Complex problems requiring exploration |
- Generate multiple thought branches from the input
- Evaluate each branch to determine which is promising (green) vs. dead-end (pink)
- Explore promising paths further while abandoning others
- Continue branching and evaluating until reaching a solution
- Uses search algorithms (breadth-first/depth-first) to explore the tree
Imagine three different hiking experts are answering this question.
All experts will write down 1 step of their thinking, then share it with the group.
Then all experts will go on to the next step, etc.
If any expert realizes they're wrong at any point, they leave.
The question is: What's the best 3-day backpacking route in Yosemite for someone training for a longer trek?
Consider elevation gain, camping options, water sources, and scenic value.
- β Be specific: Clear criteria, measurable targets
- β Structure output: Define format, use bullet points
- β Chunk information: Organize in clear sections
- β Add context: Include relevant preferences/background
- β Use patterns: Test cases, expert perspectives, step-by-step format
- β Avoid: Being vague, contradictory requirements, ignoring model limitations
Remember: Great prompts evolve through iteration!