Guide to Prompt Engineering
Mastering Prompt Engineering Techniques & The Capabara Platform
What is Prompt Engineering?
It's the skill of crafting effective inputs (prompts) to communicate with
AI models.
Think of it as giving the AI clear, S.M.A.R.T. instructions to get the
most accurate, relevant, and creative responses.
The Building Blocks of Prompting
This is the fundamental techniques that form the basis of more complex
prompting:
● Zero-Shot Prompting: Giving the AI a task directly, with no examples.
● Few-Shot Prompting: Providing a few examples to guide the AI's response.
Zero-Shot Prompting: The "Just Do It" Method
It is asking the AI to perform a task without giving it any examples first. This relies
on the AI's vast pre-existing knowledge.
It is like asking your musician friend about specifics in a music (genre, BPM,
instruments, etc). You don’t need to give them examples; they just know it
Example prompt:
Classify this text either positive or negative: The event was a success
In this case the AI understands the sentiment without needing an example
Few-Shot Prompting: Leading by Example
Giving the AI a few examples (shots) of what you want before asking it to complete
the task. This helps it understand the desired format, style, and context.
In simple terms: It's like teaching a child a new pattern by showing them "A is to B, C
is to D, now what is E to...?“
Example prompt:
A 'glimmer' is a small, shining light. A 'whisper' is a soft, quiet sound. A 'shard' is a
sharp piece of a broken object. A 'murmur' is a low, continuous sound. What is a
'speck’?
Expected AI Output: A tiny particle or spot.
Reasoning and Structuring Prompts
These techniques help the AI "think" more logically and explore different
solutions.
● Chain-of-Thought (CoT) Prompting: Guiding the AI to break down problems
step-by-step.
● Tree of Thoughts (ToT): Allowing the AI to explore multiple reasoning paths at
once.
● Graph Prompting: Representing information as a graph to help the AI
understand complex relationships.
Chain-of-Thought (CoT): Thinking Step-by-Step
A technique that encourages the AI to explain its reasoning process step-by-step
before giving a final answer. This dramatically improves its accuracy on complex
tasks.
It's showing your work in a math problem. The process helps you catch errors and
arrive at the right conclusion.
Example prompt:
If a classroom has 5 rows of desks with 4 desks in each row, but 3 desks are empty,
how many students are there? Let's think step by step.
Expected AI Output: The AI will first calculate the total desks (5 * 4 = 20), then
subtract the empty ones (20 - 3 = 17) to find the answer.
Tree of Thoughts: Exploring Many Paths
An advanced technique where the AI explores multiple reasoning paths
simultaneously, like branches of a tree. It assesses the progress along each path
and self-corrects, choosing the most promising route.
Example prompt:
I need to plan a three-day trip to Paris on a budget of $500. Generate three
different itineraries, evaluating the pros and cons of each for cost and
experience.
Expected AI Output: The AI will explore different "branches" for activities, food,
and lodging to construct and evaluate complete itineraries.
Graph Prompting: Connecting the Dots
Structuring information as a graph with nodes (entities) and edges (relationships)
to help the AI understand complex systems. Creating a mind map of some sort to
show how different ideas link to each other
Example prompt:
Given the social network graph where (Alice)-[friends with]->(Bob) and (Bob)-
[works with]->(Charlie), are Alice and Charlie directly connected?
Expected AI Output: The AI can analyze the graph structure to determine there is
no direct connection that would link Alice and Charlie.
Augmenting and Automating Prompts: smart prompts
● Retrieval Augmented Generation (RAG): Giving the AI external documents to
use as a knowledge base.
● Generate Knowledge Prompting: Asking the AI to generate facts before
answering.
● Automatic Prompt Engineer (APE): Using an AI to write prompts for another
AI.
RAG: Giving the AI an Open Book
Providing the AI with relevant, up-to-date information from an external source
(like a document or database) and instructing it to use that information to answer
a question. This reduces made-up answers.
Example prompt:
Using the attached company policy document, explain the procedure for
requesting vacation days.
Expected AI Output: The AI will read the specific document and provide a precise
answer based only on that text.
Knowledge Prompting: A Quick Brainstorm
A two-step process where you first ask the AI to generate a few key facts or
points about a topic, and then you ask your main question. This helps "warm up"
the AI with relevant context.
Example prompt:
1. Generate four key facts about the Amazon rainforest.
2. Using these facts, explain why the rainforest is crucial for the global climate.
Expected AI Output: The final answer is built upon a foundation of relevant,
generated knowledge.
Automatic Prompt Engineer (APE): AI for “your” AI
A technique where you use an AI model to generate and select the best possible
prompts for another AI model to solve a specific task. (Asking GPT to generate
prompts for Gemini to solve)
Example prompt:
Generate five different prompts that would instruct an AI to write a professional
and polite email declining a job offer.
Expected AI Output: The APE model would then output several high-quality
prompts for you to use.
Advanced Prompting Strategies
These techniques involve chaining prompts, acting on feedback, and interacting
with tools.
● Prompt Chaining: Breaking a task into a series of smaller, sequential prompts.
● ReAct (Reason and Act): Letting the AI reason, act (e.g., search the web),
and observe to solve problems.
● Reflexion: Allowing the AI to review its own work and correct its mistakes.
Prompt Chaining: A Domino Effect
Breaking a complex task into smaller subtasks, where the output of one prompt
becomes the input for the next one.
Example prompt:
1. Prompt 1: "Extract the key topics from this customer review: 'The battery life is
amazing, but the screen is too dim.'" -> Output 1: "Battery life, screen dimness."
2. Prompt 2 (using Output 1): "Write a two-sentence summary for the topics: Battery
life, screen dimness."
Expected AI Output: The AI will create a summary on why battery life is directly
connected to screen dimness
ReAct: Reason, Act, Observe
A framework where the AI can generate both reasoning steps and actions. The
"actions" can be things like searching the internet or querying a database. The AI
then observes the results of its action to inform its next step. (Just like how
current LLMs have Thinking Tokens)
Example prompt: Who is the current CEO of Microsoft?
Expected AI Output:
● Thought: I need to find the current CEO of Microsoft.
● Action: Search "current CEO of Microsoft".
● Observation: The search result is Satya Nadella.
● Answer: Satya Nadella is the current CEO of Microsoft.
Reflexion: Learning from Mistakes
A technique where the AI generates a response, gets feedback (or evaluates its
own work), and then "reflects" on that feedback to improve its next attempt in a
new session.
Example prompt:
1. Write a short story about a robot who finds a cat." (Outputs a story)
2. The previous story was a bit generic. In the next attempt, make the robot's
personality more curious and the setting more futuristic.“
Final AI Output: The AI generates a new, improved story based on the reflection.
Specialized Prompting Techniques (1)
These are highly specialized techniques for particular types of tasks and models.
● Meta Prompting: Giving the AI detailed instructions about its role, capabilities,
and constraints.
● Self-Consistency: Generating multiple answers and choosing the one that
appears most often.
● Directional Stimulus Prompting: Using hints or keywords to guide the AI
toward a specific desired output.
Specialized Prompting Techniques (2)
These are highly specialized techniques for particular types of tasks and models.
● Active-Prompt: Selecting the most useful questions for humans to answer to
help the AI learn.
● Automatic Reasoning and Tool-use (ART): The AI learns to use external tools
from examples.
● Program-Aided Language Models (PAL): The AI writes code to solve
problems.
● Multimodal CoT: Chain-of-Thought for models that understand images and
text.
Combining Multiple Techniques
You can achieve highly specific and high-quality results by layering multiple
techniques into one comprehensive prompt.
Example Prompt (combining Meta-Prompting, CoT, Directional Stimulus, and
Few-Shot)
META-PROMPT :
You are 'PitchPerfect AI', a creative marketing assistant. Your goal is to turn a
product name and its features into a compelling, 2-sentence pitch for a landing
page.
Combining Multiple Techniques
DIRECTIONAL STIMULUS & FEW-SHOT:
Focus on benefits, not just features, and make the tone feel aspirational and
simple.
● Example Input:
○ Product: {field1} = "Aura Ring"
○ Features: {field2} = "Tracks sleep, heart rate, and activity. Titanium body."
Combining Multiple Techniques
EXAMPLE USER INPUT:
Now, generate a pitch for the following product. Let's think step-by-step to find
the core benefit first.
Product: {field1} = RTX 9900
Features: {field2} = window type air conditioner size GPU that can consume the
available power in your area
Combining Multiple Techniques
CHAIN-OF-THOUGHT:
Benefits: The user can unlock their health potential and understand their body.
The titanium makes it durable and elegant for daily wear.
Pitch: Unlock a deeper understanding of your body with the Aura Ring. This
elegant, durable ring provides key insights into your sleep and activity,
empowering you to reach your full potential.
CAPABARA
PLATFORM: AI
TOOL-BUILDING
PLATFORM
How to Use Capabara: The Basics
Capabara Form Inputs
Form inputs allow your users to provide information that gets inserted directly into
your prompts.
● Text Field: For short inputs like names or single sentences.
● Multi-Text Field: For longer inputs like paragraphs or descriptions.
● Dropdown List: Perfect for when you want to give the user a specific set of
choices (e.g., language, tone, topic).
Practical Example: Building an AI Translator
Tool Title: AI Language Translator
● Tool Description: A tool to translate text into different languages.
● Form Inputs:
○ Input Field 1: (Multi-Text Field) named Text to Translate.
○ Input Field 2: (Dropdown List) named Language to Translate to with options like English,
Chinese, Malay, and Tamil.
● User Prompt: "Welcome the user. Translate the following phrase: {field1} into
the language {field2}."
● System Prompt: "You are a language expert. Show the translation in bullet
points with the format: Original Text, Language Selected, Translated Phrase."
Thank you.
Reference
https://www.promptingguide.ai/te
chniques