Beginners Guide to GPT4 API & ChatGPT 3.5 Turbo API Tutorial
ฝัง
- เผยแพร่เมื่อ 1 ก.ค. 2024
- Crash Course GPT4 API and ChatGPT 3.5 API for Beginners. Also learn more about Microsoft Azure here: aka.ms/AdrianTwarog
The documentation for the Chat Completion API for GPT-3.5-Turbo and GPT4 are identical, so this video should serve as a way to implement new Chat API into your next product!
Learn more about OpenAI and GPT4 and GPT 3.5 Turbo below
openai.com/
I cover how to use the latest GPT3.5 Turbo API (which is also the same Chat API that OpenAI uses for GPT4). If you're looking to use OpenAI API this video should cover the whole process. In it, we will integrate Open AI API for GPT and add it to a simple application to interact with the artificial intelligence models.
#gpt4 #ai #openai
00:00 - Introduction
00:37 - OpenAI Account Setup
01:31 - NodeJS and VSCode Setup
02:16 - Setup Project Environment
02:58 - OpenAI Initialisation
03:55 - GPT4 Chat Completion
05:44 - Express REST Setup
06:50 - ChatGPT 3.5 Chat Message
07:10 - Frontend ChatGPT API
08:06 - Frontend JavaScript Setup
09:16 - Frontend Fetch Request to OpenAI Backend
10:20 - OpenAI Chat Competitions API Configuration
11:05 - Backend GPT Message History Setup
11:39 - Frontend GPT Message History Setup
13:02 - Testing Local GPT3.5 API Chat Bot Setup
13:45 - Microsoft Azure Function Initialisation
14:30 - VS Code Azure Extension
15:00 - Create Azure Serverless Function
16:00 - Prepare Test Local Azure Function
17:04 - Deploy Azure Function to the Cloud
18:04 - Integrate OpenAI Chat GPT into Azure Function
20:13 - Deploy ChatGPT API Function into Cloud
21:18 - Conclusion
This video was made with Microsoft Azure as a sponsor. Thanks for the support. You can learn more about Azure Functions and download this project on the link below!
aka.ms/AdrianTwarog
⭐ New - Teach Me OpenAI Digital Book ⭐
enhanceui.gumroad.com/l/teach...
I've put together a easy to understand book with ~60 pages about OpenAI and GPT with how to get started to integrate it into projects, code examples, and much more!
Learn Design for Developers!
A book I've created to help you improve the look of your apps and websites.
📘 Enhance UI: www.enhanceui.com/
Feel free to follow me on:
🐦 Twitter: intent/follow?scr...
💬 Discord: / discord
💸 Patreon: / adriantwarog
Software & Discounts:
🚾 Webflow: webflow.grsm.io/adrian
🌿 Envato: 1.envato.market/yRZjz2
🌿 Envato Elements: 1.envato.market/LP0OJZ
🔴 Elementor: elementor.com/adrian/?ref=23140
✖ Editor X: www.editorx.com/adrian-twarog
Computer Gear:
⬛ Monitor: amzn.to/3f9DOQI
⌨ Keyboard: amzn.to/3eA5UFD
🐁 Mouse: amzn.to/3xVJO8l
🎤 Mic: amzn.to/3hgCfms
📱 Tablet: amzn.to/3ewt7sa
💡 Lighting: amzn.to/3vOZeZY
💡 Key Lighting: amzn.to/3f6qP2f
Camera Equipment:
📷 Camera: amzn.to/3uCv4J9
📸 Primary Lens: amzn.to/3vT6wMm
📸 Secondary Lens: amzn.to/3tyqWIX
🎥 Secondary Camera: amzn.to/3o2zCGi
🎙 Camera Mic: amzn.to/33tCz9l
🎞 USB to HDMI: amzn.to/33yW9RE - วิทยาศาสตร์และเทคโนโลยี
Less of a beginners guide and more of a quick recap for someone that understands it all I felt.
I was thinking the same thing lol. there was so much unexplained. I can get the model up on the server but they don't respond.
Agreed, I was completely lost on so much of what was happening here.
As a beginner… definitely suggest removing “beginner” from the title
😂
😂😂
😂
Agree!
Lol. Agreed.
I am a fan. GREAT content! Not a single second wasted!
This has been so helpful, Man! Thank you so much. Just got into your channel and I'm hoping to see much more from you! Cheers and have a great time🫂
This is the best tutorial I have ever seen, if I do say so myself!
Says the guy on his other
New subscriber, great video and really appreciate it! Will be attempting this soon, step-by-step! 🙏
too much valued details! thanks for your tutorial! very helpful for beginer
Thanks, Adrian!
Congrats on the Microsoft sponsorship! That’s so awesome! 👏
Super helpful, thank you!
Adrian, love it! Can you do a video with a focus on setting up prompts and testing?
Thanks a lot mate. You’re awesome 😊
WoW nice crash course!!
It is really helpful,
Thanks for this video man
thank you and this is amazing. just learning for now. hopefully one day I get to wirte my own script :)
3:44 this was the part I have been looking for none so far was able to show it. Thank you brother. If I get some lobe I would be happy to share my app url and may you all blow up my server happily 😊
Great video. Thank you.
Great video. New subscriber right here!
Good video. Could be nice if you explained more "why" :-) Like why use serverless function? Also explain what it means to go in the cloud, like beginning with "that means we're not going to use express anymore". Keep up the good work!
Ah good points! I’ll consider this for the future!
I am going to ask ChatGPT :)
because it's sponsored by Microsoft, duh
Great one!
Thanks, totally amazing! I am a beginner but maybe if like watch it 20 times like can do it, even though lol don't know what like am doing. .lol
Contrary to popular opinion, i am a beginner and this was super useful!!
Thanks 🙏
Great video. Thanks for sharing this information.
Not covered in video, but when you deploy the function to Azure (around 17:00) you must also upload the settings. If you're doing it from VSCode as in the video, after it says "Deployment of YOURFUNCTIONNAME completed" it will also give you the option to "Steam logs," "Upload settings" and "View output." You must click "Upload settings" otherwise it won't properly display in Azure Portal.
Can you maybe elaborate a bit more? I clicked upload settings but cannot avoid this azure dashboard error 'Your app is currently in read only mode because you are running from a package file. To make any changes update the content in your zip file and WEBSITE_RUN_FROM_PACKAGE app setting.' WTF
@@andrewwheeler9035 Yeah I had that error too. If you upload the settings, I think it goes away.
When you clicked upload settings, did it say upload complete? It takes like a minute.
@@libiroli Finally worked thanks! Tho while I got the local hosted version to connect to the API correctly and separately got the function deployed, I can't quite get the function url to work. In case anyone knows
@@andrewwheeler9035 So gptfunction.js is deployed and you can see it in Azure portal? And when you go to grab URL (as seen at 17:56) what happens? Want to understand what you mean by "can't get url to work."
Can someone help? This is what happens when i do npm init
npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ npm init
+ ~~~
+ CategoryInfo : ObjectNotFound: (npm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Great tutorial as always!
Thanks again!
Whoah.
That was fast.
Such a noob but gonna give it a shot!! Thanks heaps for sharing.
Ps- do you cover best way to install standard gpt locally?
Cheers champ!
Great video, thank you! I'm thinking to make GPT a support bot that can set appointments for customer using out internal software's API. How can I leverage GPT to make API calls to our appointments software based on conversation with customers?
such a great tutorial
as a beginner, this was very cool
I watched you revious vid this morning and now this gets out
Thanks! Really Nice.
:)
Thanks!
Thank you so much for this. Is it possible to add a CosmosDB in conjunction to store the data?
I have 0 experience in coding/programming etc. I am a business student, but I have an idea for a web app that would run in the openai API. Its going to take a serour learning curve and a lot of weeks for me to follow this video, as in "why did he do this?' But this video serves as a good guide for me. Thank you soo much. I'll hopefully share my app in this comment section in a month or so.
how its going ?
Hi Adrian, great video as always.
I tried it myself and it worked properly. But how is it possible to stream these ChatGPT responses while using Azure serverless functions? Maybe you can make a tutorial for this topic in the future
Hey Adrian, can we expect your tutorial building a chatbot that reads pdf files and gives relevant answers ? There are some tutorials out there but nobody really comes to your way of doing tuts 😅😊
Oh that’s a pretty good idea, thanks for the suggestion I’ll take a look into doing something like this
following
One of The best tutor
Thanks!
This was some great info! I didn't think I'd get an Azure tutorial too but thanks for that. I never knew I could do that. I think this video would be better if you answered "why" for some things. Beginners need to know that or else it's just copy and paste which is not how you learn overtime. Still a nice video tho :^)
Fantastic tutorial! Thank you for the content! May I ask how we can train our chat and customize its knowledge?
I second this
I third that !
I fourth that...
May the fourth be with you
@@sebastianbjorkemar3615 Yes please. I fifth that
Sir.. Post Full Video about Chatgpt-4 from basics to advanced concept and API use for building website and web applications and how to use it build SaaS applications...
😂😂😂😂 Some just woke up and this guy already integrating gpt 4. Im gonna start being ruthless
Something went wrong for me when creating a serverless function. When deploying my function I can't find it anywhere in Azure under functions. When deploying a function my entire folder "disappears" on my local machine. My automatic generated function also looks different from yours and there is no "debub" dialog for me.
May I ask if ChatGPT API support sequence as it has in Web version? Sequence here I mean that the relation between input sentence. In the web version, when we input two related questions, ChatGPT will recognize and answer the second question in the same area of the first question.
So at the 11:40 section, are you just constantly sending a bigger and bigger string of text on each following prompt to the server to maintain context? Seems like you'd eventually hit a limit, and each call would be more costly.
Super helpful! Would be cool if you went like 15% slower lol
Getting into tech being self taught so far has been 2 years of hard work learning how resistors work and bianary all the way to this video. I really hope im not waisting my time. I had an idea that you could use chat gpt as a central brain making emotional decisions, for example asking it to only respond with how it feels about something with a word off a list then having hard coded responses based off the response from the list in a way that the player never sees, but i garetee could feel the lack of predictability like in a robot and it would presumably feel human. Sound crazy?
Your idea isn't crazy, but could be implemented/scaled differently. I would model your ideas off the human brain and consider where an LLM fits into that. Our brain receives inputs and routes them through systems that interpret those inputs and makes sense of them based on memory (eg. a past threat; this is food; etc) and language. This triggers emotional/reactive responses that are then either 'controlled/regulated', or 'take over'. An advanced circuit (mainly fronto-temporal lobes according to current neuroscience) is ideally what takes over the regulation. It is where we reason, rationalise and plan. Our brain's 'internal LLM' is central to the functions here, but requires logic circuits and internalised rules (values, mores, etc) to determine which response is the appropriate one.
@CptComic wow took me reading this a couple of times the past 2 weeks to really get it. Thank you for the advice. we really are just mimicking it's crazy. Copy success and you'll be successful 🤣😁. I appreciate you.
Great video.
What are you using for the autocomplete in the code editor? Seemed to auto complete A LOT.
github copilot x
@@zaks0rel already?
Im using C# to do the same, but if my post string gets too long, im getting "Gateway Timeout" error. Are there ways around it? Like sending string in multiple chunks?
hi, how do u set if the api uses gpt3.5 or gpt 4 ? there is no setting when you generate the key as far as I can see... please help. cheers
man, computer language is AMAZING !!!
@AndrianTwarog can share the VSCode plug-ins used to auto completion?
Amazing content, thanks for your time to create this vid, and willing to share your knowledge.
If you don't mind.... I'm having one question...
Can you please tell me why you're using the (server) Node App ?
Why don't you send your requests to the OpenAI API directly from your front-end App (using the fetch function) ?
Thanks in advance for your reply.
That is another way of using the API. It just means that you won't get the benefits that node brings to the table and that your app will be like a fat-client (If I am correct). The more important reason is probably because the API key should not be exposed to the client. In fact, the documentation clearly says: Important note: When using Javascript, all API calls should be made on the server-side only, since making calls in client-side browser code will expose your API key. See here for more details.
Normally you want a "middleware" between a client and API source, that is called the server or backend, and during that step you can perform extra functions, like user login, tracking usage, etc! And yes, dont let anyone see your API key!
5:41 I doit evrything same but i have difrent response too many line of code to pste here but one "You exceeded your current quota, please check your plan and billing details." ;) and I have question for you: do you use free acount?
I understood nothing. However, I'm excited the skeleton of a GPT API integration. I will work harder and next time I come to this video, I will understand everything.
Thanks! So where does the fine tuned model live, both for messing around and in production? On your own server or hosted with openAI?
If you build one, it has a custom model name you can reference similar to when you use the model name davinici!
Pleas is the GPT 4 model connected to the internet and up-to-date?
What extension are you using for autocomplete prompts?
Hey, great video. I enjoyed it very much while following the project. Although I've a question that can I do this without using the Azure? I mean can I host this in normal hosting?
You could host it locally, or on your own docker, system, but I wanted to also show how it could be hosted serverlessly with just a single file on a single function!
@@AdrianTwarog Actually I want to host it in my hosting account in Hostinger. Can you give any idea on how I can do that?
isn't something missing? I had to add this to serve the html file:
app.use(express.static(path.join(__dirname, "public")));
index.html is in a public folder
Great Tutorial. Definitely not fpr Beginner though
Noobie question here, I've generated a load of API keys for various apps when I was on GPT 3. Now I've upgraded to GPT Pro (4) do I need to replace all the API keys I've done previously? Or will they still work with GPT 4?
Is there a link to the codebase?
Really helpful and very well explained! Thanks!
Adrian before you upload these "Beginner" videos, an idea would be to get a Beginner to watch this in real time and give you feedback. It's like you were explaining everything in 3x speed
Yeah pacing is difficult, too slow and people tune out, too fast and people cannot tune in. Working on the right balance!
@Wozzump Cool story bro.
Thank you for providing this video! I'm stuck when testing it out the first time, the page loads but when I submit a prompt, it just displays what I wrote, but no response. Any suggestions?
same here
I solved the issue by fixing some typos, e.g. competion -> completion.
i have the same issue, its annoying
Timestamps courtesy of Deciphr AI 👨💻
0:02:05 GPT-4 Chat API with OpenAI and Node.js
0:05:01 Interactive Chatbot with OpenAI and Express.js
0:07:10 Chat Application with GPT-4 API and JavaScript
0:08:40 Chatbot with Message History using JavaScript and OpenAI Models
0:10:52 Chatbot Functionality for Graphics Design with Design GPT
0:12:27 Message History and Deploying the API Online
0:13:51 Serverless App on Microsoft Azure Cloud with Azure Functions Extension in VS Code
0:15:27 GPT Function with Azure and OpenAI
0:18:40 OpenAI Configuration and Initialization for Azure Function
0:20:00 AI Chatbot on Azure Cloud
Can my rpi4 run an API to ask chatgpt about which type of waste are the pictures it takes? So no longer needed computer vision systems?
Hi, if you can kindly explain the use case of this API? Like how can we use this?
hi, thx the video! is there any other free solution to publish the created UI instead of MS Azure?
Great tutorial.
What plugin do you use for your code completion?
GitHub Copilot
@@AdrianTwarog Thanks.
Great explanation, but where is the GPT-4?
does anyone know how to format the content received back from the model? If it contains bullet points and the like, I want to format it rather than show the paragraph. How can this be done?
damn, this is so damn cool.
I just wanna know, how much space this app needs so u need to have it on cloud instead of pc/mobile hard disk? To clarify: i have unlimited internet on all devices evrywhere so im looking for personalised app just for my ussage mostly offline in work with specified database of knowlege like manuals and work step by step help with proceses with 50+ steps so i dont need to rememember everything...
So can this funkcion without the need to acces it thru webpage?
Quick question, how do you get those code suggestions while typing such as the ones from the openai import. Is this an extension?
GitHub CoPilot
Can you post video about Chatgpt-4 API & How to use it to build Web Applications
Fantastic video! I was looking for something exactly like .
Are you available for work on a project we have in mind?
I have my own team that often helps me work on things, even this video too, while it looks like I do this by myself, lots of effort goes into things like this!
@@AdrianTwarog for sure! Always is. Ideally a collaboration would be great. We have an industry of 2700 companies which could use a chatbot like you showed plus include their own company based data and an industry expert's information. Is this something you would be open to discussing?
@@markgarrett2971how much you paying him lmao
My functions list doesn't update. I see an error above that says: "Your app is currently in read only mode because you are running from a package file. To make any changes update the content in your zip file and WEBSITE_RUN_FROM_PACKAGE app setting."
How can I fix?
Ask ChatGPT
Same problem here!
same problem here
I had some luck - look in your application settings WEBSITE_RUN_FROM_PACKAGE and change value to 0 then republish the app
Looks like the "engine" was updated to "model" in the openai library/api.
I am a beginner
When using gpt chat, do I have to get the API from it, or can I get it from anywhere?
Wao, buen video... =D
I do not have an organization ID. Is that because I am not under the pay plan ?
can you make the code available, so we can add our API key and specific info?
Hi Adrian, thank you for the tutorial. Is GPT 3.5 turbo API free of paid?
so for use this api, i need to pay first correct? because I am using 3.5 turbo and can only show 'Hello! How can I assist you today?'
The organization id is optional , correct?
Could you help me please?
5:37 - after node. \index.js I get the error which says:
node:internal/modules/cjs/loader:1078
throw err;
^
Error: Cannot find module '/Users/kirillrodionov/Chat GPT /.index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Module._load (node:internal/modules/cjs/loader:920:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.16.0
I am having the same issue. How can I telegram you?
All the best
@@jn9747 You are typing wrong the command. The place of the dot is diferent. Is NOT node. \index.js ; Is node .\index.js .
hey man this a great tutorial, thank you for sharing!. Anyone was tried using GPT4? I tried but I received an error message that the model doesn't exist. Does anyone have a clue?
Andrien please make another advance WordPress series from scratch.... I am big fan of your,s
Maybe one day, though I have a feeling WordPress is going to be replaced soon with no-code tools!
I did a few tests with 300 pages of Knowledge doc (certain law codices of specific county) uploaded for retrieval. And one question/answer cost was in a range of 0.07$ as it seems it uses that big knowledge doc as context tokens. So in a few questions i was over 300k tokens used lol Did i do anything wrong apart uploading such a big doc for knowledge retrieval and is there any optimisation for that?
for some reason, my function is not showing up on azure. i am getting no httptrigger found
Recommend beginners feeling completely lost watch videos where the instructor actually builds the project in real time.
It’s longer, but much more helpful than a happy path script.
I feel a bit lost. The guy is explaining well but i get errors. Are you saying that i should watch a different video? also whats a happy path script? thx
@@mokiloke Yea precisely. The video has been edited such that everything works perfectly first time, but there is a lot of benefits watching something were the instructor hits an issue and gets around it in real time.
Happy path script is where the instructor only ever gives instruction that works perfectly, which is unrealistic and misleading for a beginner.
😍
Hi why is this not working for my free trail of of 18 dollar quota, it is showing me tha I exceeded the quota, but i havent
hey when ask my chat-gpt4 model ( are you chat-gp4 or chat-gpt3 ) it says chat-gpt3 can anyone guide me ?
when too many messages have been send the ai seems to forget the system content. does someone have a solution?
I want this response fast i mean when we are expection a long para type response it takes alot of time.
understand that this is almost straight code, however they have also included a little meta code so you will have to debug once you run it (particularly DOM). not for a total newbie
definitely
understands the api himself. maybe you should hire him for quicker results.
Im combing through the lines trying to find out why I am getting "Cannot GET /".
Everything worked in phase1, but when getting to fetch is where something has gone south, and get the error. Is there a codebase snippet anywhere? Pointers on how to isolate error?
have you figured out anything?
same, it's when you use POST instead of GET. idk why
Do we have git repo for your code please?