How to use ChatGPT API Python for Beginners - Full ChatBOT Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 พ.ย. 2024
  • In this video, we'll learn to build a ChatBOT using Python with ChatGPT API from OpenAI
    1. Learn how to get OpenAI Key Token
    2. Two different methods of using ChatGPT API in Python
    3. Building a Python ChatGPT ChatBOT with openai Python package
    4. Using ChatGPT API Completions End point
    5. How to change ChatGPT API Parameters like temperature
    6. Summary
    Code and Demo - github.com/amr...
    ❤️ If you want to support the channel ❤️
    Support here:
    Patreon - / 1littlecoder
    Ko-Fi - ko-fi.com/1lit...

ความคิดเห็น • 170

  • @1littlecoder
    @1littlecoder  9 หลายเดือนก่อน

    🚨BUY with 34% Discount on my new Generative AI Course - bit.ly/3HQXsQd 🎉Coupon Code - LETSGO 🎉

  • @MN-yz7bp
    @MN-yz7bp 5 หลายเดือนก่อน +4

    Great teacher. This is the best explanation for newbies that I've seen.

    • @1littlecoder
      @1littlecoder  5 หลายเดือนก่อน

      Glad it was helpful!

  • @iangouvea9671
    @iangouvea9671 9 หลายเดือนก่อน +5

    Nem todo Indiano, mas sempre um Indiano. Obrigado amigo, você é um amigo.

  • @ompathak3384
    @ompathak3384 9 หลายเดือนก่อน +4

    it shows error that my model quota limits exceeds😮‍💨

  • @neofuturist
    @neofuturist ปีที่แล้ว +2

    Commenting before even watching the video because I want to thank you for all your effort!!

  • @mariasueabiera8684
    @mariasueabiera8684 9 หลายเดือนก่อน +1

    Awesome tutorial especially for beginners

    • @1littlecoder
      @1littlecoder  9 หลายเดือนก่อน

      Glad it was helpful!

  • @jamges
    @jamges ปีที่แล้ว +5

    This is great! Would love to know how to chain API calls for Whisper and GPT together:
    For example:
    A Ui where a user speaks, whisper transcribers what they say , then their transcription is summarized/interpreted with a pre-made GPT prompt, and the user can see the summarized/remixed output?

  • @arashputata
    @arashputata ปีที่แล้ว +1

    Thanks bro for being so fast in announcing ai news. Already last night after ur video about chatgpt i jumped on it and made a quick chatbot

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว +1

      Keep it up, Thanks for sharing :)

  • @JunboKoh
    @JunboKoh ปีที่แล้ว +3

    Great tutorial for ChatGPT api. I really enjoy watching for your kind and clear teaching:)

  • @anshuman6623
    @anshuman6623 8 หลายเดือนก่อน

    Great video! Covered all the points it sought out to cover. Thumbs up!

  • @raidedcluster
    @raidedcluster ปีที่แล้ว +3

    Man I love your work. Thank you.

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว +1

      I really appreciate that :) Thanks for commenting!

  • @SurajSharma-bh9gf
    @SurajSharma-bh9gf ปีที่แล้ว +10

    The error is message": "You exceeded your current quota, please check your plan and billing details." not working please suggest

    • @alexisrioslopez5423
      @alexisrioslopez5423 ปีที่แล้ว

      you have some credit to do your works, now you need to recharge.

    • @billythebiest_9404
      @billythebiest_9404 9 หลายเดือนก่อน

      i have the same error but when i look into my openai account
      I still have credits.

    • @ujjwalsrivastava4581
      @ujjwalsrivastava4581 7 หลายเดือนก่อน

      Same error guys if anyone got the solution please tell me

    • @lazycoder112
      @lazycoder112 6 หลายเดือนก่อน

      If you still have credits prob because the request needs more credit then you have especially doing request with gpt 4

    • @ansar2137
      @ansar2137 4 หลายเดือนก่อน +1

      I was getting the same error, I just updated the limits and refreshed the site, it was then working for me. (I think what worked for me is I updated the monthly limit to a number less than my available credits, suppose If I had 10 credits, my monthly credit limit should be less than 10.) Hope this helps..

  • @Travestyalpha
    @Travestyalpha ปีที่แล้ว +1

    Thank you. Very clear explanation.

  • @danielnamatinia3810
    @danielnamatinia3810 20 วันที่ผ่านมา

    So obviously the second method is better. But I have two questions, Id like whoevers help.
    1. Is there a way with the endpoint method to also remember memory and past conversations? Do I just append the past message and responses to "messages" list of dicts
    2. Is there a better more efficient way to lower amount of tokens used? Because if every time you are sending information from before and the new message - thus it getting bigger and bigger.

  • @shreyashavaldar2076
    @shreyashavaldar2076 8 หลายเดือนก่อน

    Here is some more info:
    INFERENCE PARAMETERS:
    Temperature: Control randomness in Output, High temperature high randomness.
    Top_p: How many possibilities does the model considers when its giving its output.

  • @indreshkry4882
    @indreshkry4882 4 วันที่ผ่านมา

    What is the memory limit for first method? Does it work for extended context like large document generation through multiple iterations?

  • @mohammadawwad7832
    @mohammadawwad7832 ปีที่แล้ว +2

    Hello, very interesting and thanks for being extremely clear.
    A question regarding the Data privacy, using these API's will not register any of our data for training purposes right ?

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      Thank you. That's what OpenAI says.

  • @Kalease54
    @Kalease54 ปีที่แล้ว +7

    Excellent video as always. A few things I’m curious about though, using the API endpoint how would you retain chat history like you did using the While True loop? Also if building an application for multiple users how would you do it in such a way that the ChatGPTs memory is specific to a certain user?

    • @carlosprieto2554
      @carlosprieto2554 ปีที่แล้ว

      Same question

    • @1mrnewton
      @1mrnewton ปีที่แล้ว

      You’d need to always append your previous message and gpt response to the new request json body
      He explained in the video.

  • @ashishbhateja
    @ashishbhateja ปีที่แล้ว +9

    Very well timed and nicely explained. Wishlist : please share how to add langchain/gpt index/pinecone 🤞

  • @naveenkumar-ik8bx
    @naveenkumar-ik8bx หลายเดือนก่อน

    Very useful information. Thank you❤

    • @1littlecoder
      @1littlecoder  หลายเดือนก่อน

      Glad it was helpful!

  • @icontentacademy
    @icontentacademy ปีที่แล้ว +3

    You always put out some of the best content out on TH-cam. Thanks for sharing your knowledge of AI with the community!

  • @priyankjetani1508
    @priyankjetani1508 ปีที่แล้ว

    In the second method can we ask for a related question? likewise, if we ask the first Q. "who is the best chess player?" and the second Q. "he was lost any matches?

  • @HelenJackson-pq4nm
    @HelenJackson-pq4nm ปีที่แล้ว

    Really clear explanation, thanks a lot

  • @Analyse_US
    @Analyse_US ปีที่แล้ว +1

    Excellent tutorial as usual...super up to date content.

  • @SONUKOL1
    @SONUKOL1 ปีที่แล้ว +1

    Very knowledgeable content

  • @CARLOSFROMNY
    @CARLOSFROMNY ปีที่แล้ว +1

    thanks for your contribution, you the best!!

  • @stevezing9341
    @stevezing9341 ปีที่แล้ว +1

    Thank you so much, your tutorials are so helpful. Can you pls make a tutorial on how to fine tune this model. Let's say i want to provide the model with several documents. I want it to learn from it so that i can do QA on it.

  • @lyricsdepicted5628
    @lyricsdepicted5628 ปีที่แล้ว

    Now with control over temperature, you could repeat your hullicination querries with temperature of 0 and compare :)

  • @Leyverse
    @Leyverse ปีที่แล้ว +1

    Thank you so much, can you teach us how to integrate with whatsapp and telegram?

  • @highsobriety3491
    @highsobriety3491 ปีที่แล้ว

    Great teacher brother.

  • @satishverma-c1c
    @satishverma-c1c หลายเดือนก่อน

    appreciate your efforts

  • @DrR0bot
    @DrR0bot ปีที่แล้ว +1

    This is really good. Thanks so much for the thorough explanation. A question that perhaps you have already answered.
    Is there a way to fine tuned CHAT gpt let's say from content or text you have created? Like your thesis or something?
    Thanks

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      Not yet, but you can use embedding from a different model and use ChatGPT model for inference

  • @曾嘉才
    @曾嘉才 3 วันที่ผ่านมา +1

    video is so nice.

  • @sameerzahid3544
    @sameerzahid3544 ปีที่แล้ว

    Great work! Waiting for the tutorial about Gradio and ChatGPT.

  • @rahasyabharat4894
    @rahasyabharat4894 9 หลายเดือนก่อน +1

    Will you please help me where I put this code in which application i understand the whole method how to translate key from open AI and other but I am not able to understand in which application I have to put this all

  • @jurgenihlau4052
    @jurgenihlau4052 4 หลายเดือนก่อน

    Hello, very nicely explained. I have a small problem, maybe you can help me.
    I run a Linux Mint support forum (Linuxmintusers - LMU GER) with SMF software. In the first post of a support request, users often forget to include their system details so that we can help. How can I use the ChatGPT API, ChatGTP to check the first post to see if the information matches the question or not? Is that possible? Maybe you have an idea for us!
    Thank you!

  • @outsidemix3626
    @outsidemix3626 ปีที่แล้ว

    Thank you! Incredibly detailed and clear.

  • @Sergedable
    @Sergedable ปีที่แล้ว +1

    Great video. I'd be grateful if you made one. How can we fine-tune ChatGPT for our own data?

    • @arashputata
      @arashputata ปีที่แล้ว +1

      It's not possible to fine tune chatgpt.. also mentioned in the fine tuning section of the openai documentation

    • @spicer41282
      @spicer41282 ปีที่แล้ว

      You can do so by feeding your data via the message box! Limited as far as i know directly from ChatGPT itself.
      It can ingest your text data @ 4070 characters including spaces at a time.
      You want make sure your Prompts contains the file streams so ChatGPT knows its part of a larger text file greater than 4070 characters. Hope that helps.

  • @ujjalbaniya
    @ujjalbaniya ปีที่แล้ว

    simply adding a bool instead of infinite loop will make code more efficient.

    • @ujjalbaniya
      @ujjalbaniya ปีที่แล้ว

      x = True
      print("If you want to end the chat Please type END")
      while x:
      message = input("User : ")
      if "end" in message.lower():

  • @woo__ooow
    @woo__ooow ปีที่แล้ว +1

    Thank you so much for putting this together! -- Very helpful!
    One noob question: is it possible at this point of time to train chatGPT on your own data using their API?

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว +2

      Right now, Finetuning with ChatGPT model is not available

  • @tyler8902
    @tyler8902 ปีที่แล้ว

    Fantastic tutorial!

  • @markfrancisbeltran4619
    @markfrancisbeltran4619 ปีที่แล้ว

    Great video. You got me hook there and didn't even notice the time! I like how you well explained the topic. Hey you talked about building a chat interface... but I can't find your video. Can you link it here for me please.

  • @khushiagarwal7907
    @khushiagarwal7907 3 หลายเดือนก่อน

    uch a clear explanation!

  • @jnealeuk
    @jnealeuk ปีที่แล้ว

    How easy/hard (!) is it to embed these chatbots into a website? Thank you for your work!!

  • @lyricsdepicted5628
    @lyricsdepicted5628 ปีที่แล้ว

    Looks like for fine-tuning you can't make use of the 10x cheaper endpoint even though the model is the same.

  • @eugeneng1010
    @eugeneng1010 หลายเดือนก่อน +1

    Do i have to pay to get openai key? When i run it it says rateerrorlimit

  • @95249192
    @95249192 ปีที่แล้ว +1

    If possible, how to set up with gradio ?

  • @ashishmalhotra2230
    @ashishmalhotra2230 8 หลายเดือนก่อน

    Even with a new signup I am getting this message: "You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs". What to do?

    • @1littlecoder
      @1littlecoder  8 หลายเดือนก่อน

      I think you need to try with a new phone and a new email, probably the previous one's credits expired

    • @ashishmalhotra2230
      @ashishmalhotra2230 8 หลายเดือนก่อน

      @@1littlecoder Still doesnt work. New email, new phone, still doesnt

    • @ujjwalsrivastava4581
      @ujjwalsrivastava4581 7 หลายเดือนก่อน

      ​@@1littlecoderit is still not working please tell the solution

  • @ahmadzaimhilmi
    @ahmadzaimhilmi ปีที่แล้ว

    Using requests module, how do you reference a particular chat. Say the conversation about Gary Kasparov vs about something else? I saw there's a chat ID in the json response. How do you reference that?

  • @spicer41282
    @spicer41282 ปีที่แล้ว

    You are Always on the tip of this spear! 👌 👍 Look forward to your next gangbuster vid?
    How about a Mashup between this newAPI and ControlNet!
    Thoughts?

  • @roguephilosopher2465
    @roguephilosopher2465 11 หลายเดือนก่อน

    Very helpful!

    • @1littlecoder
      @1littlecoder  11 หลายเดือนก่อน

      Glad it was helpful!

  • @pratyushbhatt1712
    @pratyushbhatt1712 ปีที่แล้ว

    How does the second method maintains the context like the first method was maintaining?

  • @Brandon-uf4dt
    @Brandon-uf4dt 7 หลายเดือนก่อน

    Is there a way I can access public data from law books and add it to a personal chat gbt library?

  • @bhaidar
    @bhaidar ปีที่แล้ว

    Another question, where would you store the "messages" if you were doing a Web App?

  • @syedbabarali1
    @syedbabarali1 ปีที่แล้ว

    Thank you very nice way to guide! Could you assist me in creating a knowledge base and consuming the API in the C# language?

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      I think you should try this - th-cam.com/video/hYcKPzXh4D8/w-d-xo.html

  • @aniketkajania610
    @aniketkajania610 ปีที่แล้ว +5

    its the first time im using their api and im getting RateLimitError: saying that i have exceeded my quota

  • @yogaday4835
    @yogaday4835 ปีที่แล้ว

    thanks for the tutorial !!!

  • @dalisongwira1424
    @dalisongwira1424 ปีที่แล้ว +1

    wow you know how to explain

  • @Investwithwisdome
    @Investwithwisdome ปีที่แล้ว

    what should be my system requirements if i want to train openai to create a new Application.
    Can i do it in 8GB Ram & I5 10Generation Laptop ?

  • @zappy9880
    @zappy9880 ปีที่แล้ว +1

    Isn't the API paid? I can't get it without entering card info. how'd you get it?

  • @F.D.S
    @F.D.S ปีที่แล้ว

    Great!! Thank you!

  • @MuhammadYasir-uc9xt
    @MuhammadYasir-uc9xt 6 หลายเดือนก่อน

    I have a project in python language which is a Plan text editor. I want to integrate it with open AI using API for the some purposes which are content suggetions, vocabulary suggetions, spell checker, grammar checker. kindly help me with it.

  • @OrchidMacro
    @OrchidMacro ปีที่แล้ว

    That would be nice to add a functionality where you can insert a PDF.

  • @machinesmakemusic
    @machinesmakemusic ปีที่แล้ว

    Please make a video with method 1, but with more settings like temperature ! I would be so happy.

  • @CoBER-nc3el
    @CoBER-nc3el ปีที่แล้ว

    Hi there! Thanks for the video, its been very helpful, currently using it in a project im working on. I was wondering if you could tell me if paying for the api key gives faster response times... for chatgpt api? Would appreciate your response. At the moment im using the free trial.

    • @mihawk1096
      @mihawk1096 ปีที่แล้ว

      Can i ask how you got the free trail bcs im not able to use my api at all even though its my first time

    • @danieladam4719
      @danieladam4719 ปีที่แล้ว

      ​@@mihawk1096 OpenAI grants you an amount of 5 dollars when you first sign-up but it seems to expire after a few months. Found out today that my trial expired one month ago.

  • @maftar5
    @maftar5 5 หลายเดือนก่อน

    How do you add context with the api endpoint?

  • @harpreetchouhan1200
    @harpreetchouhan1200 ปีที่แล้ว +1

    Never used the api still showing this error "RateLimitError: You exceeded your current quota, please check your plan and billing details" any solution

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      I think you would have exceeded 3 months since your account creation.

  • @DjDiversant
    @DjDiversant ปีที่แล้ว

    Thank you!

  • @rodo2220
    @rodo2220 6 หลายเดือนก่อน

    great video

  • @rildodemarqui
    @rildodemarqui ปีที่แล้ว +2

    I've never used this API before, but even so I'm getting the message :"You exceeded your current quota, please check your plan and billing details."
    Somebody had this issue?

    • @riyaz8072
      @riyaz8072 ปีที่แล้ว +1

      Same issue.

    • @ecc3d452
      @ecc3d452 ปีที่แล้ว

      same

  • @Damnedindenial
    @Damnedindenial 4 หลายเดือนก่อน

    I am using a normal IDE, for my internship. how do I use this with a normal IDE. I don't get that helpful little box to type in and ask it questions

    • @1littlecoder
      @1littlecoder  4 หลายเดือนก่อน

      In a normal IDE you need to use with your API key

  • @alintambunaloko
    @alintambunaloko ปีที่แล้ว

    How to using the model in webApp like using flask

  • @PatnaikUC
    @PatnaikUC ปีที่แล้ว

    Excellent! Please make a Python code with ChatGPT API for robotic applications (Using Raspberry Pi) where the if the user input is any word out of 10 specific words saved, the response generated should be that word only which is then linked to the output. Example- "go left" input by the user. The robot moves left as the response it receives "go left" from ChatGPT through the API key

    • @tylermichaelbell
      @tylermichaelbell ปีที่แล้ว

      you may want to look at arduinos for that, but honestly, you could ask chatgpt to write this code and it'll get you 80 percent there. i dont know exactly what your application is for though, seems like chatgpt is an extra step that isnt needed. you could have chatgpt write a simple console application that moves per input.

  • @jasvinderkumar430
    @jasvinderkumar430 3 หลายเดือนก่อน +1

    I am always getting below error: No one giving solution of this error. even I have hit the 1 request with new api key.
    You exceeded your current quota, please check your plan and billing details. For more information on this error

    • @1littlecoder
      @1littlecoder  3 หลายเดือนก่อน

      you need to make sure you have got the credits / money in your account, see the daily spend limit as well

  • @Sensergaming
    @Sensergaming ปีที่แล้ว

    I want to know about youtube where we connect through API in Data studio

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      I'm sorry could you please elaborate?

  • @TimothyCarney-kk7kw
    @TimothyCarney-kk7kw ปีที่แล้ว

    Thanks!

  • @bhaidar
    @bhaidar ปีที่แล้ว

    Thanks for the excellent video. However, I was able to install openai on Google Colab, but when I try to set the key, it gives me errors.
    NameError Traceback (most recent call last)
    in
    ----> 1 openai.api_key = 'sk-...'
    NameError: name 'openai' is not defined

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      I think you didn't do pip install openai properly. If you had done that then you didn't import openai

    • @bhaidar
      @bhaidar ปีที่แล้ว

      @@1littlecoder I followed the sample code you provided. I installed openai, then added the key. I should import openai first to add the key?

  • @ColabPro-ho9sx
    @ColabPro-ho9sx 7 หลายเดือนก่อน

    my code doesn't work can you help me i copied your code but doesn’t work it

  • @PANDURANG99
    @PANDURANG99 10 หลายเดือนก่อน

    how to deploy for users?

  • @sambokhetwal
    @sambokhetwal 9 หลายเดือนก่อน

    Can we link chat got api with facebook graph api?

  • @TechTips_KishuNeelavara
    @TechTips_KishuNeelavara ปีที่แล้ว

    API key in freetrail is not working

  • @premprasad3511
    @premprasad3511 ปีที่แล้ว

    I just get this error : "You exceeded your current quota, please check your plan and billing details"
    This is the first time I am using it
    Can I know what should I do
    ?

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      It's possible you don't have any credits left. YOu might have to buy it

  • @tomtomfh3639
    @tomtomfh3639 ปีที่แล้ว

    yes

  • @debalinaghosh6404
    @debalinaghosh6404 ปีที่แล้ว

    can you help doing it in java?

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      Why so ?

    • @debalinaghosh6404
      @debalinaghosh6404 ปีที่แล้ว

      Hi, actually I have to do everything in java as my supervisors advised and I did in java. I have a question, can we give image inputs (like question in images) using API key of OpenAI@@1littlecoder

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      Hey, You can't give image as an input but there are certain ways you can take image and get a caption. / text out of it and then share it with this

  • @Aabdulnour01
    @Aabdulnour01 3 หลายเดือนก่อน

    does this still work?

  • @sharanbabu2001
    @sharanbabu2001 ปีที่แล้ว

    Cool!

  • @uvaisahmad2225
    @uvaisahmad2225 3 หลายเดือนก่อน

    Authentication error: no api key provided🙂

  • @athirashibu6089
    @athirashibu6089 ปีที่แล้ว

    reply = response["choices"][0]["message"]["content"]
    TypeError: 'NoneType' object is not subscriptable

    • @1littlecoder
      @1littlecoder  ปีที่แล้ว

      Was your request successful?

  • @ninasirsi2340
    @ninasirsi2340 10 หลายเดือนก่อน

    Where is next video

  • @theresilientpianist7114
    @theresilientpianist7114 ปีที่แล้ว

    Showing me rate limit error

  • @hitarthdesai0882
    @hitarthdesai0882 ปีที่แล้ว

    i have the error ssaying "You exceeded your current quota, please check your plan and billing details." and i haven't used it till now??
    please let me know

    • @hitarthdesai0882
      @hitarthdesai0882 ปีที่แล้ว

      i tried creating a new API key too but gives the same erroe

    • @SatSTAR0
      @SatSTAR0 ปีที่แล้ว

      same issue

  • @jdcrunchman999
    @jdcrunchman999 6 หลายเดือนก่อน

    Your video is blocking the code

  • @cybersecuritydivisionmanga955
    @cybersecuritydivisionmanga955 29 วันที่ผ่านมา

    20 minutes in AI era ? Too long ...

  • @himadridas8221
    @himadridas8221 ปีที่แล้ว

    I just hate the word...for beginners

    • @QWERTY-gp8fd
      @QWERTY-gp8fd ปีที่แล้ว

      why. everybody has to start somewhere. Perfection doesn't happen right away

  • @cybersecuritydivisionmanga955
    @cybersecuritydivisionmanga955 29 วันที่ผ่านมา

    too long for a beginning tutorial

  • @ibrahimnadeem1064
    @ibrahimnadeem1064 10 หลายเดือนก่อน

    I've tried numerous times this code each n every thing, but still showing an error