ChatGPT vs Text Completion - OpenAI API in Unity!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
it has almost been a week that openai released chat gpt's API along with whisper and audio API that we do not need to use text completion to fake a chat GPT example but directly use a message and role structure to send requests and receive answers to our questions which is pretty much the structural chat GPT when you go to the website you can post messages and get replies from the system now we can actually create the same structure using an API directly makes use of GPT 3.5 turbo model which is supposedly much faster cheaper and better than text completion we will also take a look at that but firstly let's go to GitHub and get the URL of the package I already had my Unity um sorry I already had my Unity uh project created I'm going to window package manager clicking on the plus button and pasting the URL to get the unity package I will have the URL of the open air Unity package in the description and you can see the latest version is um 1091 that I updated with certain things now it has a chat GPT and text completion chat packages samples separately let's import both of them and take a look what is going on inside previously there was only chat GPT and Dolly samples Dali 4 image generation chatgpt was actually a text completion API faked to get a chat cpt-like a structured message but now we have GPT as an API ourselves already we do not know to do that but can have a proper message structure I updated the UI a little so if we can actually send messages and get replies in a much better way I'm going to show you just right now and first let's go to the code and take a look at it right now I have a append message function to append the messages actually to the screen using some prefab status for messages from the user and the system I have my prompt access a random stranger in the chat room do not break character don't mention that you are an AI model I have a list of chat messages which is a role plus content and then what we do is the same Loop we send our message we receive it back and append to our message list if you want to know what the message is we can go to open AI documentation in the guides just chat completion uh you can read all the details here now we can actually use chatgpt 3.5 turbo along with chatgpt4 only for plus users we won't be able to cover that at the moment but you can change the model to gpt4 if you uh if you are using plus unlike me and the structure we send is the array of objects which have role and content field roll can be either system user or assistant and the content is the string message that you are sending so this is one of the restrictions of it you make actually make it break character because it is an AI model it's going to act as a user system or assistant in this case users you and it mostly comes back as system or assistant so you won't you may not be able to use this properly for MPC generation which we can debate later let me quickly show you what I made which is the actual uh actually important part so you can say hi and send the message and you you will get a response to it from chat uh completion API how are you doing today is there a specific topic you want to talk yada yada what is your name so this is a stranger in the chat room it needs to have a name and you can call me Leo nice to meet you how about you what is your name how old are you so let's go with the classic questions and waiting for a bit so I can't really say I have an age I'm just a computer program if you'd like to know when I was created in 2012 one so even though I told it not to break character not to mention that it's an AI model it's still because it is a assistant or a system as a responder it's most most of the time it just tells you it just confesses that it is a AI model or it says computer software and using chat GPT chat API more like chat API as a MPC creator probably is not the right way to go unless if you are using gpt4 model and it might probably do better if you are one of the plus users please test then post the results in the comment I would really like to see myself but uh GPT 3.5 turbo is not really good with this and what I want to do is actually load our previous example which privates previous sample project which was replace renamed to text completion chat let's go there and let's open up our code which is which actually do not even have don't break character or don't ever mention you know your AI model prompt in there it just has act as a random stranger in the chat room very plain very basic this is all it has and it had this Q and A text append appendix to annotate that it's a question or answer question and answer this structure goes on so this was how we faked it to be like a messaging system before so it uses the same thing just the interface changed and let's go there and ask the same questions Hi how are you I will send it shorter answer more like a chat room and I will ask what is your name now he is called John how old are you so it's just going on you know where are you based Chicago Illinois so it it appeared it looks more like a random stranger in a chat room so in the chat API it is really easy to uh break and make the AI confess that it is a confess you might have as much as prompt you want you can tell it not to break character never mention that it's an AI software it won't care because it is a system or an assistant it is going to tell you that it is one because probably with the previous prompts or however it is already assigned that role it uses that first so I can ask it what is your name I will just keep asking the same question multiple times to see what it's going to say fellow Denizen of the digital realm you may refer me as Wanderer what is your name repeating the same question door I'll actually just copy this as I mentioned earlier before mesh Wonder so it knows it mentioned that before and just because I repeat it multiple times I apologize if my previous answers were unclear blah blah blah it it's gonna press that it wants to assist you because the role is Right Now assistant by the way it picks it according to your question so you do not really enforce if it's a system or assistant and the fourth time I asked yes it tells me it was created I didn't ask this but it tells me it's an AI language model is created by open AI you know and all these things so it shifts the discussion into being and wants to assist you I'm gonna go back to text completion chat and let's just keep asking uh this version the name of it last time it took four times to break it completely to make it say that it's open AI made by open air so it's Joe Joe keeps giving me regular answers like as if it's hearing it the first time this is one of the bad things for example from the text completion for example it doesn't mention that I told you earlier as I told you before but in this case you can actually improve the prompt you know like make it more human-like that if you keep you can even add in the prompt that if if the questions are repeated let the user know that was repeated before and you reply this way that way so that is also possible but it is never going to almost never going to tell you that it's an AIP and actually uh in the prompt we don't even say don't break the character don't mention that you're an AI model we don't even have that so in conclusion uh chat API of open AI API the creating a chat completion is much better for getting technical answers you know as a system or as an assistant is much better you can use it like an assistant like use check GPT website however if you want to create scenarios if you want to create a MPC brains you know feed them certain story and expect them to act and respond to you according to that story you created it needs to go on in the same context so text completion as if you are writing the new line of that initial text every time makes more sense maybe open AI could add more rows to it later so instead of just having um instead of just having system user or assistant roles we can have more and it would kind of help more with it what text completion is able to do and again it's a preference depending on what kind of applications you are developing if you are working on the sample I made like a MPC AI thing then text completion makes more sense otherwise if you are making a virtual assistant to respond to certain questions in the context uh chat completion makes more sense uh this is pretty much this for this video and in the next one I'm going to show you how to use whisper API using your audio or talk directly to microphone to record your audio and translate it or get transcription of it thank you so much for watching and have a nice day
Info
Channel: Sarge
Views: 5,078
Rating: undefined out of 5
Keywords: openai, chatgpt, ai npc, chat gpt, open ai, game ai, dalle, dall-e, ai art generation, unity open ai, unity ai, unity game ai, stable diffusion, stablediffusion, midjourney, gpt3, gpt4, gpt, madewithunity, made with unity, indiegame, indiedev, indie game, ai game, game npc, chat app, chat gtp, unity package, how to make unity package, how to use openai, how to use gpt, how to use chat gpt, chat gpt in unity, gpt in unity, use gpt in unity, gpt4 in unity, gpt4o, gpt-4o, gpt4-o
Id: jQd7JH0G-us
Channel Id: undefined
Length: 12min 49sec (769 seconds)
Published: Wed Mar 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.