Few shot prompting

Reza Zeraat · Intermediate ·🧠 Large Language Models ·3mo ago

About this lesson

#llm #promptengineering

Full Transcript

Hi everyone. In this video we are going to learn about prompt engineering and how to use it and test and understand what is the best way to have this uh skill and uh apply it in our environment. Let me share a screen. Where is the Yeah, found it. Okay. Um Uh first of all uh prompt engineering is a very advanced uh topic. And nowadays, if you don't know anything about it, you cannot use AI or utilize all its feature. The first rule that we need to know is that we need to be specific in the prompt. We need to provide all of the information needed for the AI to understand the topic, understand the question, and understand the context of it, then it can create a very good result. For example, here write about dogs will give you a very very generic response. The response that nobody is interested in and not useful. But if you give it for example 150 word like intro and blah blah blah you will get a uh very very specific answer uh and uh accurate response. And to be honest, LLMs at the moment are not AGI or anything. They are instruction following machines. Think of it like robots that they need uh direction. If you don't give them the uh specific rules or contacts that they need to accomplish a task, they will never achieve anything. The anatomy of a Garrett prompt is like this. You uh have to have five components for better results. First is role. What is the role of AI? AI will transform itself like in the Transformers movies to a new uh actor like in uh human that acts different roles in one movie or in different movies if the if the conversations are different. First is the role which I explained. Second is the contact. For example, where is the uh I want to have a product, but if you don't say that I want an MVP, I don't want a full product, it will goes and do whatever it wants and maybe it will go and uh spend hours and hours and don't give you what you want. Don't give you the result or the product that you need for the launch. The third one is a task. You need to give exactly what you need to be in the output. For example, structure JSONs. I want 200 words at in the in the beginning of the LLM era, it was very difficult for them to uh behave like uh the task is uh trans- described. But that now they they are doing very well in this components. The format which I explained, you you want to have JSON fields or you want to have uh a text or you want to whatever you want. It depends on what you want and they will structure their output. And you should be able to define con- constraints for them. For example, don't uh For example, want chatbot, uh don't give the chatbot the ability to predict in the stock market because it because there the there is no responsibility for it and if the predict uh result in losing money, nobody is to save the investor or trader. And remember, you don't need to have five components for it, but it's better to uh have at least one or two of them. This is a prompt template. Think it like a template including like a blog template. You have a blog title, description, the article content and footer and uh blah blah blah, but in here you have the same thing. You have the role, context, task, and format, and constraints. This is the five golden uh rules that you you need to have to have a uh beautiful template to have a beautiful answer. Five essential techniques that we need to know. We need to first be a specific, which I have already explained. You need to provide examples. Uh for example, you want to have a response that is a blog post. You need to give it an example of a blog post. If If you say it, "Please generate a blog post for me," it will go and do whatever it wants. It will not follow your uh UI pattern. You need to define the the exact uh the exact structure of the response for it. It is not enough even an instruction instruction JSON because it will thinks uh a key in for different rules. So, you need to give provide a a real-world examples. Chain of thoughts is for when you want to uh solve mathematical uh problems. You are not just satisfied with generating content and uh something that is beautiful. You want to utilize in real world. You want to it to solve uh questions, solve problem, code, and blah blah blah. So, you need to have a uh you need to specify that thing step by step so it can fix its outputs. It can test it it you when we go to a genetic AI, we will understand how how important is the thing step by step because it will give the ability to time to uh curate its response. The output format, which is very very important. Generally, models wants to generate text, but it's better to train them to have JSON, markdown, bullet point, and all that for different tasks. And iterate uh and refine. Remember, as an AI engineer or prompt engineer, uh you need to iterate. You shouldn't be satisfied with just one or two prompts. You need to iterate again, or you can change the model from Gemini to Claude to finally get the result that you want. Remember, all the models are good at something. They are not good at everything. For example, Gemini model 3 Gemini 3 Pro model right now is the best model in scientific. If you want to have an agent which is going to solve scientific problems, we need to use that. We need to test it. Test it for different problems. You will see that how good is it. It depends on the topic. For example, for coding, we need to uh use Claude code because Claude code is very good at software bench uh uh benchmark or exam, and it it is outperforming all of the model they have they have in the competition. Now, let's see on one example. Uh you need to give example. Example, convert product descriptions to tweets. Like you want to have a tweet for your product. So, but the model don't know how to tweet it, how to write better best text for it. Uh so, you will give an example for example, this is a product description and this is a tweet. And when you give the model, please do it for it do it this way, it will tra- transform it transforms to the tone that you need. And the main reason that it works is because you have given it example. It is uh providing uh it is generating even emojis that you want. If you don't give this example, it will do whatever it wants. Um maybe it is not uh useful for you or uh is not what you want and that's not good. So, common mistakes that m- many people uh have when they talk with AI, first they are very vague, you they want to have multiple tasks for a simple prompt, which is nothing which is not good. You if you want to generate an email content, you shouldn't ask for uh buying the restaurant after it. That's not how it works. Unless you have an agent which will uh div- which will the divide the prompt to two tasks and then first uh implement the first one, second uh im- implement the second one. And that that is another thing that we need to cover, we need to understand, but in this topic when you have an API call, you have a prompt, you only have to follow one task. Understand? That's it. This is what we are. We are not talking about chatbots like ChatGPT because they maybe they have built-in agents inside it. We are talking about we are an AI engineer. We have an API key and we want to use it for solving business problems. We are not going to use other people's products. We want to create our own by the use of the model that have been trained on massive amount of data. And the third one is the no context. You need to provide exactly what you want in which country. For example, I want to buy I want to buy a car. You shouldn't just ask I want to buy a car. You need to say which country you're located, which price range, which how many seats do you want. This will give the model all of the necessary information to very so it can generate the response that you want. And remember, AI is not mind reading. It cannot understand what you want if you don't tell it. Think it like a human. You communicate with a human, you need to be a specific clear. If you talk vague, you you will never have a very good team with the team member. And if the first response that the model is not useful or is not what you want, you shouldn't give up. You should advance at console at more component or maybe change the model. You the the AI at the at this stage is very smart. You smart than smarter than most of the humans on the planet. But it only works if you know how it works. If you follow the this domain, follow the AI rules. If you want to do whatever you want, that's that's a prescription to failure. It's not something that is useful. So, in this video, we learned about prompt and instruction. We use We understand uh the components of the prompt. We know what rule to follow, and we shouldn't give up uh on first attempt. The next video will be more specific. We will go See, this video is not something that you that will guide you to become a that will give you enough information to become a prompt ninja. We will go step by step. Next video, I will explain how to uh dodge uh complex style multi-turn conversation and all that. Thank you so much for watching the video. See you in the next one.

Original Description

#llm #promptengineering
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related Reads

📰
The Token Ledger Digest – 2026-07-19
Learn about the latest price reductions for MoonshotAI's Kimi models and how they can impact your large-scale code or reasoning workloads
Dev.to AI
📰
A Developer's Quick-Start Guide to Claude AI
Get started with Claude AI quickly using a developer's setup checklist and learn how to harness its features
Dev.to AI
📰
GPT-5.6 closes a 30-year gap in convex optimization. https://old.reddit.com/r/math/comments/1uxj3cy/after_openais_cdc_proof_anno
GPT-5.6 achieves a breakthrough in convex optimization, closing a 30-year gap, and its implications are significant for AI and math communities
Dev.to AI
📰
Full-Text Search Artık Yeterli Olmadığında: Vektörler, LLM’ler ve Hybrid Search
Learn how to improve search results using vectors, LLMs, and hybrid search for more accurate and relevant outcomes
Medium · LLM
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →