Welcome to Module 3 of "AI and Automation Level Two"! In Module 1, we reviewed the basics. In Module 2, we built advanced automation workflows. Now, we are going to focus on something very important โ how we talk to AI.
Have you ever asked an AI a question and gotten a weird or wrong answer? That happens because the prompt (the question you ask) was not clear enough. In this module, we will learn how to write advanced prompts that get better, more reliable answers.
Think of prompt engineering like giving instructions to a very smart but literal assistant. If you give vague instructions, you get vague results. If you give clear, detailed instructions, you get amazing results. By the end of this module, you will be able to craft prompts that produce consistent, structured, and high-quality outputs. Let us get started!
By the end of this module, you will be able to:
In a busy restaurant in Lagos, there was a chef named Emeka. Emeka was famous for his amazing jollof rice. But he had a problem. He wanted to create a new menu item. He decided to ask an AI for help.
He typed: "Give me a recipe."
The AI replied: "Here is a recipe for pancakes."
Emeka was frustrated. That was not what he wanted. He realized he needed to be more specific. He tried again: "Give me a Nigerian recipe using chicken and rice."
The AI replied: "Here is a recipe for chicken and rice stew."
That was better, but still not what he wanted. Emeka thought, "I need to give clearer instructions." He decided to use a Chain-of-Thought approach. He wrote: "Step 1: Think about the best Nigerian chicken dishes. Step 2: Choose the most popular one. Step 3: Provide a detailed recipe with ingredients and steps."
The AI replied with a perfect recipe for Nigerian chicken stew. Emeka was happy. But he wanted to take it further. He used a Tree-of-Thought approach. He asked for multiple versions: "Version 1: Spicy. Version 2: Mild. Version 3: With vegetables."
The AI gave him three amazing recipes. Emeka chose the best one and added it to the menu. It became a huge success.
What can we learn from this story? The quality of the answer depends on the quality of the prompt. Advanced prompt engineering techniques like Chain-of-Thought and Tree-of-Thought can help you get much better results.
A prompt is the question or instruction you give to an AI. It is like asking a friend for help. The clearer your question, the better the answer.
Definition: A prompt is the input you give to an AI to get a response.
Why it is important: The prompt is the most important factor in getting good results from AI.
Simple explanation: Imagine you are ordering food. If you say "food," you might get anything. If you say "a slice of pepperoni pizza," you get exactly what you want. A prompt is like your order.
Real-life example: "What is the capital of Nigeria?" is a prompt.
School example: "Explain photosynthesis" is a prompt.
Home example: "How do I fix a leaky tap?" is a prompt.
Nigerian example: "How do I make jollof rice?" is a prompt.
Illustration (ASCII):
+-------------------+ | PROMPT | | (Question/Input) | +-------------------+ | | | | v | +-------------------+ | AI | | (Responds) | +-------------------+ | | | | v | +-------------------+ | ANSWER | | (Output) | +-------------------+
Mini summary: A prompt is the input you give to an AI. A good prompt gets a good answer.
A simple prompt is short and general. An advanced prompt is detailed and specific. It gives the AI more context and instructions.
Definition: A simple prompt is brief. An advanced prompt is detailed with instructions.
Why it is important: Advanced prompts get better, more reliable results.
Simple explanation: "Tell me about dogs" is simple. "Tell me about the history of dogs as pets in Nigeria, including their breeds and uses" is advanced.
Real-life example: Simple: "Give me a recipe." Advanced: "Give me a healthy Nigerian soup recipe that is easy to make and uses local ingredients."
School example: Simple: "Explain photosynthesis." Advanced: "Explain photosynthesis in a way a 10-year-old can understand, including a diagram and a step-by-step process."
Home example: Simple: "How do I clean this?" Advanced: "How do I clean a stained white shirt using household items?"
Nigerian example: Simple: "How do I farm?" Advanced: "How do I farm cassava in Ogun State, including soil preparation, planting, and harvesting?"
Illustration (ASCII):
+-------------------+ +-------------------+
| SIMPLE PROMPT | | ADVANCED PROMPT |
| "Tell me about | | "Tell me about |
| dogs" | | dogs in Nigeria, |
+-------------------+ | including breeds, |
| uses, and care" |
+-------------------+
Mini summary: Advanced prompts are detailed and specific. They give the AI more context and instructions.
Chain-of-Thought is a technique where you ask the AI to think step-by-step. You break down the problem into smaller pieces.
Definition: Chain-of-Thought is when you ask the AI to show its reasoning step-by-step.
Why it is important: It helps the AI think more carefully and gives you more accurate answers.
Simple explanation: Imagine you are solving a math problem. You do not just write the answer. You write down each step. Chain-of-Thought is like that. You ask the AI to show its work.
Real-life example: "Step 1: Think about the problem. Step 2: Brainstorm solutions. Step 3: Choose the best solution. Step 4: Write the answer."
School example: "Step 1: Read the question. Step 2: Identify the key facts. Step 3: Solve the problem. Step 4: Check your answer."
Home example: "Step 1: Find the leak. Step 2: Turn off the water. Step 3: Fix the pipe. Step 4: Turn the water back on."
Nigerian example: "Step 1: Check the soil. Step 2: Determine if it needs water. Step 3: Turn on the irrigation. Step 4: Monitor the moisture."
Illustration (ASCII):
+-------------------+ | CHAIN-OF-THOUGHT | +-------------------+ | Step 1: Think | | Step 2: Plan | | Step 3: Execute | | Step 4: Review | +-------------------+
Mini summary: Chain-of-Thought asks the AI to think step-by-step. It leads to more accurate answers.
Tree-of-Thought is a technique where you ask the AI to explore multiple possible paths. It is like a tree with many branches.
Definition: Tree-of-Thought is when you ask the AI to consider multiple options before choosing the best one.
Why it is important: It helps the AI think more creatively and explore different possibilities.
Simple explanation: Imagine you are planning a trip. You consider flying, driving, or taking a train. You explore each option before choosing. Tree-of-Thought is like that.
Real-life example: "Option 1: Use chicken. Option 2: Use beef. Option 3: Use fish. Choose the best one and explain why."
School example: "Method 1: Use algebra. Method 2: Use geometry. Method 3: Use trial and error. Choose the best method."
Home example: "Option 1: Repair the chair. Option 2: Buy a new chair. Option 3: Repurpose the wood. Choose the best option."
Nigerian example: "Option 1: Plant corn. Option 2: Plant cassava. Option 3: Plant yams. Choose the best for the soil type."
Illustration (ASCII):
+-------------------+ | TREE-OF-THOUGHT | +-------------------+ | Option 1 | | / \ | | Option 2 Option 3| | \ / | | Best one | +-------------------+
Mini summary: Tree-of-Thought explores multiple options before choosing the best one. It encourages creative thinking.
A dynamic prompt is a prompt that changes based on variables. You use placeholders that are filled in later.
Definition: A dynamic prompt has placeholders that are replaced with specific values.
Why it is important: Dynamic prompts are reusable. You can use the same prompt with different inputs.
Simple explanation: Imagine you have a letter template. You fill in the name and date each time. A dynamic prompt is like that template.
Real-life example: "Write a thank-you note to [customer_name] for their purchase of [product_name]."
School example: "Explain [topic] to a student in [grade_level]."
Home example: "Give me a recipe using [ingredient1] and [ingredient2]."
Nigerian example: "Give me farming tips for [crop_name] in [state_name]."
Illustration (ASCII):
+-------------------+ | DYNAMIC PROMPT | +-------------------+ | "Hello [name], | | how are you?" | +-------------------+ | Replace [name] | | with "Chidi" | +-------------------+ | "Hello Chidi, | | how are you?" | +-------------------+
Mini summary: Dynamic prompts use variables. They are reusable and can be customized.
Context injection is when you give the AI background information to help it understand the task better.
Definition: Context injection is adding relevant background information to a prompt.
Why it is important: It helps the AI give more accurate and relevant answers.
Simple explanation: Imagine you are telling a friend about your day. You give them context so they understand your story. Context injection is like that.
Real-life example: "Our company sells shoes. Our customers are mostly young adults. Write a marketing email."
School example: "We are studying ecosystems. We have learned about food chains. Write a summary."
Home example: "We are planning a trip to the beach. The weather is usually hot. What should we pack?"
Nigerian example: "We are farmers in Kaduna. The rainy season is coming. What crops should we plant?"
Illustration (ASCII):
+-------------------+ | CONTEXT | | INJECTION | +-------------------+ | Without context: | | "Write a message" | +-------------------+ | With context: | | "We are a bank. | | Our customers are | | in Nigeria. Write | | a welcome message"| +-------------------+
Mini summary: Context injection gives the AI background information. It helps the AI give better answers.
Prompt optimization is the process of improving your prompt to get better results. You test, tweak, and refine your prompt.
Definition: Prompt optimization is improving a prompt through testing and iteration.
Why it is important: It helps you get the best possible results from the AI.
Simple explanation: Imagine you are baking a cake. You try a recipe. It is okay, but you want it to be better. So you add more sugar, bake it longer, and try again. Prompt optimization is like that.
Real-life example: You start with "Give me a recipe." You test it. You change it to "Give me a healthy Nigerian soup recipe." You test it again. You keep improving it.
School example: You start with "Explain photosynthesis." You test it. You change it to "Explain photosynthesis in simple terms." You test it again.
Home example: You start with "How do I clean this?" You test it. You change it to "How do I clean a stained shirt?" You test it again.
Nigerian example: You start with "How do I farm?" You test it. You change it to "How do I farm cassava in Ogun State?" You test it again.
Illustration (ASCII):
+-------------------+ | OPTIMIZATION | +-------------------+ | 1. Write prompt | | 2. Test it | | 3. Evaluate | | 4. Improve it | | 5. Repeat | +-------------------+
Mini summary: Prompt optimization is the process of improving a prompt through testing and iteration.
After you write a prompt, you need to evaluate it. Evaluation means checking if the prompt is working well. You look at the answers and see if they are accurate, complete, and relevant.
Definition: Evaluation is checking the quality of the prompt and its outputs.
Why it is important: Evaluation helps you know if your prompt is good enough. It helps you find areas for improvement.
Simple explanation: Imagine you are a teacher. You give a test. After the test, you check the answers to see if the test was a good test. Evaluation is like that.
Real-life example: You ask "What is the capital of Nigeria?" The AI says "Lagos." That is wrong. The prompt is not working. You need to improve it.
School example: You ask "Explain the water cycle." The AI gives a long, confusing answer. The prompt is not good for young students. You need to improve it.
Home example: You ask "How do I fix a leaky tap?" The AI gives a complicated answer. The prompt is not clear. You need to improve it.
Nigerian example: You ask "How do I make jollof rice?" The AI gives a recipe that is not authentic. The prompt is not specific enough. You need to improve it.
Illustration (ASCII):
+-------------------+ | EVALUATION | +-------------------+ | Check accuracy | | Check completeness| | Check relevance | +-------------------+
Mini summary: Evaluation is checking if your prompt is working well. It helps you find areas for improvement.
Edge cases are situations that are unusual or unexpected. A good prompt should handle edge cases gracefully.
Definition: Edge cases are unusual or unexpected situations.
Why it is important: Handling edge cases makes your prompt more robust. It works well in all situations.
Simple explanation: Imagine you are giving directions. Most people ask for directions to a place. But what if someone asks for directions to a place that does not exist? That is an edge case.
Real-life example: "What if the user asks a question that is not about the topic?"
School example: "What if a student asks a question that is not in the curriculum?"
Home example: "What if the smart device does not work?"
Nigerian example: "What if the farmer asks about a crop that is not grown in that region?"
Illustration (ASCII):
+-------------------+ | EDGE CASES | +-------------------+ | 1. Identify them | | 2. Plan for them | | 3. Handle them | +-------------------+
Mini summary: Edge cases are unusual situations. A good prompt handles them gracefully.
A hallucination is when an AI makes up information that is not true. It is like a dream. The AI is confident, but it is wrong.
Definition: A hallucination is when an AI generates false information.
Why it is important: Hallucinations can cause problems. We need to reduce them.
Simple explanation: Imagine a friend tells you a story. You believe them. But later, you find out they made up part of the story. That is a hallucination.
Real-life example: An AI says "The capital of Nigeria is Lagos." That is a hallucination.
School example: An AI says "Water boils at 200 degrees Celsius." That is a hallucination.
Home example: An AI says "To clean a stain, use bleach on silk." That is a hallucination (bleach ruins silk).
Nigerian example: An AI says "The best time to plant yams is in December." That might be wrong.
Illustration (ASCII):
+-------------------+ | HALLUCINATIONS | +-------------------+ | AI says something | | that is not true | | Need to reduce | | them | +-------------------+
Mini summary: Hallucinations are false information from AI. We need to reduce them through better prompts.
| Word | Simple Definition |
|---|---|
| Prompt | The input you give to an AI. |
| Chain-of-Thought | Asking the AI to think step-by-step. |
| Tree-of-Thought | Exploring multiple options before choosing. |
| Dynamic Prompt | A prompt with placeholders (variables). |
| Context Injection | Adding background information to a prompt. |
| Optimization | Improving a prompt through testing. |
| Evaluation | Checking the quality of a prompt. |
| Edge Case | An unusual or unexpected situation. |
| Hallucination | When AI makes up false information. |
| Structured Output | Organized output like JSON or tables. |
+----------+ +----------+ +----------+ +----------+ | WRITE |----->| TEST |----->| EVALUATE |----->| IMPROVE | | PROMPT | | IT | | IT | | IT | +----------+ +----------+ +----------+ +----------+
+-------------------+
| Step 1: Think |
+-------------------+
|
v
+-------------------+
| Step 2: Plan |
+-------------------+
|
v
+-------------------+
| Step 3: Execute |
+-------------------+
|
v
+-------------------+
| Step 4: Review |
+-------------------+
| Feature | Simple Prompt | Advanced Prompt |
|---|---|---|
| Length | Short | Longer |
| Specificity | General | Detailed |
| Context | Little or none | Yes |
| Structure | Freeform | Step-by-step |
| Result | Often vague | Often accurate |
Congratulations! You have completed Module 3 of "AI and Automation Level Two." Let us review what we covered.
You are now ready for Module 4. In the next module, we will dive into AI Agents. We will learn what agents are, how they work, and how to build them. Get ready for some exciting challenges!
Match the word on the left with its correct definition on the right.
| Word | Definition |
|---|---|
| 1. Prompt | A. Asking the AI to think step-by-step. |
| 2. Chain-of-Thought | B. The input you give to an AI. |
| 3. Tree-of-Thought | C. Adding background information. |
| 4. Context Injection | D. Exploring multiple options. |
| 5. Hallucination | E. When AI makes up false information. |
Answers: 1-B, 2-A, 3-D, 4-C, 5-E
Activity: In groups of 3-4, choose a task and write three different prompts: a simple one, a Chain-of-Thought one, and a Tree-of-Thought one. Test each prompt and compare the results. Present your findings to the class.
Activity: Write a detailed prompt for a task of your choice. Use all the techniques you learned: Chain-of-Thought, Tree-of-Thought, context injection, and dynamic variables. Test your prompt and write a report on the results.
Project: Build a prompt testing system. Create a set of prompts and a way to evaluate them. Test your prompts on different AI models and analyze the results.
Assignment: Research a real-world application of prompt engineering. Write a report on how prompts are used, what techniques are applied, and what results are achieved.
In Module 4, we will dive into AI Agents. We will learn what agents are, how they work, and how to build them. To prepare, think about a task you would like an AI agent to do for you. It could be research, planning, or even creative work.
See you in Module 4!
Note: This is the end of Module 3. You are now ready for Module 4, where we will dive into AI agents. Keep your curiosity alive!