Go back

Prompt engineering with ChatGPT. Writing expert prompts for non-English speakers. Sommelier and OSHA | Artificial Intelligence Masterclass

38m 52s

Prompt engineering with ChatGPT. Writing expert prompts for non-English speakers. Sommelier and OSHA | Artificial Intelligence Masterclass

This video addresses prompt engineering for non-native English speakers, emphasizing that AI models like GPT-3 respond best to direct, imperative commands, contrasting with indirect communication styles common in some cultures. The presenter advises using ChatGPT to translate intent into clear English and demonstrates iterative prompt crafting through examples. One example involves creating a prompt for writing evocative wine descriptions, where refinement includes adding variables for tone and audience, simplifying language, and testing outputs. Another example focuses on generating OSHA regulation citations from employee complaints, highlighting the need to specify that only regulations—not procedural steps—should be listed. Throughout, key techniques are shown: priming the model with context, using placeholders, iterating based on feedback, and asking the model to recap its understanding to correct errors. The core message is that simplicity, clarity, and directness lead to more effective prompts, with testing being essential to achieve desired results.

Transcription

2976 Words, 16158 Characters

English
Hey everybody, David Shapiro here with a more conventional video. So on my Patreon and throughout all of my time on YouTube, one of the questions that I get the most is with prompt engineering. And one thing that I've noticed is that many folks are working on prompt engineering. In some cases, English is not their first language. And so this video is going to be primarily for people for whom English is not your first language. And so for instance, in some cultures, you're more likely to use the passive voice. So this is particularly for folks from India and Japan where you kind of insinuate what you need. And the reason is because in these cultures, it's considered impolite or rude to be direct. But that being said, these models, and these models, I mean GPT-3 and chat GPT, they're trained with a Western mindset. And so what I mean by that is that they respond to imperatives, to commands. And if you're a Spanish speaker, mandatos. So that's actually where I originally kind of learned that concept is like, oh, it's a command word, or an imperative sentence or that sort of thing. So what I have started telling people, if you're not a native English speaker, use chat GPT to get the intent across and to write it in good English. But you need to understand that imperative. So you say, write instructions, not like the chatbot should write this blah, blah, blah, you got to be direct. So I got a couple of examples. And so these are inspired by questions that I've actually gotten. So in one, write product reviews for some wine given some basic facts. So let's ask chat GPT. Are you familiar with prompt engineering? And so what I'm doing here is I am priming this conversation so that chat GPT knows what it is that we're doing. So it's like, okay, I understand the concept of prompt engineering. So we're working on cool. And so that's it. I just needed that information in the context window so that that way it knows what we're about to do. Cool. Help me write a DaVinci prompt for writing wine descriptions for an online store. My database has a few fields such as year, location, type of wine, flavor, profile, bouquet, I think I spelled that right, and so on. We need a prompt that will write incredibly vivid descriptions for each wine. They should be flowery or romantic or even sultry in some cases where appropriate. For instance, imagine that the description is written by a professional French sommelier. Okay. Can you take a crack at that prompt? So what we do is for iterative purposes because you have no idea what it's going to do. There we go. There we go. So this is actually off to a great start. So all I did was I described the prompt and so let me unpack what I did here. So I said write a DaVinci prompt for me. I'm assuming that chat GPT knows what DaVinci is. I don't know if it does, but it's being constantly updated. So who knows. It does say OpenAI DaVinci, so it did connect that DaVinci is from OpenAI. Okay, cool. So chat GPT knows how to write prompts. All right. So as of professional French sommelier, write a captivating, ooh, I like that. Captivating description of a year type of wine from location. So these are the placeholders with flavor profile and bouquet. Transport the reader to the vineyard and let them savor every sip. Oh, that is good. So then as this, that and the other. Okay, so it gave this as, okay, so this is basically going to be a few shot. Right? So we're saying here's an example. Yep. So we need to fill in the blanks for this for the few shot. Okay. So let me slow down because I know that I'm going really fast. So what it did was it produced, here's the prompt, right? And then here is an example of how it would look, right? And so we'll need to do a little bit of formatting. And this is basically like, so I'm going to tell it, let's use this as a few shot example. So we can get exactly the behavior that we want. This tantalizing creation as a, as a professional French sommelier, I invite you to do blah, blah, blah. Okay, so what's wrong with this? We don't want it to say as a professional French sommelier. This is a good start, but we don't want the response to open with as a professional French sommelier. The user will probably not care. Instead, let's write the prompt in such a way that it uses, uses kind of a third perspective. So for instance, it will reply or it will say this bottle will transport you. Make sense? Can you try a slightly modified version of this prompt? Sure, here's a modified version. Okay, now it's getting confused. So now that's not what I was looking for. No, that's not what I was looking for. Let's start over. Let's just write the prompt. This adopt a new format where the opening prompt is labeled as prompt in your response. And then the completion is also labeled with all caps. So the prompt should include the persona of a sommelier, but the most important thing is to write the vivid description of the wine based upon the input variables. Try again, please. There we go. All right, so it says write a captivating wine description from the perspective of a French sommelier for a year, blah, blah, blah. Okay, cool. Yeah. This is pretty simple. So one thing I will say is that less is often more. So you see how this prompt got shorter and shorter? We should actually try this. So it may work. Can you fill in the variables for me so I can try it? And then what we're going to do from Napa Valley with a buttery flavor profile that hints of vanilla and oak. Okay, cool. So what we're going to do is we're going to actually take this platform and we're going to write the description. So we're going to actually see what it does. Now lately I turn the temperature down to zero because I want to see what the model produces without any variance. Let's see, 250. That's probably enough. It's a truly explicit wine, blah, blah, blah, blah. Okay. So now what I can do is I can take this output and say I liked this output, but I was hoping it would be a little bit more. So this output is good, but I'd like for it to be a little bit longer. Okay. Great. I tried it and got the following output. So this is really great, but I'd like to add. a bit about when and where this wine would be good. Please update, modify, expand the prompt so that it will include stuff like food, parings, but also really engage the user's, not user, the wine buyer. There's imagination. They need to know exactly how they're going to use this wine, going to use this wine. Alright, so now please write a new prompt with this in mind. The last one was pretty good. Okay, cool. Excellent. I just hate escape because I don't need it. Chat GPT is hallucinating what the output might be. That's fine because it gives you an idea, but then you need to test it. Great. Can you fill in the blanks, fill in the variables of that last prompt so I can test? Excuse me. Okay, so then we'll grab this and come back over here. Okay, so describe how this wine can be enjoyed, what dishes it pairs well with, and how it will enhance the overall dining experience. It's a truly captivating wine. It's fruity flavor is balanced by floral bouquet, making it delightful complex experience on the palate. You'll find notes of ripe cherries, raspberries, and hints of spice. Cool. I don't know if it's lying, but okay. Peanut and Warp hair is wonderfully with a variety of dishes from light salads to heartier fare. It's fruity notes make it a great companion accompaniment, sorry, to grilled salmon or roasted chicken. There you go. Experience. Sure to enhance any dining experience. It's complexity and balance make it a great choice for any occasion. Cool. So I was at the grocery store with my fiance, and there was a brand of wine that was like, it was very sultry. It was like the delicate velvet on your lips is so sure to basically turn you on. So what we want to do now is we want to add one final variable so that whoever's writing this can add a tone. Great. That worked really well. Let's add one last variable to the prompt. I want my users, wine sellers, to be able to specify a tone. So for instance, some shoppers are going to be very haughty and serious about their wine. So we need to create a variable that will allow for that. But some wine brands are going to be to be sillier or basically just aator to different audiences. So can you modify the prompt one last time to include a target audience tone kind of thing? I'm not sure the best way to modify the prompt. Okay, let's see what it does. So chat GPD is pretty smart. Tailored for a specific. no. Let's see. That's not what I was looking for. No, that's not good. You removed the bit about food parings and such. Bring that back. So let's see. So bring that back. Just modify this following prompt by adding a new tone variable or something like that. All right. I apologize for the confusion. I'm going to add a very recalcitrant. Is that the word? Contrite. Contrition. Okay. Right-e captivating, review, blah, blah, blah. Tailored the tone for a specific audience. No, you're not using the tone. You did not add a tone variable. You just rambled off the list of tones I suggested so it might sound like I'm being really rude to the machine right now. There we go. So now we've got this. All right. So let's add this to our prompt. Tailored the tone of the description to a specific audience by using the variable. that's. really? Well, let's see if it works. Let's see if it works. I might be jumping to conclusions. So we'll say something like target audience tone is going to be. let's see. Young 20-something women. Okay. Cool. As. no. That didn't work. You don't advertise to young 20-something women by saying you're a young 20-something woman. Yeah, that didn't work. That's kind of funny. All right. So let's use more adjectives. Because in this case it's like the model is like very. Let's do. let's do fun and silly. It's a fun and silly one. No. It's super not what I want. All right. Okay. I tried this and it is an unmitigated disaster. Prompt. Completion. What do you think is wrong with this prompt? Got any ideas how to fix it? Okay. Why don't we try changing the line? This seems off. Can we simplify this part of the prompt? Remove the variable again. And then it's a Taylor the Town. Okay. The best fits your brand. All right. Let's see. It's clear that you are lost. Remember that a prompt is static. So including a description or a line in the prompt like does not make any sense. And you try something completely different. There we go. Taylor the tone for the description of your target audiences like now. Now you're completely lost. Okay. This is getting aggravating actually. Okay. Because what I'm trying to do is I'm trying to show you how to get chat GBT to do this. But chat GBT is obviously. not getting it. So remember, simpler is better. Stop with the ludicrously long prompt. Just use a simple tone variable, please. Okay, it doesn't get it. It really, really doesn't get it. All right, so here's how I would do it. And I apologize, but I hope we found a limit. Tone of the description, fun and silly. There we go. This is what I was trying to get it to do when I was like, simpler is better. So then we say, so then we say like, let's see, let's see, luxurious and sensual. This is for the snooty or clients. Just said, it's a luxurious and sensual experience. Okay, whatever. It's not perfect, but you can see we made some progress. All right, so let's move on to a different prompt altogether. So OSHA, this is actually one that I've gotten several questions about over the years. And it's about like regulations and stuff. So let's delete this. Let's see, help me write a Vinci GPT-3 prompt for citing OSHA regulations given an employee complaint. Can you take a crack at this label the prompt with prompt and completion with completion? All right, you're an HR representative for a manufacturing company and employee has filed a complaint. Okay, no. All right, good start, but we need a placeholder in the prompt for the employee complaint. The employee complaint should not be in line with the description. Think of it more like a form. The complaint may be a sentence or a whole paragraph. So create some additional framing for it. Now, I don't like that. Use new lines to frame the complaint better. Remember, write it more like a form. There we go. Okay, cool. Great. Now, let's imagine an employee complaint for testing. Can you imagine an employee complaint, let's say realistic, realistic employee complaint on a warehouse floor involving a forklift? No, don't include the prompt. Just write the complaint only. On several occasions, I've witnessed forklift after a driving at excessive speeds such as honking the horn before not following. Okay, cool. Cool. Now, let's rewrite this with broken English. Imagine that the employee is not a native English speaker. So we're basically going to write this prompt to see if it is resilient and not follow safety. Cool. This is dangerous for me. Please do something to fix now. Now, to fix. Thank you. Cool. Great. So let's try this. All right. You are an HR representative. Let's come back over here. Employee complaint. Let's grab the complaint. My brother and I lived at an apartment like 15 years ago. Maybe not that long ago. But the neighborhood handyman actually wrote like this. He was a very helpful, very sweet guy, but just did not have a good command of English. And you imagine that many people who work dangerous jobs are not native English speakers. Okay. So, let's oh show response. Let's see what it says. Okay. All right. Cool. I tested the prompt and complaint, but it did not cite any specific OSHA regulations. It just gave me a generic list of steps. This prompt is meant to give internal HR a list of regulations to look up for reference. Can you modify the prompt to list only OSHA regulations? Okay. It's still saying and outline the steps that we're going to take, but I don't think that that's what we want it to do. So let's grab this. Let's see. And it just paraded this back at me. Yep. No, we don't want to give the response to the employee. So remove the bit about steps will take. Remember, the entire point of this is just to list OSHA regulations. Please rewrite the entire prompt from the beginning. Actually, here, here's what we're going to do. This is another advanced technique, which is you ask it to summarize everything that we're doing so far. Can you recap and summarize everything we're doing? Not quite. Take a big step back. What are we doing here? Zoom out. We are creating a prompt and an employee complaint for an HR representative at a man and a veteran company involving unsafe working conditions, blah, blah, blah. Yep. Good. Good. Good. Okay. Now describe the goal of the prompt. Wrong. We are not replying to the employee. We are only generating OSHA citations for HR to investigate. So regulations. Can you restate the purpose of the prompt now? And so when you do this, when you ask it, like, wait, tell me what you're thinking, then you can see the misunderstanding. There we go. Great. Now, please write a brand new prompt that accepts the complaint and sites regulations. Stop with the steps that the company will take. We are not doing that. That is not even the same prompt. No. There we go. Let's see if this works. And then whoops. Instead of OSHA response, I probably need to say OSHA regulations. Whoa, I wonder if these are right. Probably not. Howard industrial trucks. I'll be darned. Oh, cool. Let's see. We're looking for 178. Oh. Loading. I'll be darned. So now let's try this. Let's remove this. And see if it still knows. It'll be darned. Okay. So even when I removed it, it still knows the regulations. I think we can call this a victory. Damn. I'm actually impressed. Okay. Yeah, because one thing that a lot of people mistake is that the model already knows a lot. So you need to see if the model already has that information. And this video is getting long. We're already at 30 minutes. So I think we'll call it a day. We'll maybe do chatbot prompting in the future. But I hope you found this valuable. Thanks for watching.

Podcast Summary

Key Points:

  1. Prompt engineering for AI models like GPT-3 and ChatGPT requires direct, imperative commands, as they are trained with a Western communication style.
  2. Non-native English speakers, especially from cultures that use indirect or passive language, should use ChatGPT to refine their prompts into clear, direct English.
  3. Effective prompt crafting involves iterative refinement
  4. Techniques include priming the model with context, using placeholders for variables, specifying tone or audience, and asking the model to summarize or clarify its understanding to correct misunderstandings.
  5. The video demonstrates creating prompts for specific tasks, such as writing vivid wine descriptions and generating OSHA regulation citations from employee complaints, highlighting the importance of clarity and testing.

Summary:

This video addresses prompt engineering for non-native English speakers, emphasizing that AI models like GPT-3 respond best to direct, imperative commands, contrasting with indirect communication styles common in some cultures. The presenter advises using ChatGPT to translate intent into clear English and demonstrates iterative prompt crafting through examples. One example involves creating a prompt for writing evocative wine descriptions, where refinement includes adding variables for tone and audience, simplifying language, and testing outputs.

Another example focuses on generating OSHA regulation citations from employee complaints, highlighting the need to specify that only regulations—not procedural steps—should be listed. Throughout, key techniques are shown: priming the model with context, using placeholders, iterating based on feedback, and asking the model to recap its understanding to correct errors. The core message is that simplicity, clarity, and directness lead to more effective prompts, with testing being essential to achieve desired results.

FAQs

Use ChatGPT to help translate your intent into clear, direct English, as models like GPT-3 respond best to imperative commands rather than indirect language.

Be direct and use imperative sentences, as AI models are trained on Western data that favors commands over passive or indirect phrasing.

Start with a detailed prompt, then iteratively simplify and adjust it based on the model's responses, focusing on clarity and specific variables like tone or audience.

Ask the model to summarize or restate the goal to identify misunderstandings, then rewrite the prompt more simply, avoiding overly complex instructions.

Provide a clear prompt with placeholders for variables (e.g., year, location, tone), and use few-shot examples to guide the model toward the desired format and style.

Frame the prompt as a form with specific inputs, and explicitly state the goal (e.g., listing only OSHA regulations) to avoid generic or off-topic responses.

Chat with AI

Loading...

Pro features

Go deeper with this episode

Unlock creator-grade tools that turn any transcript into show notes and subtitle files.