5 Prompt Writing Tips for OpenAI's ChatGPT

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
can open ai's chat GPT help you learn python if you're a beginner the answer is yes but if you want to learn more intermediate or Advanced features you're going to encounter some problems by the way it's almost Easter and we have these little chocolate eggs in the Netherlands I mean you sure have them as well I mean they're like horrible I mean I absolutely can't restrain myself it's like well through eat chocolate Easter eggs I don't know if you know that feeling you are my Nemesis anyway today I'm going to take a look at a relatively new field called prompt engineering and give you five tips to help you use AI tools like judg more effectively once an API is built an awesome software application for you you need to host it somewhere there's no AI for that yet but fortunately there are companies like hostinger who solve this really nicely and they're also the sponsor of this video if you need a website or if you want to host your python backend hostinger makes this really easy you can choose from shared cloud and VPS hosting plans in particular cloud and VPS are a great option for hosting your app and launching it online each Cloud hosting plan includes 300 websites SSD storage free domain backups email really great website builder and a very complete WordPress hosting solution if use the VPS you get full root access a dedicated IP address and much more really everything you need and you can get a VPS plan starting at only 3.99 per month and if you use the discount code iron codes you're going to get an additional 10 off setting up with Cloud hosting plan is really easy obviously you've logged in Just click Start now select whether you want a new website or migrate your website so I'm going to select creating a new website and then you can choose between what you want so hosting or Builder or whether you want to run on WordPress so I'm going to Simply select the host Builder now and then you can attach your domain I'll just use a temporary domain for the time being because I'm already have enough domains now we can create the website and since this is an AI focused video let's use the AI website builder and see what happens so my brand name is obviously iron codes my website type is YouTube content creator so let's pick YouTube site and business description I hope software Developers become better at software design and now we're going to create a new website based on this information and this is what it looks like setting up a VPS also really easy after you've selected your VPS plan and logged in you can simply click Start now and then pick your location so I'm of course based in the Netherlands so I want the Dutch server click continue and now I can choose the operating system so you can have either a plain Os or you can select an operating system with control panel and they also have a game specific version so I'm going to use the control panel version and this is built with Centos and then I simply select the default panel I'll set a password now for the control panel we can give the server a name so let's call that iron buff codes and we can also set a secure root password there we go and save and continue that all looks good so now I'm just going to finish the setup they offer 24 7 support so you'll never feel lost over 1.5 website owners trust hosting her and with a 30-day money-back guarantee you can try it risk-free click the link in the description to get started now let's go back to the video what's really important if you use tools like chat GPT or other AI chatting tools is that you think about how you phrase your questions and what is the sequence in which you ask the questions how precise are you going to be Etc so there's a pretty new field called prompt engineering that focuses on ways to formulate your questions correctly so you get the most out of it I do find that a lot of these bronze engineering techniques work well when you're dealing with code but they're also for a big part focused on editing texts so when you're dealing with code there are some limitations that you should know about another also talk about in this video but what I want to do today is show basically five tips five techniques that help you get more out of tools like chat GPT so the first step is to make sure that you're clear about the context what do I mean by that well you have to indicate the context of the question so what kind of programming language do you want the chatbot to use is it supposed to be an exercise is it supposed to be an explanation who's it for and so on and so on so for example here I have chat chip the window open so let's say I want to ask it about an algorithm to validate an email address so I can do write a function validates an email address string like so so see it now created a python function I didn't indicate that it's reduced python probably it detected that I'm a python Guru so that's why it made it in Python but if you want something else then of course you're going to have to indicate that and another thing is that it's assuming that I know what's a function that I know what's a regular expression etc etc also if you look at the code honestly it's a bit crappy like I mean here this is already a Boolean value so why do we have to use an if else statement we just return this as Boolean it's much simpler also it's not using a main function there are no type hints so I would certainly not approve this code as being high quality python code but we can ask chatgpt to provide a different context for example do the same but use typescript instead so now you see we'll get a new version of the code but now the context is different because we're asking for a typescript example also since it's typescript there are now type annotations which I must prefer the default context that chatgpt uses here is explain things but maybe you want to change that so that it actually proposes you an exercise so let's ask it to write an exercise instead and see what that looks like foreign being really specific I want to write an exercise Techni step by step so I don't just want to ask the question and I want it to be a function it needs to validate email addresses and it needs to be in Python and see what it comes up with so here's the exercise that it generated so the steps are actually pretty straightforward it makes a lot of sense and I think this is a really good exercise for let's say a beginner programmer that wants to Learn Python how to write functions and so on and so on but let's say we want to condense the exercise a bit and aim it more towards intermediate or Advanced programmers we can actually ask the activity to do that for us so it's pretty clear Chi GPT actually thinks that refining the regex pattern is one of the key things that the senior developer wants to do so it wants us to generate a pattern like this which is completely nuts so chat GPT has now reached the maximum character limit because it wants to create this really ridiculously long regular expression type I was hoping it would condense the steps a bit more in fewer steps which would make more sense for a senior developer let's go the other way around okay so this is interesting already the first step is different in that it wants you to install python it's assuming you don't have python installed which makes a lot of sense and the steps as they are being generated here also look like they're being more basic so it wants us to open the text editor or IDE so that's of course more suitable to how beginner would do it as you can see it also explains things more so it says that if it takes an email address as an input it indicates that this is called an argument and it explains things like to pass keyword also instead of letting you come up with the regex pattern it really provides the code directly and instructs you to type the following code inside the function so the level of the exercise is clearly different so as you can see the context here is really important is for beginners is it for advanced programmers is it a explanation should be an exercise and so on context the second tip is that you can use synonyms in order to get different or in some cases better answers for example you could use related terms like single responsibility or cohesion which kind of relate to the same thing to get different kinds of answers so here's an example of what I mean so I've asked that GPT for a function with low cohesion so it gives me example calculate employees salary that does a ton of different things so that's a pretty clear explanation of what low cohesion is but we can also formulate it using the single responsibility principle so now you see it actually gives a completely different example so here it's about processing the order it also details the steps which is quite similar to what it did in the low cohesion version but then it actually also provides some details of okay how can you refactor this so in this case I think phrasing the question using single responsibility principle is more useful than phrasing it with low cohesion so use these synonyms then and try different things to figure out which gives you the best result by the way if you're enjoying this video so far give it a like the next tip is that you can give chat GPT an indication of how you want the answer to be formatted so for example I'm going to ask it a question of what the structure of a database is for a particular application foreign asking it for a database structure of an application that's a sort of quiz editor and see what it comes up with so it defines users so that the user ID username it gives some SQL types which is quite useful and it presents this in bullet points that's quizzes that belong to a user and each quiz has questions so the structure actually makes a lot of sense so it suggests also use Six Tables users quizzes questions so quiz ask questions choices we have quiz attempts and per quiz attempts we have the user answers so well you know this could work sort of but we didn't give chat deepti any indication of how to provide the information to us and this is maybe not the ideal way of representing this information because it's kind of hard to get the overview so we can also get more explicit about how we want the information to be presented to us for example we could do this so unfortunately it looks like it's not able to generate visual diagrams let's try something else foreign generate a mermaid diagram let's try something else so depending on the way that you ask the question and what you ask it to provide you as a result you're going to get a different type of answer so here actually attempts in Ruby which is interesting uh sort of textual representation of how these things are connected another example of indicating how you want to receive the answers by being more specific about the types of things you want chat repeats include for example the feldet credit card function doesn't have any type hints so I can simply ask it to do that [Applause] you see it now has added type hints for the argument and for the return value another tip is that you can chain questions I've already sort of done this in my previous examples but by changing things and by letting chat GT use the context of the previous questions you can actually get better answers as a result for example let's start by asking it to explain data classes to me so this is a pretty open question uh it started by simply explaining the basics of data classes but now of course who can start asking follow-up questions and we can refer to the contacts that it's been using in this case that's a personal class for example we can ask it to expand on the person class by allowing for let's say default values so what I did now is it modified the person class to have a default age of 18. but let's say you want to know a bit more about how data class is working in particular what an option like Frozen actually does so we can ask it a follow-up question so now it basically explains what Frozen is it adds it as an option to the person class and then shows an example of how you use it and when it's going to raise an error and what happens if you try to modify the person's age which obviously doesn't work because it's of type Frozen the final tip and that's especially when you use chat GPT to generate code is that you have to realize the chat GT makes mistakes so you should always check the responses I have an example here that demonstrates this quite nicely I started by asking chat GPT to give me an example of the bridge design pattern in Python so it gives me examples of the bridge design patterns so there's a draw API it has a draw method and then it has shapes so there's a red circle and a green rectangle in this case and then there's a shape class and then we have a circle that's a refined abstraction of the shape class so this looks like it could be a bridge pattern but actually it's not really a bridge pattern with a bridge pattern what you basically have is two separate hierarchies so for example you would have a hierarchy of shapes so we have a shape super class and then we have a circle and a rectangle and other types of shapes and they would have a second hierarchy that is something else for example that could be opengl DirectX metal anything else and these two hierarchies are separate and the bridge pattern makes the connection between these two things on the abstract level so it sort of does that but the example doesn't make a lot of sense so then I tried as a second question hey maybe you should then use a different example maybe we'll get something else I explained it should be two hierarchies one hierarchy of message types and the second hierarchy of message sender services so this makes more sense to me as this is closer to what the bridge pattern is supposed to do so let's see what it comes up with so now you see it has a message sender and then there's SMS and Telegram and then it has an abstraction which is a message type and it has text and email so here again it doesn't really make a lot of sense because why would you send an email to Via SMS so you know it doesn't really make a lot of sense to me so again I give more specific instructions so instead of text messages and email messages use text HTML and markdown so it's more about the formatting so now it starts to make a bit more sense we have the message sender which is the SMS or Telegram and we have the message which has a sender that is either a text message or an HTML message or a markdown message so this definitely makes more sense what it clearly shows though is that in particular with design patterns which are let's say conceptually can be pretty complex it's actually pretty hard for an AI like chat GPT to generate this correctly so you have to really pay attention that it actually explains these patterns correctly and it makes a lot of sense that it doesn't really do this really well because the way that chat GPT works is that it's simply trying to generate text based on the text that's already been generated and what it found on the internet right so when Concepts get more complex the chance of introducing errors in the explanations is also going to go up another problem with this is that you will find way more beginner focused content on the internet than intermediate and advanced content so the quality of the beginner focused content is going to be much better than the intermediate Advanced content so to round off this video here are three things that I think are also issues with chat GPT especially for more intermediate and advanced content so the first is that if you're asking it to do Advanced things less basic things then you're also going to quickly run into limitations of how much text it can actually generate because there's a character limit for example you see that already happening here in the simple explanation of the bridge pattern where it has all these classes but it's not able to complete the code example because it ran out of characters and we also saw that in the email validation function where well because we ask it to rewrite it for senior developers it tried to generate like a huge regular expression string and then well it ran out of characters and too bad it couldn't wasn't able to finish the example so there's a limit to how much text can generate and that might not be enough to handle the complex cases maybe in the future this will be better but currently this is a clear limitation another thing is that there's not really any coherence between the examples maybe it will learn over time but for example things like including type hints or other best practices that you wanted to use it might not really do that for example I now had to explicitly tell it several times to include typing annotations because well most of the Python code that's on the internet doesn't use that yet because it's a pretty new feature so that means if you want to make sure that they're using the best practices well jet GPT might not always provide you with those because it's basically learning from from the past and finally that also has to do with all these prompt engineering tips is that you really have to know how to ask it the right questions because well in the end tools like this are reactive they're not going to do things on their own basically you have to ask it to write things you have to provide it with clear directions of what you want and in that sense it's the same as searching with Google so that means that if you don't know the right keywords or you don't know the right way of phrasing the question you're not going to get the answer that you're looking for and asking questions is a great way to learn but if you don't know the right keywords you might end up in a bubble for example if you don't know the keywords of low cohesion and single responsibility well you might not ask the questions in the right way and then you won't get the answers that you're looking for so in the end tools like chat GPT are really useful but you have to always be aware of the limitations and I think we're pretty far away from it actually being a complete replacement of senior developers and we all those are jobs etc etc I don't think that's going to happen anytime soon and that's mainly due to how this generative AI models are really working on the hood so I'm quite sure that in the coming years this is going to improve a lot I'm really curious to see where this is headed but this is definitely something for you to be aware of so hope you enjoyed this video if you want a little bit more about how to become better at Python and get some suggestions some ideas for fun projects to dive into check out this video next thanks for watching and take care
Info
Channel: ArjanCodes
Views: 28,139
Rating: undefined out of 5
Keywords: openai, chatgpt, chat gpt, chat gtp, chatgtp, chat gpt ai, open ai, artificial intelligence, chatgpt tutorial, chatgpt explained, chatbot tutorial, prompt engineering, prompt engineering chatgpt, prompt engineering gpt 3, prompt engineering tutorial, prompt engineering ai, generative ai, chat gpt explained, chatgpt examples, how to use chatgpt, chatgpt coding, chatgpt prompt engineering, python chatgpt, python chatbot project, python chatbot tutorial, python chat gpt 3
Id: JR9AfwywGEc
Channel Id: undefined
Length: 19min 53sec (1193 seconds)
Published: Fri Apr 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.