Getting Started With OpenAI ChatGPT (GPT-3.5) API In Python | Tutorial For Beginners

  Рет қаралды 48,642

Jie Jenn

Jie Jenn

Күн бұрын

OpenAI has finally released the most anticipated ChatGPT model today, called "gpt-3.5-turbo". Unlike the GPT 3.0 models that work like a search engine, ChatGPT model tracks the conversation to create more useful outputs. In this tutorial, I will go through every single detail on how to get started with the newest OpenAI ChatGPT API in Python.
📑 Python Script Used In The Video: wp.me/payCAw-1lw
💻 Build Your Own ChatGPT Desktop App: • Build Your Own ChatGPT...
✉ Signup for an OpenAI account: openai.com/
📑 OpenAI GPT Model Pricing: openai.com/pricing
📑 openai.ChatCompletion reference: platform.openai.com/docs/guid...
📑 OpenAI ChatGPT Model (gpt3.5 turbo) Info : platform.openai.com/docs/mode...
► Buy Me a Coffee? Your support is much appreciated!
-------------------------------------------------------------------------------------------
☕ Paypal: www.paypal.me/jiejenn/5
☕ Venmo: @Jie-Jenn
💸 Join Robinhood with my link and we'll both get a free stock: bit.ly/3iWr7LC
► Support my channel so I can continue making free contents
---------------------------------------------------------------------------------------------------------------
🛒 By shopping on Amazon → amzn.to/2JkGeMD
👩‍💻 Follow me on Linked: / jiejenn
🌳 Becoming a Patreon supporter: / jiejenn
✉️ Business Inquiring: KZfaq@LearnDataAnalysis.org
00:00 - Intro to OpenAI gpt 3.5 turbo model
00:34 - OpenAI GPT-3.5 Pricing difference vs GPT-3.0
01:51 - OpenAI GPT 3.5 models summary
03:03 - Sign up for an OpenAI account
03:29 - Create an OpenAI API Key
03:47 - Create Python script
04:15 - Install OpenAI Python package
04:27 - open.ChatCompletion library usage
11:00 - Track ChatGPT conversation
15:03 - Make the Python script runs like ChatGPT
#chatgpt #chatgptapi #openai #ai #python #gpt

Пікірлер: 83
@jiejenn
@jiejenn Жыл бұрын
📑 Source Code: wp.me/payCAw-1lw I will be releasing more chatGPT related videos in the future, so don't forget to subscribe! PS: I was incorrect regarding you cannot set a token limit with ChatCompletion model. In fact you can, by setting the "max_tokens" parameter.
@toddwmac
@toddwmac Жыл бұрын
Much appreciation, I decided to learn VS Code and Python (basics) a couple days ago so I could start playing with this API. Last time I cracked open any code was probably VBA (if you can call that code) Appreciate you taking the time to explain your process and some of the underlying pieces. Update - your code worked perfectly and I know that: In the 2020 NBA Finals, 575 free throws were attempted by both teams combined over the 6 games. Thanks a ton!
@jiejenn
@jiejenn Жыл бұрын
Glad you found the video helpful. I was a VBA developer for 8 years, definitely know what you mean by if VBA is a language at all 😂. Learning Python is definitely worth it by the way. And there is a Python library called pywin32, basically lets you to write VBA in Python.
@kontgaming5449
@kontgaming5449 Жыл бұрын
we need programmers like this. Thank you Jie Jenn
@gokulbalaji469
@gokulbalaji469 10 ай бұрын
thankyou so much bro you explained it very clearly.
@HaidenSD
@HaidenSD Жыл бұрын
I have subscribe your channel bcoz Jenn cares about his commenters : )
@thedarkglovemusic
@thedarkglovemusic Жыл бұрын
Thanks for doing this
@jiejenn
@jiejenn Жыл бұрын
You're welcome. Keep an eye out for a followed in-depth video soon.
@thedarkglovemusic
@thedarkglovemusic Жыл бұрын
@@jiejenn btw, you had a typo in a few places, "conversation" in some places and "covnersation" in others.
@jiejenn
@jiejenn Жыл бұрын
Thanks for point that out. Had to rush the video will have to go back check the typos.
@toddd.8496
@toddd.8496 Жыл бұрын
Thanks for sharing this. Just a quick note, on some lines the word 'conversation' was misspelled as covnersation.
@jiejenn
@jiejenn Жыл бұрын
Thanks for pointing that out. Typos I didn't noticed until now.
@douglashilton4048
@douglashilton4048 Жыл бұрын
I just finished building a python code that totally interactive without typing or reading text. you can use an local wakeup word(stays offline until you want to use it). then wakes up and uses ChatGPT-3.5-turbo. It remembers the previous conversations, you talk to it, and it answers back with speech. I want to add it to an interactive AI avatar if anyone can help with that. uses wireless microphone so I don't even need to be by the computer.
@jiejenn
@jiejenn Жыл бұрын
Sounds like a great project.
@daddyhazzz
@daddyhazzz Жыл бұрын
Dude got git? I’d love to collaborate on top of your project for an idea I had! HMU Let’s gooooo! If not it’s all good this is what I have saying Chat needs soooooo bad! If we can only get it to operate external sources which I’m sure is gonna be gpt 5 or 10 or some shit… 😅
@samrobinson2614
@samrobinson2614 Жыл бұрын
Hey man I would be interested I've been building a similar product.
@douglashilton4048
@douglashilton4048 Жыл бұрын
@@samrobinson2614 I need help with making an android app of my program, and also an AI model with lip sync. anyone want to share or add to my program?
@douglashilton4048
@douglashilton4048 Жыл бұрын
@@daddyhazzz no its not on GIT yet. I would like to get it on an android app and also use an AI model with lip sync.. would be cool. any help would be appreciated
@DigitalSamTV
@DigitalSamTV 10 ай бұрын
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
@dragonsaige
@dragonsaige Жыл бұрын
Hey, how are you running whatever code you select in the currently open python interpreter?
@jiejenn
@jiejenn Жыл бұрын
Maybe this video might help kzfaq.info/get/bejne/jL56dsuHq5icmqs.html
@soumojitguhamajumder3143
@soumojitguhamajumder3143 Жыл бұрын
Do we yet know, if we could retain the existing model? Can I add or change certain layers?
@jiejenn
@jiejenn Жыл бұрын
Not sure if I follow your question.
@soumojitguhamajumder3143
@soumojitguhamajumder3143 Жыл бұрын
@@jiejenn apologies, there was a typo. Can we retrain the existing model with some specific data? May be fine tune it as well, add a few layers, etc.
@soumojitguhamajumder3143
@soumojitguhamajumder3143 Жыл бұрын
Anybody from data science/ml can answer this?
@senjin8244
@senjin8244 Жыл бұрын
Hi, I'm successfully run your script in terminal! however, i want to export the output, so can you maybe make another video tutorial how to use this on web browser, or maybe a gui app with parameters setting? thank you!
@jiejenn
@jiejenn Жыл бұрын
Thank you for your feedback. Great idea. Will put it on my to-do list.
@senjin8244
@senjin8244 Жыл бұрын
@@jiejenn thank you very much for your contribution! Just a simple one will be great! Maybe make another tutorial video of how to fine tuning it as well 😂
@jiejenn
@jiejenn Жыл бұрын
Unfortunately you cannot tunning GPT 3.5 model. However, you can with 3.0.
@bnglr
@bnglr Жыл бұрын
"system" is supposed to instruct the model, send it before "user" message, no need to send it as an individual request.
@jiejenn
@jiejenn Жыл бұрын
Thanks for the clarification!
@HaidenSD
@HaidenSD Жыл бұрын
Thanks Jenn it works am using Pycharm. Does token have limitation? Bcoz i want to summarize abt 50,000 words. So how do i increase the token or bypass limitation?
@jiejenn
@jiejenn Жыл бұрын
I believe GPT3.5 has a token limit of 4960 or something close. GPT4 will probably has a limit of 20/40k token limit once the API is released.
@HaidenSD
@HaidenSD Жыл бұрын
@@jiejenn Thank you for replying within 20 minutes wow : ) With 4k token its stop generating me 50k text inputs like summarizing books. Do you have any hack idea to bypass this token? If any chance where can i DM you privately?
@jiejenn
@jiejenn Жыл бұрын
Just type continue and GPT will continue from the last conversation.
@HaidenSD
@HaidenSD Жыл бұрын
@@jiejenn Ok
@HaidenSD
@HaidenSD Жыл бұрын
@@jiejenn Bro do you have Telegram?
@yuchengpeng7706
@yuchengpeng7706 Жыл бұрын
Thank you so much! But I got his problem :"openai.error.InvalidRequestError: Additional properties are not allowed ('content:' was unexpected) - 'messages.2", could you tell me what would be the problem? Thanks a lot!
@jiejenn
@jiejenn Жыл бұрын
Hard to tell without looking at your script. But my guess is there is a typo somewhere in your script.
@yuchengpeng7706
@yuchengpeng7706 Жыл бұрын
@@jiejenn thank you! I checked my code so many times line by line, I didn't find the typo, everytime I entered my question , I got this Error. Maybe it's simply because my free credit has expired😮‍💨
@jiejenn
@jiejenn Жыл бұрын
Go into your openai account and from there you can check how much token you have left. But by looking at the error message, doesn't look it is a token issue.
@yuchengpeng7706
@yuchengpeng7706 Жыл бұрын
@@jiejenn you’re right, not the token issue, even though I still don’t know why, I just gave up and copied your code, so everything works perfectly🤣, thanks bro
@jiejenn
@jiejenn Жыл бұрын
@@yuchengpeng7706 glad my video helped.
@thedarkglovemusic
@thedarkglovemusic Жыл бұрын
Is there anything special you need to do to get this to run just using "run pythin file"? If I run the whole code as a block it works but all hell breaks loose if I try to just click the |> button.
@jiejenn
@jiejenn Жыл бұрын
Can you be more specific? Normally you would just run the script like a normal Python file.
@thedarkglovemusic
@thedarkglovemusic Жыл бұрын
@@jiejenn Thanks for replying, I've been through a bit of a process where I originally had 1 problem but now I have many, so being specific is impossible now! I think I just need to spin up a new VM.
@TF-qt3jh
@TF-qt3jh Жыл бұрын
As a total pre-beginner of Python, I really appreciate this type of video. It motivates me to learn the language. At this stage, I don’t understand most of what you are talking about. What would you recommend to me to start learning as the first step?
@leehaen1484
@leehaen1484 Жыл бұрын
HI,thanks your shareing. When I follow your step and block in 9:30 . The fuction show : openai.error.InvalidRequestError: Invalid URL (POST /v1/chat/completions). I fond the solution to this problem is to change the model to engine, but it still not work. Could you help me ? This block me 2 days.
@jiejenn
@jiejenn Жыл бұрын
Looks like you may be using an outdated OpenAI Python library. Try run pip -U openai and try again.
@carspam_nv
@carspam_nv 11 ай бұрын
my code is not working i just copied the script and nothing is happening is there a index.html file
@MilkstacheTV
@MilkstacheTV Жыл бұрын
Today was my first day of using python and i already made a discord bot that reads messages from a specified channel, sends those messages to chat gpt, and then sends chat gpt's response back to the original channel(i know it isn't much but it's my first day come on).
@dev__004
@dev__004 Жыл бұрын
Exactly what i am trying to do now
@MilkstacheTV
@MilkstacheTV Жыл бұрын
@@dev__004 I could send you the code if you have like a discord or something
@dev__004
@dev__004 Жыл бұрын
@@MilkstacheTV its ok, i am almost finished actually . Thanks for asking tho , appreciate it
@MilkstacheTV
@MilkstacheTV Жыл бұрын
@@dev__004 np
@JuanRamirez-di9bl
@JuanRamirez-di9bl Жыл бұрын
So, for a work the size of the KJB that contains about 780,000 words, the cost would be somewhere around $1500? 🤔
@jiejenn
@jiejenn Жыл бұрын
Naw. Should be around $1.56 --> 780,000÷1,000×0.002
@MrAbkejoe
@MrAbkejoe Жыл бұрын
​@@jiejenn If I've access to near unlimited computing power, what other limits might there be?
@jiejenn
@jiejenn Жыл бұрын
@@MrAbkejoe maybe we have to play by the rules of OpenAi's policies, and there is a deep learning curve if you want to create something abstract since the model can actually has a learning capability to enhance the response accuracy.
@True3rror
@True3rror 11 ай бұрын
what python version do you use?
@jiejenn
@jiejenn 11 ай бұрын
Python 3.10
@emanueleceglia2282
@emanueleceglia2282 8 ай бұрын
@jiejenn Thanks Bro, I've just finished the project of my master thesis
@lalithasagi8124
@lalithasagi8124 7 ай бұрын
It is saying RateLimitError
@jiejenn
@jiejenn 7 ай бұрын
Okay. But why?
@wiseguy0106
@wiseguy0106 Жыл бұрын
Is there a way to remove the content filters?
@jiejenn
@jiejenn Жыл бұрын
Can you give me an example what you mean by content filter?
@wiseguy0106
@wiseguy0106 Жыл бұрын
@@jiejenn like being able to generate an erotic story or something like that.
@jiejenn
@jiejenn Жыл бұрын
@@wiseguy0106 I don't believe API has such restriction, only the web chatGPT has however.
@wiseguy0106
@wiseguy0106 Жыл бұрын
@@jiejenn i used your python script. it gives me the same responses as chatgpt "User:can you generate an erotic story for me? assistant: I apologize, but I cannot generate explicit content or inappropriate material, as it goes against ethical and moral principles. My purpose is to assist and support you in any helpful and informative way possible, using appropriate language and content. If there is anything else I can assist you with, please let me know."
@jiejenn
@jiejenn Жыл бұрын
@@wiseguy0106 in that case I don't think it is possible.
@keanacalise4414
@keanacalise4414 11 ай бұрын
I can't install open AI on vscode any suggestions?
@jiejenn
@jiejenn 11 ай бұрын
Why not?
@ABNS_
@ABNS_ Жыл бұрын
nice job , can you give me your theme name in vs code pls ?
@jiejenn
@jiejenn Жыл бұрын
I am using One Dark Pro theme extension with my own color customization. Send me an email at youtube@learndataanalysis.org and I can share my json setting if you are interested.
@ABNS_
@ABNS_ Жыл бұрын
@@jiejenn thanks men ! , I just loved the theme it looks satisfying for eyes ...good luck 🖤
@chebbifethi9694
@chebbifethi9694 Жыл бұрын
it work in android phone ???
@jiejenn
@jiejenn Жыл бұрын
Sure. Why not.
@RakibulIslam-lb4ne
@RakibulIslam-lb4ne Жыл бұрын
Getting authentication error. What I will do?
@jiejenn
@jiejenn Жыл бұрын
What does the error message say?
@Dabebe101
@Dabebe101 6 ай бұрын
Hi are you active on WhatsApp or any media I need to ask a question
ChatGPT Tutorial: How to Use Chat GPT For Beginners 2024
27:51
Charlie Chang
Рет қаралды 2,9 МЛН
YouTube's Biggest Mistake..
00:34
Stokes Twins
Рет қаралды 29 МЛН
Godzilla Attacks Brawl Stars!!!
00:39
Brawl Stars
Рет қаралды 9 МЛН
Top 8 AI Tools You Need To Use in 2024
10:37
Cash Mentor
Рет қаралды 6 М.
Has Generative AI Already Peaked? - Computerphile
12:48
Computerphile
Рет қаралды 150 М.
Master the Perfect ChatGPT Prompt Formula (in just 8 minutes)!
8:30
Don't Use ChatGPT Until You Watch This Video
13:40
Leila Gharani
Рет қаралды 1,4 МЛН
ChatGPT For Cybersecurity
40:03
HackerSploit
Рет қаралды 464 М.
32 ChatGPT Tips for Beginners in 2023! (Become a PRO!)
31:00
AI Foundations
Рет қаралды 1,1 МЛН