ChatGPT tutorial for Java programmers - Using OpenAI API

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's get into chat's GPT now and if you have  been active in check Twitter Youtube or online   you've probably heard of chat GPT now on let's  separate the chat from the GPT now GPT is a type   of artificial intelligence model that open AI  developed we have also seen logos of open AI   it's actually a research laboratory based in San  Francisco California now, Chat GPT is a variant of   GPT that's designed explicitly for conversational  texts now I will go through a few questions you   can ask chart GPT then I'll show a good example  of how to access the open AI API using Java here is a simple quick question   that is based on is Java a good language to learn  I'll get the shots answer which is pretty fancy   but this is just a simple question let's go to  more advanced questions now we have a question   where the answer requires called samples for  example like in the case of java 11 HTTP clients   it actually gives code samples to you know support  its response now let's even be more specific we   can go and be more specific about the type of code  we want for example let's say we want a spring   rest API that greets a person with a name a very  simple rest API it tells you the requirements and   dependencies explains the code it tells you how to  actually test the API and what response to expect   that is pretty lovely and organized now  this is a more specialized response than   the other questions I have asked but  that's only parts we can go even deeper take a look at this code fellow Java  devs do you notice anything wrong with it   there are few issues here but can you  detect them of course I know you can   now this is just a simple example but let's test  the chat GPT I'll copy this code and I'll ask it   to help me check what is wrong with my code my  code is giving me an issue what is wrong with it now you can see that it lists the arrows  in the code and doesn't just do that it   suggests a correct version of what the code  could be now a cool thing about charts GPT   is that it can maintain context and remember  previous conversations that means it can hold a   conversation with you rather than just providing  one-off responses to individual questions   now let me demonstrate that I will continue the  conversation and ask it to provide a code that   prints bonjour instead of hello noun it knows that  we just spoke about a particular code it corrected   it is actually going to edit the code and  make it print bonjour instead of hello   I think that is amazing now into the developer Parts this is where  the men come in now open AI API allows   developers to access and use their machine  learning models in their own applications   using the open AI API is straightforward  you need to sign up for an API key   choose the model you want to use and make a  request to the API with your input data now   the API will return the model output which you can  use in your application I know I've been I have   been saying model and model so what is a Model  A model is a pre-trained machine Learning System   that can perform a specific task for example there  are models designed to translate text from one   language to another or their models capable of  generating realistic images of objects or people   now different models are available through the  open AI API covering many tasks and capabilities   now there are many different models available  through the open AI API and they cover many tasks   and capabilities some examples of models are  language translation we have imaged generation   text generation and more so each module has  a specific ability and suited for a certain   task so you have to be sure of you know what task  you want there are existing libraries that can be   used to work with the API and we're going to  use the Java Library now check your API keys   and if you don't have one you can generate one  because we're going to use it in our Java code   I will share the GitHub link to the library  and you can of course go through the   description is quite straightforward and I  will also share my code that I use in this   lesson now I created a Grado project because  we're going to use some dependencies I'll import   the open AI API Java Library I use retrofits  as well so there are different endpoints as   you can later check in the documentation  for now we will use the edits endpoint   the edits endpoints can be used to edit texts so  you give it some text and an instruction on how   to modify the text don't worry I'll show you an  example now the model we're going to use is the   text DaVinci edits001 yeah that's a long funny  name for a model now the model used here detects   DaVinci is designed to generate text similar to  the given prompt but with some edits for example   you could use the model to generate a text similar  to a given prompt but with some walls replaced or   inserted as I'll demonstrate here the input is  the input text that is supposed to be edited   and then the instruction is the instruction  that tells the model how to edit the prompt   now in our code I have our text which is I  jack I like program in Java how about you so   this is a text that obviously has you know grammar  and spelling mistakes so I want the API to help   me correct it and we will see the response noun  when we run it we see the first response which is hijack I like programming Java how about  you so that's why we that it thinks it can   be corrected but I'll run it again  and see if I find another version and we see the second version I'm Jack I like programming in Java how about  you so I think this second version is acceptable   of course um there are other options you  can use to tweak the potential response to   be more like what you want this is just a simple  example of how to use the API and you can see that   it actually tried I gave it a text that I felt was  faulty and they responded with a correction on the   spelling and grammar so that is chat's GPT for  you you can either just use the chats on the open   AI website for your researches or you can use the  API in your programs for more beautiful operations
Info
Channel: Lemubit Academy
Views: 22,510
Rating: undefined out of 5
Keywords: chatgpt, openai, ai, chat gpt explained, chat gpt for beginners, chat gpt coding, chat gpt for java, chatgpt for java code, chatgpt tutorial
Id: ULaNsHMftVA
Channel Id: undefined
Length: 9min 26sec (566 seconds)
Published: Thu Jan 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.