How to use the ChatGPT API with Python!!

Поділитися
Вставка
  • Опубліковано 5 бер 2023
  • 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 UA-cam50 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
  • Наука та технологія

КОМЕНТАРІ • 166

  • @generichuman_
    @generichuman_ Рік тому +125

    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
      @pratikbawane997 Рік тому +2

      Hi there! Can you tell me how to add streaming as you said above?!

    • @Ultimate-pb8hl
      @Ultimate-pb8hl 11 місяців тому

      does this include getting responses like "permissions denied"?

    • @ULTRA5364
      @ULTRA5364 5 місяців тому

      Awesome!

  • @KSATica
    @KSATica Рік тому +49

    ChatGPT has been AMAZING the experience for me was priceless

  • @rayaneghilene5152
    @rayaneghilene5152 Рік тому +14

    You re a lifesaver, I’ll be using it for my school project thanks 🙌

  • @eliedabelly3804
    @eliedabelly3804 Рік тому +12

    I love how these videos - so short and direct it makes it so much simpler to follow thank you 🙏

    • @borntodoit8744
      @borntodoit8744 Рік тому

      Is called dumbing it down for the masses.
      everyone thinks they are an expert till they hit a basic problem...

  • @n-0-1
    @n-0-1 Рік тому +25

    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
      @borntodoit8744 3 місяці тому

      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

  • @Fghhhg8883
    @Fghhhg8883 Рік тому +69

    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
      @NicholasRenotte  Рік тому +5

      Anytime @Yrgen! Got some plans to do more content around it!

    • @RaviKant-ll6ck
      @RaviKant-ll6ck 8 місяців тому

      Turnitin will catch the content generated by AI.

  • @Eric-demonic_saint
    @Eric-demonic_saint Рік тому +1

    Awesome 😎 Thank you for sharing with us❤

  • @ozgurgulerx
    @ozgurgulerx Рік тому +9

    Hey Nicolas, enjoying your content! You are an inspiration! Just curious which final cut effect plugins you use? They make videos quiet enjoyable.

    • @NicholasRenotte
      @NicholasRenotte  Рік тому +5

      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

  • @hiTocopter
    @hiTocopter 29 днів тому +3

    What do you mean recently? The API has been available for years...

  • @pavankumarsettem1834
    @pavankumarsettem1834 Рік тому +5

    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
      @NicholasRenotte  Рік тому +1

      You got it!

    • @settempavan9744
      @settempavan9744 Рік тому +2

      Can you make a video on explainability in ML models such as visualisation techniques in CNN and more

  • @binodmalaka4508
    @binodmalaka4508 Рік тому

    Thanks mate 🤍

  • @saishireesha2588
    @saishireesha2588 3 місяці тому

    Nice vlog ❣️Kannayya while seeing in mobile be like Enti nenu intha cute ga vunna 😊😅

  • @TerryLewisVideos
    @TerryLewisVideos Рік тому +1

    Nice, thanks.

  • @jhemp8446
    @jhemp8446 Рік тому

    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
      @BigBoss-sm9xj Рік тому

      Do you think it's worth the price?

    • @jhemp8446
      @jhemp8446 Рік тому +1

      @@BigBoss-sm9xj a better question to ask, does it pay for itself and the answer is yes.

  • @MG-ih6po
    @MG-ih6po Рік тому

    for the content, to make it more dynamic, have the user supply the prompt as a command line argument.

    • @borntodoit8744
      @borntodoit8744 Рік тому

      is a programmatic example to show the open api
      not to show a scripting example for other usecases

  • @jerbky
    @jerbky Рік тому

    Hey nic can you do a stock market (of your choice) data analysis

  • @akhilprazapati6148
    @akhilprazapati6148 11 місяців тому

    Any full screen video for this please... Or any other source for this...

  • @anshulbisht1350
    @anshulbisht1350 5 місяців тому

    How many such requests can be made? Is there some limits in your plus subscription?

  • @DarrenTarmey
    @DarrenTarmey Рік тому

    How does the results compaire to use gui connected to API or using the web app or in browser

  • @noviccen388
    @noviccen388 Рік тому +1

    how much the pricing?

  • @user-ll3xd5dy3f
    @user-ll3xd5dy3f 7 місяців тому

    What dependencies do I have to install before running this code?

  • @soccerfooty2012
    @soccerfooty2012 3 місяці тому

    What is the benefit of using this instead of the default chat gpt webiste?

  • @PassingTheDog
    @PassingTheDog Рік тому +1

    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
      @NicholasRenotte  Рік тому

      What's the limit in the web version? It generated a whole page for me this morning!

    • @PassingTheDog
      @PassingTheDog Рік тому +1

      @@NicholasRenotte It was like 4k characters. But I guess that now with the paid version it depends of the budget :')

    • @ko-Daegu
      @ko-Daegu Рік тому +1

      That’s has to do with the mode 4k token is the gpt4 limit (I heard they will release a 32k token limit )

  • @NicoleSummer8
    @NicoleSummer8 5 місяців тому

    Awesome ❤👍💪👏😄

  • @Compguy321
    @Compguy321 6 місяців тому

    Can you share how to get just the output, and not the rest of the object?

  • @NicholasRenotte
    @NicholasRenotte  Рік тому +5

    Damn 😅 Gotta work out better placement for the keyboard cam.

    • @NicholasRenotte
      @NicholasRenotte  Рік тому +3

      Also, lmk if any of you are coming to the forum I mentioned on LinkedIn! Would love to grab coffee with y'all!!

    • @ahmadelmassalkhi
      @ahmadelmassalkhi 6 місяців тому

      i dont get the .ChatCompletion method
      i get .completion

  • @flexhshadow1990
    @flexhshadow1990 Рік тому +1

    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

  • @gutsjoestar7450
    @gutsjoestar7450 Рік тому

    what is the purpose of asking chatgpt questions in vscode

  • @izaanmohammed3589
    @izaanmohammed3589 6 місяців тому +1

    Do we need a chatgpt acount

  • @big_bits
    @big_bits Рік тому +7

    How does this work with continuity between messages?

    • @vikashmaurya2679
      @vikashmaurya2679 Рік тому

      You need to store it, you can store it temporarily in a list and that way you can maintain continuity

  • @thespringer4257
    @thespringer4257 11 місяців тому

    It's using GPT3.5 turbo, how do you use GPT4 instead?

  • @czar82ro
    @czar82ro Рік тому

    Nice

  • @josejose-je6xu
    @josejose-je6xu 6 місяців тому

    Cool man

  • @ninefour11
    @ninefour11 Рік тому +1

    is this script working without openai api key?

  • @RootiRBLX
    @RootiRBLX 2 дні тому

    Website or app name??

  • @youtubercell9112
    @youtubercell9112 8 місяців тому

    Would have to pay tho?

  • @cheaterflex3532
    @cheaterflex3532 Рік тому +1

    This good content

  • @user-ej3oe2cx6k
    @user-ej3oe2cx6k Рік тому

    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

  • @trisha8066
    @trisha8066 Рік тому

    I am trying to install openai to my file in visual studio code but its not working what do i do

  • @omar7613
    @omar7613 Рік тому +2

    AWESOME

    • @NicholasRenotte
      @NicholasRenotte  Рік тому +1

      Cheers Omar!

    • @omar7613
      @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.

  • @jenniarlet13
    @jenniarlet13 5 місяців тому +2

    How can I feed it data to build a custom trained model ?

    • @ULTRA5364
      @ULTRA5364 5 місяців тому

      That's a good question!

  • @JassyMon-wn4eh
    @JassyMon-wn4eh 4 місяці тому

    Can you pls do the same for llama 2

  • @curesnow6493
    @curesnow6493 5 місяців тому

    Is it free to use open ai APIs?

  • @harshlakhani4171
    @harshlakhani4171 Рік тому

    Is there a way to use ChatGPT 4 on this?

  • @circuitcoder
    @circuitcoder Рік тому +1

    Wait, I think this is actually pretty useful... * looks at Alexa echo dot * hehehehehe

    • @circuitcoder
      @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

  • @manav-khadka
    @manav-khadka Рік тому

    hey nicholas please made video on kaggle

  • @CoBER-nc3el
    @CoBER-nc3el Рік тому

    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
      @naitikjain9292 Рік тому +1

      I think you cannot use this without paying, not sure tho

  • @erickmacias5153
    @erickmacias5153 Рік тому +2

    Can you make videos about fine tunning, and semantic search using gpt?🥺

  • @CoconutPete
    @CoconutPete Рік тому

    I'd like to see a simple example with PHP. I tried a month ago it never worked

  • @nathanb2984
    @nathanb2984 Рік тому

    How about image detection for onscreen images and algo? 😅😂

  • @user-uy7kr5zq5s
    @user-uy7kr5zq5s 8 місяців тому +1

    barack obama?!

  • @ahmedmeftah731
    @ahmedmeftah731 Рік тому +11

    you can litterly make an ai app that just runs chatgpt

    • @ahmedmeftah731
      @ahmedmeftah731 8 місяців тому +1

      @noobody. no no, I mean an interface that works via ChatGPT-API

  • @mayanksharma6622
    @mayanksharma6622 9 місяців тому

    Will it give me the gpt4 answers?

  • @miname.1802
    @miname.1802 Рік тому +2

    this scares me a lot Nick

  • @CAGonRiv
    @CAGonRiv Рік тому +1

    Eerie how time and time again that we align our projects lmfao

    • @NicholasRenotte
      @NicholasRenotte  Рік тому

      I posted on LinkedIn about an integration I built with it. I am getting slammmed with work now 😂

  • @gianmarcoguarnier2525
    @gianmarcoguarnier2525 Рік тому +1

    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
      @NicholasRenotte  Рік тому +1

      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
      @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!

  • @jensontmathew1584
    @jensontmathew1584 6 місяців тому

    Can we use this to create chatbot? I am a noob to this field. Please answer anyone... 😊

  • @CDWRR
    @CDWRR 5 місяців тому

    ChatCompletion line is not working properly

  • @mahdiabbasinourabadi8554
    @mahdiabbasinourabadi8554 Рік тому

    BOOOM

  • @rohitchanda8461
    @rohitchanda8461 5 місяців тому

    Public API?

  • @yusuffbb
    @yusuffbb Рік тому

    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
      @karim7658 Рік тому +1

      It's a local module he created himself to store his APIKEY I believe.

  • @sapyoahtml330
    @sapyoahtml330 10 місяців тому

    it says no moduled name openai

  • @noahbuscuse5243
    @noahbuscuse5243 Рік тому

    Why would I do this over using the playground

  • @nikosnikos-fk6ct
    @nikosnikos-fk6ct 10 місяців тому

    were is the dicreption

  • @user-lz3cz2zc4w
    @user-lz3cz2zc4w Рік тому +1

    Ты не пробовал из какой нибудь локальной модели которая полностью доступна в общем доступе, сделать чат?

    • @NicholasRenotte
      @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
      @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??

  • @way2on
    @way2on Рік тому +1

    chatgpt helped me try random generation of api keys until it works and now i have free chatgpt

    • @NicholasRenotte
      @NicholasRenotte  Рік тому

      LOL fr?

    • @way2on
      @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

  • @randomstuffty
    @randomstuffty 9 місяців тому

    where's code

  • @aadityasahoo6244
    @aadityasahoo6244 Рік тому +1

    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

  • @johnabe1730
    @johnabe1730 2 місяці тому

    Do we need to generate a key from the open Ai website?

  • @jessicabrus6549
    @jessicabrus6549 9 місяців тому

    I need help

  • @tejastidake6897
    @tejastidake6897 9 місяців тому +1

    Is the API free?

  • @ahmedsherif6195
    @ahmedsherif6195 Рік тому

    0:00

  • @kilianlindberg
    @kilianlindberg 9 місяців тому

    only 5-6 month ago.. it was that recently🤔🤓

  • @kayodeolanrewaju5459
    @kayodeolanrewaju5459 Рік тому +1

    would you need internet connection before it generates the output or it does it like that

  • @yanivkovler4056
    @yanivkovler4056 7 місяців тому

    Why not just use chatgpt promptline?

  • @FitVerse-oc8vy
    @FitVerse-oc8vy 9 місяців тому +1

    hello me to developer and ı have an question; what is gpt-4 engine name

  • @sivasaran_s
    @sivasaran_s 4 місяці тому

    Not working

  • @youssefultr
    @youssefultr Рік тому +1

    it says You exceeded your current quota, please check your plan and billing details
    you are so lucky you got it for free man

  • @HafsaHareem-in4vu
    @HafsaHareem-in4vu Рік тому

    Is there any method to take user input as message?

    • @Reficul999
      @Reficul999 Рік тому +2

      U can create a tkinter and use an Entry

    • @crossses
      @crossses Рік тому +1

      Yeah easily so put this content: input("What is your proompt?")

  • @abetterfuture4787
    @abetterfuture4787 Рік тому

    "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?

  • @mukithasan9684
    @mukithasan9684 3 місяці тому

    Is there anyway to get an api for free use for learning ?

  • @fin1225
    @fin1225 Рік тому

    There will be a leck of programming job's in the future better start with electrical engineering.

    • @Yazan_Majdalawi
      @Yazan_Majdalawi Рік тому

      That'll be affected as well, not that much further from programming jobs

  • @imadbenmadi
    @imadbenmadi 11 місяців тому

    is this Api is free

  • @janarthanan1716
    @janarthanan1716 2 місяці тому

    Bro how to buy api keys in open ai

    • @Ts18762
      @Ts18762 14 днів тому

      You can get the free credit and can generate one without buying

  • @parallellinesmeetatinfinity
    @parallellinesmeetatinfinity Рік тому +1

    This man have Something wrong in his Neck 😢😢😢😢😅

  • @whitedevilcreations5676
    @whitedevilcreations5676 5 місяців тому

    How to get API key ?

  • @JakubSK
    @JakubSK Рік тому +1

    You don’t

  • @nikosnikos-fk6ct
    @nikosnikos-fk6ct 10 місяців тому

    how to make Minecraft in python import Minecraft run yay

  • @preetpatel292
    @preetpatel292 Рік тому +1

    I would rather use ChatGPT to ask it how to use ChatpGPT APIs 🤭

  • @LordDSP3
    @LordDSP3 7 місяців тому

    I'm keep getting error that api is invalid or exhausted quota... Is it paid?

    • @tusharrao74
      @tusharrao74 7 місяців тому

      It used to be free but it's paid now

    • @LordDSP3
      @LordDSP3 7 місяців тому

      @@tusharrao74 that's sad, you know any api / model / lib to make a simple chat bot

    • @alangiovannysanchez5368
      @alangiovannysanchez5368 5 місяців тому

      I had the same issue. Bit of a bummer it's no longer free.

  • @antongromek4180
    @antongromek4180 Рік тому

    Nowadays they need computers to say absolutely nothing?🤯

  • @OkiDoki181818
    @OkiDoki181818 Рік тому

    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

  • @xBaphometHx
    @xBaphometHx Рік тому +1

    Is this the pay to use API?

  • @13deshmukhayaancoa93
    @13deshmukhayaancoa93 4 місяці тому

    Is this free?

  • @lifewithG-bengs
    @lifewithG-bengs Рік тому +1

    Is it free or paid?

    • @NicholasRenotte
      @NicholasRenotte  Рік тому

      This one is paid @Ogunkoya! It seems pretty reasonable though $2 per million words.

    • @chevvvv
      @chevvvv Рік тому +1

      @@NicholasRenotte how do I start this? And where can I get an API key?

  • @aniakaleta101
    @aniakaleta101 8 місяців тому +1

    does this guy get on your nerves or is it just me

  • @TLM-Nathan
    @TLM-Nathan 9 місяців тому

    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
      @Eddyi1 9 місяців тому

      wtf. This can be used to automatize a lot of processes.

  • @isumitd9586
    @isumitd9586 3 місяці тому

    Dont know anything about it

  • @Eddie-gb3bn
    @Eddie-gb3bn 3 місяці тому

    What’s the point of this, why not just use the GUI?

  • @seekyboi23
    @seekyboi23 Рік тому

    This is not a ChatGPT