How to use the ChatGPT API with Python!!
Ғылым және технология
Get notified of the free Python course on the home page at www.coursesfromnick.com
Sign up for the Full Stack course here and use KZread50 to get 50% off:
www.coursesfromnick.com/bundl...
Code: github.com/nicknochnack/ChatG...
Hopefully you enjoyed this video.
💼 Find AWESOME ML Jobs: www.jobsfromnick.com
Oh, and don't forget to connect with me!
LinkedIn: bit.ly/324Epgo
Facebook: bit.ly/3mB1sZD
GitHub: bit.ly/3mDJllD
Patreon: bit.ly/2OCn3UW
Join the Discussion on Discord: bit.ly/3dQiZsV
Happy coding!
Nick
P.s. Let me know how you go and drop a comment if you need a hand!
#machinelearning #python #datascience
Пікірлер: 163
One thing that's nice to add is streaming, so that the words show up as they are being generated. This avoids the longer wait times for lengthy responses. Also, I've noticed that openai is still working out the kinks with their api's and some days you'll get a pretty high failure rate and have to retry a response. With streaming, you can set a reasonable timeout to try again ( usually if the first word hasn't arrived within 3 seconds, it's going to fail and hang indefinitely). If you don't have streaming, you have to wait as long as your longest possible response to retry which could be more than 10 seconds in some cases. Getting into the minutiae a little bit, but just some things I've discovered in my travels.
@pratikbawane997
Жыл бұрын
Hi there! Can you tell me how to add streaming as you said above?!
@Ultimate-pb8hl
10 ай бұрын
does this include getting responses like "permissions denied"?
@ULTRA5364
5 ай бұрын
Awesome!
ChatGPT has been AMAZING the experience for me was priceless
You re a lifesaver, I’ll be using it for my school project thanks 🙌
I'm scraping all of the chat and teams log data from my company and training gpt with it. I will build a UI for my team members so that our private technical business questions that are asked frequently can be answered quickly.
@borntodoit8744
2 ай бұрын
I wish you would add more data.. how u implemented usecase: training using private data for private AI requires an instance of a model workflow: prompt + private data >chatbot >model (GPT LLM) >completion unless u have a local instance of model (GPT LLM) then your data is still going to the internet (to OpenAi 's GPT instance)... feb2024: your post is 10 months old (2023) I don't think running local model instances (llama, Gemini, GPT) were available to download & install locally
I love how these videos - so short and direct it makes it so much simpler to follow thank you 🙏
@borntodoit8744
Жыл бұрын
Is called dumbing it down for the masses. everyone thinks they are an expert till they hit a basic problem...
Thank's for letting us know that openAI have released API for chatGPT. I wonder how many of my students already have a account
@NicholasRenotte
Жыл бұрын
Anytime @Yrgen! Got some plans to do more content around it!
@RaviKant-ll6ck
8 ай бұрын
Turnitin will catch the content generated by AI.
Awesome 😎 Thank you for sharing with us❤
Thank's for that. Can you make a video on explainability in ML models, I want to know why and how the models work.
@NicholasRenotte
Жыл бұрын
You got it!
@settempavan9744
Жыл бұрын
Can you make a video on explainability in ML models such as visualisation techniques in CNN and more
Hey Nicolas, enjoying your content! You are an inspiration! Just curious which final cut effect plugins you use? They make videos quiet enjoyable.
@NicholasRenotte
Жыл бұрын
No plugins anymore, I do all the special effects in Adobe After Effects. Occasionally I use DeepGlow but all the custom stuff you see here is from AE
How does this work with continuity between messages?
@vikashmaurya2679
11 ай бұрын
You need to store it, you can store it temporarily in a list and that way you can maintain continuity
Damn 😅 Gotta work out better placement for the keyboard cam.
@NicholasRenotte
Жыл бұрын
Also, lmk if any of you are coming to the forum I mentioned on LinkedIn! Would love to grab coffee with y'all!!
@ahmadelmassalkhi
6 ай бұрын
i dont get the .ChatCompletion method i get .completion
How does the results compaire to use gui connected to API or using the web app or in browser
How many such requests can be made? Is there some limits in your plus subscription?
What dependencies do I have to install before running this code?
I’ve been doing a lot of cool stuff with the API. It’s incredibly easy to implement and find new ways to work with other libraries
@BigBoss-sm9xj
Жыл бұрын
Do you think it's worth the price?
@jhemp8446
Жыл бұрын
@@BigBoss-sm9xj a better question to ask, does it pay for itself and the answer is yes.
is this script working without openai api key?
I'd like to see a simple example with PHP. I tried a month ago it never worked
Can you share how to get just the output, and not the rest of the object?
What is the benefit of using this instead of the default chat gpt webiste?
Any full screen video for this please... Or any other source for this...
for the content, to make it more dynamic, have the user supply the prompt as a command line argument.
@borntodoit8744
Жыл бұрын
is a programmatic example to show the open api not to show a scripting example for other usecases
Nice one Nicholas. One question, there's the same max characters in the output as in the web version? In this format of video seems longer.
@NicholasRenotte
Жыл бұрын
What's the limit in the web version? It generated a whole page for me this morning!
@PassingTheDog
Жыл бұрын
@@NicholasRenotte It was like 4k characters. But I guess that now with the paid version it depends of the budget :')
@ko-Daegu
Жыл бұрын
That’s has to do with the mode 4k token is the gpt4 limit (I heard they will release a 32k token limit )
It's using GPT3.5 turbo, how do you use GPT4 instead?
Do we need a chatgpt acount
Thanks mate 🤍
how much the pricing?
Nice, thanks.
@NicholasRenotte
Жыл бұрын
Cheers Terry!
hey Nick, I’ve been trying to build a chatbot using the official API but the engine don’t have memory. Is there a way to have such thing with the official api? Right now i m using the un official chatgpt wrapper but I need to login every time
@NicholasRenotte
Жыл бұрын
Hmmm not too sure where the memory issue is? On ChatGPTs side or for your app? I'm doing a walkthrough of how to integrate it into Watson Assistant today. Started working on the Openapi spec yesterday. Should be out soon, I've been getting a ton of questions on it.
@gianmarcoguarnier2525
Жыл бұрын
@@NicholasRenotte Like: you can use the engine to generate answers as you showed but you can't generate a conversation instance through the API. Or can you? Looking foward for the video!
How can I feed it data to build a custom trained model ?
@ULTRA5364
5 ай бұрын
That's a good question!
you can litterly make an ai app that just runs chatgpt
@ahmedmeftah731
7 ай бұрын
@noobody. no no, I mean an interface that works via ChatGPT-API
This good content
@NicholasRenotte
Жыл бұрын
Thanks a mil @jasser!!
Hey nic can you do a stock market (of your choice) data analysis
Can you make videos about fine tunning, and semantic search using gpt?🥺
@NicholasRenotte
Жыл бұрын
You got it!
Is there a way to use ChatGPT 4 on this?
Is there anyway to get an api for free use for learning ?
Nice vlog ❣️Kannayya while seeing in mobile be like Enti nenu intha cute ga vunna 😊😅
Wait, I think this is actually pretty useful... * looks at Alexa echo dot * hehehehehe
@circuitcoder
Жыл бұрын
For those who didn't get it, I want to try to make an Alexa skill which let's you communicate with chat gpt through Alexa
Is it free to use open ai APIs?
Hi there. Is it possible you could tell me if paying for the api key gives faster response times... for chatgpt api? Would appreciate your response.
@naitikjain9292
Жыл бұрын
I think you cannot use this without paying, not sure tho
I am trying to install openai to my file in visual studio code but its not working what do i do
So I've made a tkinter app that had a prompt box and returns in a canvas with a save as need to clean it up need to learn to style more
@NicholasRenotte
Жыл бұрын
Nice!! Awesome Josh!
what is the purpose of asking chatgpt questions in vscode
How about image detection for onscreen images and algo? 😅😂
Hello. I installed that module but apikey methods not included. This way of codes gives me error. ModuleNotFoundError: No module named 'apikey' Do you have any suggestion?
@karim7658
Жыл бұрын
It's a local module he created himself to store his APIKEY I believe.
AWESOME
@NicholasRenotte
Жыл бұрын
Cheers Omar!
@omar7613
Жыл бұрын
Bro! I wanna learn Reinforcement Learning, are your old videos still working? I heard that the libraries changed and the code doesn’t work from the comments.
Awesome ❤👍💪👏😄
Would have to pay tho?
Do we need to generate a key from the open Ai website?
@Harsh-nv3xw
15 күн бұрын
yes
Bro how to buy api keys in open ai
Is the API free?
Can I make chatgpt helps me in prediction and classification with me model and links it with opencv I mean can I let the mission for chatgpt
hey nicholas please made video on kaggle
it says You exceeded your current quota, please check your plan and billing details you are so lucky you got it for free man
@asmaamohamedmagdhelali5610
2 ай бұрын
Me too
@stutitomar6230
Ай бұрын
What did you do next?
Can you pls do the same for llama 2
would you need internet connection before it generates the output or it does it like that
Will it give me the gpt4 answers?
ChatCompletion line is not working properly
this scares me a lot Nick
@NicholasRenotte
Жыл бұрын
Curious? Why so @Mi Name?
"Cannot import name APIKEY from apikey" O________O I did pip install apikey and it went through, but the code still doesn't run. What gives?
@luischronos
Жыл бұрын
bruh...
@abetterfuture4787
Жыл бұрын
@@luischronos Help a newb out?
hey, im continuously getting this error openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details even though its a brand new key and i used the old key way back in feb can someone please help, thanks :D
@unknownyoutuber8
11 ай бұрын
I am getting the same problem
Eerie how time and time again that we align our projects lmfao
@NicholasRenotte
Жыл бұрын
I posted on LinkedIn about an integration I built with it. I am getting slammmed with work now 😂
it says no moduled name openai
Is there any method to take user input as message?
@Reficul999
11 ай бұрын
U can create a tkinter and use an Entry
@crossses
11 ай бұрын
Yeah easily so put this content: input("What is your proompt?")
Ты не пробовал из какой нибудь локальной модели которая полностью доступна в общем доступе, сделать чат?
@NicholasRenotte
Жыл бұрын
Not yet most of the stuff has been with paid APIs unfortunately. Closest was probably the live stream I did with BLOOM.
@user-lz3cz2zc4w
Жыл бұрын
@@NicholasRenotte Sorry, I'm from Russia and I meant this. Would you like to use a public local model to create a dialog neural network similar to GPTchat. Are you planning this??
Nice
Cool man
Can we use this to create chatbot? I am a noob to this field. Please answer anyone... 😊
Public API?
chatgpt helped me try random generation of api keys until it works and now i have free chatgpt
@NicholasRenotte
Жыл бұрын
LOL fr?
@way2on
Жыл бұрын
@@NicholasRenotte Yea it tries many combinations over and over everytime it returns an error, sometimes it works, sometimes it doesn't. So sorry for whoevers api key was used
hello me to developer and ı have an question; what is gpt-4 engine name
@FitVerse-oc8vy
9 ай бұрын
please help me
Why would I do this over using the playground
Why not just use chatgpt promptline?
where's code
I'm keep getting error that api is invalid or exhausted quota... Is it paid?
@tusharrao74
7 ай бұрын
It used to be free but it's paid now
@LordDSP3
7 ай бұрын
@@tusharrao74 that's sad, you know any api / model / lib to make a simple chat bot
@alangiovannysanchez5368
5 ай бұрын
I had the same issue. Bit of a bummer it's no longer free.
were is the dicreption
only 5-6 month ago.. it was that recently🤔🤓
Is this the pay to use API?
@gianmarcoguarnier2525
Жыл бұрын
you have three months free
@NicholasRenotte
Жыл бұрын
Yup!
I would rather use ChatGPT to ask it how to use ChatpGPT APIs 🤭
@The_Unfamiliar_Circle
Жыл бұрын
Sure buddy, if you want the less advanced text-davinci-002 model
is this Api is free
BOOOM
I need help
How to get API key ?
@blackhunter89300
2 ай бұрын
you hvae to pay
What do you mean recently? The API has been available for years...
Nowadays they need computers to say absolutely nothing?🤯
Is it free or paid?
@NicholasRenotte
Жыл бұрын
This one is paid @Ogunkoya! It seems pretty reasonable though $2 per million words.
@chevvvv
Жыл бұрын
@@NicholasRenotte how do I start this? And where can I get an API key?
0:00
Is this really chat gpt, or is this gpt? Big difference. The one is a fixed price monthly, the other costs credits. Its misleading if its gpt and not chatgpt
There will be a leck of programming job's in the future better start with electrical engineering.
@Yazan_Majdalawi
11 ай бұрын
That'll be affected as well, not that much further from programming jobs
Not working
Is this free?
barack obama?!
how to make Minecraft in python import Minecraft run yay
You don’t
does this guy get on your nerves or is it just me
@NicholasRenotte
7 ай бұрын
nah, gets on my nerves as well
This man have Something wrong in his Neck 😢😢😢😢😅
I fail to see how this is anything other than pointless. Why waste time writing all that code when you could just go to chatgpt and ask there? Can we maybe get a practical use for this?
@Eddyi1
8 ай бұрын
wtf. This can be used to automatize a lot of processes.
Dont know anything about it
What’s the point of this, why not just use the GUI?
This is not a ChatGPT
This is for the lazy!