Это видео недоступно.
Сожалеем об этом.

Gemini AI API with Python Latest Tutorial

Поделиться
HTML-код
  • Опубликовано: 16 фев 2024
  • In this tutorial we will see how to use google's gemini ai api with python

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

  • @doch40
    @doch40 4 месяца назад +2

    Hi, thank you for your explanation. I have to upgrade my Python version from 3.8 to 3.10 because I got an error that said: "AttributeError: module 'google.generativeai' has no attribute 'GenerativeModel"

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

    Thanks for this 🙌. But is it free to use? or is there a limit which exceeds??

    • @unitedtoptech6288
      @unitedtoptech6288  5 месяцев назад +3

      As of now it is free to use and I didn't find any tab to know the usage also

  • @user-kt8vg4uq2n
    @user-kt8vg4uq2n 17 дней назад +1

    How do i give a different personality?
    Should i use the system message option?

    • @unitedtoptech6288
      @unitedtoptech6288  17 дней назад +1

      what do you mean by personality?

    • @user-kt8vg4uq2n
      @user-kt8vg4uq2n 17 дней назад +1

      I want to create an ai voice assistant. I have already done most of the logic. But my assistant lacks any humour, reply style and things like that. I want to give it a certain 'personality'. I want to model it like Jarvis from iron man movies, but with a bit more humour. Is there any way to do that ? Can we model it by editing its replies in the api webpage and using the code in python (I am using pycharm) ?
      Thanks for replying

    • @unitedtoptech6288
      @unitedtoptech6288  17 дней назад +1

      Yeah you can check if gemini api has an system message options or else you can just add it along with the input prompt or chat history saying it needs to be more humorous

    • @user-kt8vg4uq2n
      @user-kt8vg4uq2n 17 дней назад +1

      @@unitedtoptech6288 ok thank you so much. I have one more question, in the api, when we interact with the model, we can edit its response too. Does it have anything to do with moulding the personality ?

    • @unitedtoptech6288
      @unitedtoptech6288  17 дней назад +1

      Yeah maybe try giving different personalities of input prompts and choose the one you want and make sure that you add that specific input phrase with chat history

  • @livinglegend8009
    @livinglegend8009 2 месяца назад +1

    thanks so much. this video has been very helpful and easy to follow. And it works perfectly👍

  • @gagandeepsaini3926
    @gagandeepsaini3926 Месяц назад +1

    genai.configure(api_key=os.environ["my key shows here"])
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "", line 714, in __getitem__
    KeyError: 'my key shows here'
    i got this type of key error

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

      You need to add your api key in that "your key shows here" placeholder

  • @ghostwavewrider
    @ghostwavewrider 3 месяца назад

    So this example works for 1 article that returns that article via a command prompt. Does anyone want to share some code that would loop through a list of prompts and generate many articles in txt files? Or, how else would you use this?

    • @unitedtoptech6288
      @unitedtoptech6288  3 месяца назад +1

      So you mean you want to input multiple times till you say stop? You can use an infinite while loop in python and terminate it based upon your input

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

    how does the chat history get saved? or do we have to add it manually?

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

      You need to add it manually, check the documentation you will have code for that too

  • @ajeethkumar6296
    @ajeethkumar6296 3 месяца назад

    Does it support the image also like uploading the xray image to describe it

    • @unitedtoptech6288
      @unitedtoptech6288  3 месяца назад

      You need to use gemini pro vision model for that with input image

  • @samarthamj4619
    @samarthamj4619 Месяц назад +1

    Hello there, I am getting KeyError(key) in the API key line

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

      Did you add the key ?

    • @VaitheeswaranGiriraj
      @VaitheeswaranGiriraj 28 дней назад

      @@unitedtoptech6288 I do get the same. Yes, I added the key. If you found out, please share.

    • @samarthamj4619
      @samarthamj4619 28 дней назад +2

      Yes I added the key and tried many times, I was getting the same error and hence shifted to openai which worked fine.

    • @VaitheeswaranGiriraj
      @VaitheeswaranGiriraj 28 дней назад

      @@samarthamj4619 Remove os.env. Give api key straight away

    • @unitedtoptech6288
      @unitedtoptech6288  28 дней назад

      did you try it?

  • @fiorellademedina8419
    @fiorellademedina8419 4 месяца назад +1

    how can u run the program? the thing is it doesnt print me anything when i run it, why is that?

  • @user-pt1vv9db5p
    @user-pt1vv9db5p 2 месяца назад

    How much is the maximum usage or maximum range?

  • @justnowi8967
    @justnowi8967 3 месяца назад

    Please help me. I'm doing everything as shown but in vs code i dont get the output i want it keeps saying, YOUR_RESPONSE_TEXT.
    I have changed the convo.send.message to what i want ("what is meaning of ai").
    It should answer this prompt but it doesn't it keeps saying YOUR_RESPONSE and YOUR_MODEL_OUTPUT. it's not answering any prompt i fill there. Please please help.
    I have copied as it is code from Google in python (vscode) and also the api key is perfectly generated and inserted.

    • @unitedtoptech6288
      @unitedtoptech6288  3 месяца назад

      can you please paste your code?

    • @justnowi8967
      @justnowi8967 3 месяца назад +1

      @@unitedtoptech6288 I'm glad you replied. But thanks to Gemini itself, I could find the problem and the program is perfectly working! Thanks a lot for your video it was very helpful and clear concise. Keep creating this informative ai related videos thx again

    • @unitedtoptech6288
      @unitedtoptech6288  3 месяца назад

      Glad it worked for you!! Thanks for your nice words

    • @howtodoseo7579
      @howtodoseo7579 3 месяца назад

      Did you install 'pip' and/or create the api from the gemini panel? I would start by creating a new api key and installing the pip package mentioned in the video.

    • @unitedtoptech6288
      @unitedtoptech6288  3 месяца назад

      You mean pyton pip? it gets auto installed whenever you install python

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

    Thereafter this, how do we go around modifying the chatbot to our needs

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

      just plug it with frontend and get prompts or with any other backend code but this is the base

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

    How can you use this on Google cloud Run?

  • @surendra_guna
    @surendra_guna 3 дня назад

    google's gemini ai api with java spring boot. i structed to add which dependency in my project

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

    Please tell me how long will it works properly for free

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

    Hello Bro, I need to store the chat session and use it like a bot, can you help me how can I do that

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

      You mean you want to store the previous chat history too?

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

      @@unitedtoptech6288 yes rite, and want to make this as a chatbot

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

      Search for chat history in the documentation, you just need to add the pervious questions and answers to that list, for making it as a chat bot you can just have an infinite while loop with some terminating condition

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

    Which python version you have

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

      I guess I used 3.10

    • @user-yp6fy6cd9c
      @user-yp6fy6cd9c 4 месяца назад

      @@unitedtoptech6288 its not working from my side I use 3.9.5, do I have to update my python version?

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

      Yeah try using a 3.10 or 3.11 version, btw what error are you getting?

  • @cyberskul
    @cyberskul 3 месяца назад

    When i run it in the terminal it is showing
    genai.configure(api_key=os.environ["AIzaSyAu1YlUXLGxNYxFNl0kiNDCHYt9-OgQSSs"])
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "", line 685, in __getitem__
    KeyError: 'AIzaSyAu1YlUXLGxNYxFNl0kiNDCHYt9-OgQSSs'

    • @unitedtoptech6288
      @unitedtoptech6288  3 месяца назад

      The way you have added your API key is wrong, just assign it to the api_key variable

    • @cyberskul
      @cyberskul 3 месяца назад

      @@unitedtoptech6288 How will i do that?

    • @unitedtoptech6288
      @unitedtoptech6288  3 месяца назад

      You want to use the api key in env variable or directly assign?

    • @cyberskul
      @cyberskul 3 месяца назад

      @@unitedtoptech6288 Directly assign

    • @unitedtoptech6288
      @unitedtoptech6288  3 месяца назад

      i have done that in the video

  • @Ahmed--Hany
    @Ahmed--Hany 5 месяцев назад +1

    thanks bro❤

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

    can you do a tutorial on how to send images to it

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

    Where can i get code???

  • @somerandomdude-hoyeaaaaa
    @somerandomdude-hoyeaaaaa Месяц назад

    This free as of today?

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

    Thank you lol

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

    Is this free?