Google Gemini 2 API Crash Course In Python (Everything You Need To know To Get Started)

preview_player
Показать описание
With Gemini 2.0 two-million-token capacity, the model can work with extensive datasets, such as entire books, research papers, or detailed project documents, all in one interaction. And given that Gemini API is free right now, I thought I would share how to get started with Gemini API in Python.

💖 Show Support
☕ Venmo: @Jie-Jenn

00:00 - Intro to Google Gemini API
00:51 - Set up Gemini API in Google Console
01:29 - Generate an API key
02:17 - Install Python dependencies
02:43 - Set up .env file
03:48 - Example 1. Basic API usage
05:20 - Example 2. Include media files
07:15 - Example 3. Create a chat session
11:29 - Example 4. Chat session with function calling

#googlegemini #python #crashcourse
Рекомендации по теме
Комментарии
Автор

Can someone please explain to me the difference between import google.generativeai as genai and from google import as genai? From what I read, if you are using generativeai we are using the older models?

SirThomasR
Автор

Hi Jie. Can you take a look at the newest thinking models? There's a new Google AI SDK, and it seems they want to cancel Vertex?

from google import genai, and it has no "configure" parameter. It also does not allow base64encoded images to be sent like the google.generativeai sdk allowed. Can you do something similar to this, but with the new 2.0 Flash Thinking Exp model and the new genai SDK/API?

subashchandra