How to use the OpenAI API in Python

Поделиться
HTML-код
  • Опубликовано: 30 июл 2024
  • How do you create an API key for OpenAI's API and use the API in Python? You find exactly the answer to that and more in this video.
    We will look at text generation, chat completions, text-to-speech, speech-to-text and image generation and on the way write a chatbot you can talk with your voice and which will answer with its own voice and face.
    🙏 Support me: / kiecodes
    🛰 Join our Discord, to interact with other Coders and me: / discord
    🧠 Pick my brain: calendly.com/kiecodes/ai-cons...
    💻 Code: github.com/kiecodes/openai-ap...
    Check out my newest video: • How to use the OpenAI ...
    Timestamps:
    00:00 Intro
    00:51 Virtual Environment Setup
    03:00 Creating an OpenAI API key
    03:57 Chat completions and text generation
    06:32 Managing Chat Context
    07:29 Add Text-To-Speech
    08:26 Add Speech-To-Text
    10:22 Image Generation
    ---
    This video contains advertising content.
    ---
    Attribution:
    ■ Vides and Websites are properties of OpenAI
  • НаукаНаука

Комментарии • 13

  • @Liquidmsn64
    @Liquidmsn64 4 месяца назад

    When I type in the "response = client.chat.completions.create( model="gpt-3.5-turbo"," Its giving me a rate limit error. how can I get around this?

    • @KieCodes
      @KieCodes  4 месяца назад

      This happens if you are sending to many requests. Check your account on platform.openai.com there should be a list of all the rate limits you have and how much you have already used. There is also a way to ask openai to increase your rate limit.

  • @hsin-yusu9094
    @hsin-yusu9094 25 дней назад

    hi, I'm new, just have a little dumb question, what is "stream_to_file()" function doing here?
    is it used to reduce the waiting time of the audio response?

    • @KieCodes
      @KieCodes  25 дней назад +1

      Hey. There are no stupid questions. This is used to save the audio to a file to play it afterwards. The play function i use uses a file.

    • @hsin-yusu9094
      @hsin-yusu9094 25 дней назад

      @@KieCodes tysm, I'm a bit misunderstanding the official documentation.

  • @sohambhattacharjee951
    @sohambhattacharjee951 Месяц назад

    can anyone please guide me where can i explore the entire documentation in openai github? The readme file seems insufficient and incomplete or maybe i just find it difficult to follow.

    • @KieCodes
      @KieCodes  Месяц назад

      hey. you find the full documentation here: platform.openai.com/docs/api-reference/introduction
      On there you can switch the examples for all endpoints to python as well.

  • @masumasi
    @masumasi 5 месяцев назад +1

    Nice! This is a cool example. Can you show us a small app that can transcribe audio files?

    • @KieCodes
      @KieCodes  5 месяцев назад +2

      Thank you. I will put it on my list, but I also used the Whisper API for transcription in my Open AI Assistents video if you want to look into another example.

    • @masumasi
      @masumasi 5 месяцев назад +1

      @@KieCodes Ah yes. I will check it out. Thanks!

  • @heartbeatz34
    @heartbeatz34 5 месяцев назад

    How to generate text to ai image using python

    • @KieCodes
      @KieCodes  5 месяцев назад

      Hey. Thats the part of generating the image using dalle. What is your question?

  • @Zrizzy7
    @Zrizzy7 2 месяца назад

    pretty average tutorial