Google GenAI SDK
The unified
google-genaiPython/JS SDK for calling Gemini and other GenAI models across both the Gemini Developer API and Vertex AI with a single client. · Official docs
Related concepts
- Getting Started · Gemini Capabilities · Prompt Engineering · Function Calling & Tools · Agents & ADK · Agent Engine · RAG & Grounding · Vertex AI Search · Embeddings & Vector Search · Vision · Audio & Speech · Multimodal Live API · Image & Video Generation · Evaluation · Tuning & Customization · Open & Partner Models · Responsible AI · MLOps & Deployment · Applied Use Cases
Used in 137 notebooks
Agents & ADK (11)
- Get started with Memory Bank on ADK — Build ADK agents that generate, retrieve, preload, and customize Agent Engine Memory Bank memories.
- Building a Multimodal Trip Planner with ADK on Vertex AI Agent Engine Memory Bank — Builds and deploys a multimodal ADK trip planner using Vertex AI Agent Engine Memory Bank.
- Get started with A2A on Agent Engine — Builds, deploys, and queries an A2A Q&A agent on Vertex AI Agent Engine.
- Deploy your containerized agent on Agent Runtime (prev. Agent Engine) — Deploys a BYOC ADK weather agent to Agent Runtime and queries it through the Vertex AI API.
- Get started with Code Execution on Vertex AI Agent Engine — Runs LLM-generated Python securely with Vertex AI Agent Engine Sandbox and ADK agents.
- Getting Started with Live API on Agent Engine — Deploys bidirectional streaming agents on Vertex AI Agent Engine using Gemini Live API audio and ADK tools.
- MCP on Vertex AI Agent Engine with custom installation scripts — Deploys a Reddit MCP tool agent to Vertex AI Agent Engine with custom install scripts.
- Building multi-agent systems with Vertex AI and Claude — Builds a Vertex AI Agent Engine multi-agent market analysis system with Gemini, Claude, ADK, A2A, and MCP.
- Building Multi-Agent Systems with Vertex AI and Llama model — Builds a traced Vertex AI multi-agent trading analyst with Gemini, Llama, ADK, A2A, and MCP tools.
- Get started with Sessions and Memory Bank for ADK agents in Cloud Run — Builds an ADK weather agent with Vertex AI Sessions, Memory Bank, and Cloud Run deployment.
- Intro to Managed Agents API on Agent Platform (Python) — Shows how to create, inspect, interact with, and delete Managed Agents with google-genai.
Audio (5)
- Lyria 3 Music Generation — Generates Lyria 3 music tracks, clips, lyrics, and streams with the Google Gen AI SDK.
- Gemini 3.1 Flash Text-to-Speech Generation — Shows Gemini 3.1 Flash TTS generation with voices, languages, speakers, and audio tags.
- Get started with Gemini-TTS voices using Text-to-Speech — Synthesizes Gemini-TTS speech with Cloud Text-to-Speech and Agent Platform APIs.
- Create a Multi-Speaker Podcast with Gemini 2.0 & Text-to-Speech — Generates a two-speaker podcast from a PDF using Gemini JSON output and Text-to-Speech MP3 synthesis.
- Narrate a Multi-character Story with Gemini and Text-to-Speech — Generates a Gemini play script and narrates it with distinct Text-to-Speech voices per character.
Embeddings & Vector Search (7)
- 🛡️ AI Brand Safety: Three-Tier Agent Anomaly Detection — Builds ADK agent anomaly detection with Gemini baselines, Vector Search scoring, and tiered audits.
- Visualizing embedding similarity from text documents using t-SNE plots — Embeds 20 Newsgroups text with gemini-embedding-001 and visualizes similarity clusters using t-SNE.
- Combining Semantic & Keyword Search: A Hybrid Search Tutorial with Agent Platform Vector Search — Builds sparse and hybrid Vector Search indexes for Google Merch Shop product search.
- Getting Started with Text Embeddings + Agent Platform Vector Search — Builds text embeddings from Stack Overflow titles and serves semantic search with Vector Search.
- Introduction to Gemini Multimodal Embeddings — Generates Gemini multimodal embeddings and applies them to search, similarity, PDFs, and RAG.
- Handling large-scale embedding generation for Agent Platform Vector Search — Generates large-scale text and image embeddings for Agent Platform Vector Search with throttling and checkpointing.
- Using “task type” embeddings for improving RAG search quality — Shows how task-type embeddings improve RAG Q&A retrieval quality and MRR.
Gemini (100)
- Get started with Vertex AI Memory Bank - ADK — Builds an ADK agent with Vertex AI Memory Bank for long-term user memory across sessions.
- Function Calling Agent — Builds a Gemini function-calling retail assistant over Cymbal Retail data in BigQuery.
- Guardrail Classifier Agent — Builds a LangGraph guardrail classifier agent for Cymbal retail chat using Gemini on Vertex AI.
- Semantic Router Agent — Builds a LangGraph semantic router that sends retail queries to mocked Gemini expert assistants.
- Task Planner Agent — Builds a LangGraph task-planner agent that plans, searches with Gemini, reflects, and responds.
- Intro to Batch Inference with the Gemini API — Runs Gemini batch inference jobs using Cloud Storage and BigQuery inputs and outputs.
- Using OpenAI libraries with Gemini on Vertex AI — Calls Gemini on Vertex AI through OpenAI Chat Completions with streaming, tools, schemas, caching, and safety.
- Intro to Gemini Agentic Vision — Uses Gemini code execution for agentic vision tasks: zooming, plotting, and image annotation.
- Intro to Generating and Executing Python Code with Gemini 3 — Uses Gemini 3.5 Flash code execution to generate, run, inspect, and stream Python results via Vertex AI.
- Intro to Computer Use with Gemini — Builds a Gemini Computer Use browser agent loop with Playwright and screenshots.
- Intro to Context Caching with the Gemini API — Shows implicit and explicit context caching for Gemini in Vertex AI with the Google Gen AI SDK.
- Intro to Structured Output with the Gemini API — Shows how to make Gemini 2.5 Flash return JSON, enums, and schema-constrained multimodal outputs.
- Introduction to Gemini Deep Research Agent — Shows how to run Gemini Deep Research Agent with streaming, multimodal input/output, and grounding tools.
- Create & Deploy Agent and Run Gen AI Agent Evaluation — Creates, deploys, runs, and evaluates an ecommerce ADK agent on Vertex AI Agent Engine.
- Create a Gen AI Agent Evaluation for a Deployed Agent — Runs inference and creates a persisted Gen AI Agent Evaluation for a deployed Vertex AI agent.
- Bring-Your-Own-Autorater using CustomMetric — Evaluates Gemini prompts with a client-side CustomMetric and a BYO Gemini autorater.
- Enhancing quality and explainability with Vertex AI Evaluation — Ranks Gemini answers with Vertex AI pairwise and pointwise evaluation explanations.
- Evaluate your autorater with meta-evaluation — Meta-evaluates Gemini autoraters on RewardBench with agreement and correlation metrics.
- Evaluate Generative Model Tool Use — Evaluates Gemini function calling and saved tool-call predictions with Vertex AI EvalTask metrics.
- Evaluating multimodal task — Evaluates image-grounded car damage labels with Vertex AI EvalTask and a Gemini custom autorater.
- Evaluating prompts at scale with Gemini Batch Prediction API — Evaluates Gemini image-classification prompts at scale with Batch Prediction and BigQuery.
- Evaluate and Optimize Prompt Template Design for Better Results — Compares Gemini prompt templates using Vertex AI EvalTask metrics to choose the best summarization prompt.
- Evaluate Gemini Structured Output — Evaluates Gemini structured JSON extraction from scanned order forms with Vertex AI Gen AI Evaluation.
- Evaluate your ADK agent using Vertex AI Gen AI Evaluation service — Evaluates an ADK product research agent with Vertex AI Gen AI Evaluation metrics.
- View Gen AI Agent Evaluation Run Results — Retrieves a Vertex AI Gen AI evaluation run and displays its embedded report.
- Forced Function Calling with Tool Configurations in Gemini — Shows how to force, allow, or disable Gemini function calls with tool configurations.
- Working with Data Structures and Schemas in Gemini Function Calling — Shows how to extract structured function-call arguments from Gemini using simple, array, and nested schemas.
- Intro to Function Calling with the Gemini API & Python SDK — Introduces Gemini function calling in Vertex AI with chat tools, mock API responses, and live geocoding.
- Multimodal Function Calling with the Gemini API & Python SDK — Shows Gemini multimodal function calling with images, video, audio, PDFs, and chat using Google Gen AI SDK.
- Working with Parallel Function Calls and Multiple Function Responses in Gemini — Shows how Gemini returns and handles parallel function calls with Wikipedia lookup tools.
- Intro to Gemini 2.5 Flash — Introduces Gemini 2.5 Flash on Vertex AI with text, thinking, multimodal, tools, and structured output.
- Intro to Gemini 2.5 Flash-Lite — Introduces Gemini 2.5 Flash-Lite on Vertex AI with prompting, thinking, structured output, search, and code tools.
- Gemini 2.5 Flash Image (Nano Banana 🍌) Generation — Generates and edits images with Gemini 2.5 Flash Image using the Google Gen AI SDK on Agent Platform.
- Intro to Gemini 2.5 Pro — Introduces Gemini 2.5 Pro on Vertex AI using the Google Gen AI SDK for text, multimodal, tools, and reasoning.
- Gemini 3.1 Flash Image (Nano Banana 2 🍌) Generation — Shows Gemini 3.1 Flash Image generation, grounding, video input, and image editing with Google Gen AI SDK.
- Intro to Gemini 3.1 Flash-Lite — Quickstart for Gemini 3.1 Flash-Lite with Google Gen AI SDK on Google Cloud.
- Intro to Gemini 3.1 Pro — Quickstart for Gemini 3.1 Pro on Vertex AI with Google Gen AI SDK API features.
- Intro to Gemini 3.5 Flash — Quickstart for Gemini 3.5 Flash generation, multimodal inputs, tools, grounding, and safety with Google GenAI SDK.
- Intro to Gemini 3 Flash (Preview) — Quickstart for Gemini 3 Flash Preview on Vertex AI with Gen AI SDK features and multimodal/tool examples.
- Gemini 3 Pro Image (Nano Banana Pro 🍌) Generation — Shows how to generate and edit images with Gemini 3 Pro Image using the Google GenAI SDK.
- Getting Started with Chat with Gemini — Shows stateful Gemini chat with Google GenAI SDK and LangChain on Vertex AI.
- Getting started with Gemini using Vertex AI in Express Mode — Introduces Gemini on Vertex AI Express Mode using the Google Gen AI SDK.
- Grounding with Vertex AI Search — Creates a Vertex AI Search engine and uses it to ground a Gemini response with retrieved context.
- Intro to Grounding with Gemini in Vertex AI — Shows how to ground Gemini 3.5 Flash responses with Search, Enterprise Web Search, Maps, and Vertex AI Search.
- Intro to Logprobs — Introduces Gemini logprobs on Vertex AI for confidence, autocomplete, and RAG grounding analysis.
- Introduction to Long Context Window with Gemini on Vertex AI — Demonstrates Gemini long-context text, video, and audio prompts on Vertex AI with token counting.
- Intro to Model Context Protocol (MCP) integration with Vertex AI — Shows how to connect Gemini on Vertex AI to custom and prebuilt MCP servers.
- Getting Started with Model Optimizer — Introduces Vertex AI Model Optimizer routing with Google Gen AI SDK prompts and function calls.
- Intro to Agent Platform Multimodal Datasets — Builds Agent Platform multimodal datasets for Gemini tuning validation, resource estimates, tuning, and batch prediction.
- Getting Started with the Live API Native Audio — Connects to Gemini Live API native audio with proactive chime-in and affective dialog examples.
- Getting Started with Gemini Live API using Gen AI SDK — Introduces Gemini Live API audio sessions, tools, transcription, and VAD with the Google Gen AI SDK.
- Gemini Live API Quickstart — Connects to Gemini Live API for bidirectional audio streaming with Gen AI SDK and raw WebSockets.
- Interactive Loan Application Assistant (Financial Services) — Builds a Gemini 2.0 loan document assistant with RAG, large context, audio, Vertex AI Search, and Vector Search.
- Real-time Retrieval Augmented Generation (RAG) using the Multimodal Live API with Gemini 2.0 — Builds a retail RAG pipeline with Gemini Multimodal Live API for grounded text and audio answers.
- Nano Banana 🍌: Gemini 2.5 Flash Image Recipes — Demonstrates Gemini 2.5 Flash image generation and editing recipes on Vertex AI with google-genai.
- Prompt Design - Best Practices — Demonstrates prompt design best practices for Gemini on Vertex AI with google-genai.
- Intro to Building a Scalable and Modular RAG System with RAG Engine in Vertex AI — Builds a Vertex AI RAG Engine corpus, imports files, retrieves context, and grounds Gemini or Llama responses.
- Evaluating Vertex RAG Engine Generation with Vertex AI Python SDK for Gen AI Evaluation Service — Evaluates Vertex AI RAG Engine responses with a custom Gen AI Evaluation Service metric.
- Vertex AI RAG Engine with Vertex AI Feature Store — Builds a Vertex AI RAG Engine corpus backed by Vertex AI Feature Store and queries it with Gemini.
- Vertex AI RAG Engine with Pinecone — Shows how to use Vertex AI RAG Engine with Pinecone as the vector database for Gemini retrieval.
- Vertex AI RAG Engine with Vertex AI Vector Search — Builds a Vertex AI RAG Engine corpus backed by Vertex AI Vector Search and queries it with Gemini.
- Responsible AI with Gemini API in Vertex AI: Safety ratings and thresholds — Shows how to inspect Gemini safety ratings and set stricter safety thresholds in Vertex AI.
- Intro to thought signatures — Shows how Gemini thought signatures preserve reasoning context across multi-turn function calling.
- Get Started with Gemini Preference Optimization — Tunes Gemini 2.5 Flash with human preference data using Vertex AI preference optimization.
- Supervised Fine-Tuning with integrated Gen AI Evaluation — Fine-tunes gemini-2.5-flash with automatic Gen AI Evaluation metrics at each checkpoint.
- Vertex AI SFT Gemini Migration Recipe — Migrates explicit SFT hyperparameters from gemini-1.5-flash-002 tuning jobs to gemini-2.5-flash.
- Supervised Fine Tuning with Gemini 2.5 Flash for Image Captioning — Fine-tunes Gemini 2.5 Flash on GCS image-caption pairs and evaluates ROUGE before and after tuning.
- Supervised Fine Tuning with Gemini 2.0 Flash for change detection using the Google Gen AI SDK — Fine-tunes Gemini 2.0 Flash on paired images for spot-the-difference change detection.
- Supervised Fine-tuning Gemini 2.5 Flash for Predictive Maintenance — Fine-tunes Gemini 2.5 Flash on simulated sensor data to classify equipment maintenance status.
- Supervised fine-tuning with Gemini 2.0 Flash for Q&A using the Google Gen AI SDK — Fine-tunes Gemini 2.0 Flash on SQuAD Q&A with Vertex AI supervised tuning and evaluates EM/F1 gains.
- Supervised Fine Tuning with Gemini 2.5 Flash for Article Summarization — Fine-tunes Gemini 2.5 Flash on WikiLingua article summaries and evaluates ROUGE before and after tuning.
- Supervised Fine-tuning Gemini 2.5 Flash for Visual Defect Detection — Fine-tunes Gemini 2.5 Flash on image-based manufacturing defect classification.
- Intro to Url Context — Shows how to use Gemini URL context to summarize, compare, and analyze web pages with optional Google Search grounding.
- AI-Assisted Data Science Workflows in BigQuery — Builds a BigQuery multimodal housing workflow with Gemini enrichment, BQML clustering, and vector search.
- Analyze a codebase with Gemini in Vertex AI — Uses Gemini 3.5 Flash on Vertex AI to analyze, document, debug, and extend a GitHub codebase.
- Reduce Tech Debt with Gemini 3 Pro — Uses Gemini 3.1 Pro on Vertex AI to refactor legacy Python code through tests, specs, design docs, and verification.
- Get hands-on with a customer support use case using Gemini and Gen AI SDK — Builds a Gemini customer-support flow for retail product matching, room-fit reasoning, tools, search, and Live API audio.
- Document Processing with Gemini — Processes PDFs with Gemini on Vertex AI for extraction, classification, QA, summarization, translation, and page selection.
- Patents Document Understanding with Gemini — Uses Gemini batch prediction on Vertex AI to extract structured fields and figure boxes from patent PDFs.
- Sheet Music Analysis with Gemini — Uses Gemini on Vertex AI to extract and edit sheet music PDF metadata and identify a song from audio.
- Automating Income Taxes with Gemini — Classifies tax PDFs and extracts structured tax fields with Gemini on Vertex AI.
- Using Gemini in Education — Demonstrates Gemini education prompts across text, math, images, multiple images, and video.
- Gemini: An Overview of Multimodal Use Cases — Shows Gemini multimodal prompts for text, PDFs, images, video, audio, code, retail, diagrams, and comparisons.
- Building Knowledge Graphs with Gemini — Extracts knowledge graphs from text and PDF documents with Gemini using deterministic prompts and TSV outputs.
- Know Your Customer Use Case - Gemini Grounding with Google Search — Builds grounded Gemini KYC negative-news reports and evaluates response quality with custom Vertex AI metrics.
- Generating Consistent Imagery with Gemini 🍌 — Generates a consistent robot image story from one archive image using Gemini 2.5 Flash Image.
- Video Captioning with Gemini — Uses Gemini on Vertex AI to generate rich multimodal captions from a video in Cloud Storage.
- Video Data Curation - Video Quality Filtering — Filters video datasets by metadata, OCR/watermarks, aesthetics, and motion scores for curation.
- Data Curation Pipeline: Splitting and Transcoding — Builds a video curation pipeline for metadata filtering, splitting, scene detection, and transcoding.
- Multimodal Sentiment Analysis with Gemini — Compares Gemini sentiment analysis on audio versus a transcript of the same conversation.
- Productivity Coaching with Gemini and Google Calendar — Uses Gemini 2.5 Flash with Google Calendar data to provide productivity coaching and schedule recommendations.
- Slide Generation with Gemini and Marp — Uses Gemini and Marp to turn a blog post into a Markdown slide deck and PDF.
- Multimodal retail recommendation: using Gemini to recommend items based on images and image reasoning — Builds a Gemini multimodal retail recommender that explains chair fit for a room image.
- Retail AI Location Strategy: Autonomous Site Selection & Market Analysis — Builds a Gemini 3 retail site-selection pipeline using search, Maps, code execution, reasoning, and JSON output.
- Detecting and Editing Visual Objects with Gemini — Detects visual objects with Gemini, crops them, and edits them with Gemini image models.
- Spatial understanding with Gemini 3 — Uses Gemini 2.5 Flash on Vertex AI to detect objects and draw normalized bounding boxes on images.
- Unlocking Multimodal Video Transcription with Gemini — Uses Gemini to build multimodal video transcripts with voice IDs, speaker names, and structured JSON output.
- Identifcation of Scene Transitions in Movies Using Gemini — Uses Gemini to detect movie scene transitions from a video and matching VTT subtitles.
- YouTube Video Analysis with Gemini — Analyzes public YouTube videos with Gemini for summaries, structured JSON extraction, and cross-video insights.
- Enhanced Vision Assistant with Gemini — Builds a Gemini vision assistant that detects objects, assesses hazards, and speaks navigation guidance.
Open Models (1)
- Fine-tuning GPT-OSS 20B with Unsloth on Vertex AI Colab Enterprise and Nvidia A100 40GB GPU — Fine-tunes GPT-OSS 20B with Unsloth LoRA on Vertex AI Colab Enterprise using an A100 GPU.
SDK (2)
- Getting started with Google Generative AI using the Gen AI SDK — Introduces Google Gen AI SDK on Vertex AI for Gemini prompts, tools, caching, batches, and embeddings.
- Configuring Retries in the Gen AI SDK — Configures Google Gen AI SDK HTTP retries for Gemini calls at client and request level.
Vertex AI Search (3)
- Gemini Enterprise custom agent with prompt management — Builds a Gemini Enterprise ADK SQL agent using Vertex AI Prompt Management and schema file context.
- Gemini Enterprise custom agent with Vertex AI session — Builds a Gemini Enterprise travel agent using ADK sub-agents and persistent Vertex AI sessions.
- Open Source Models (Gemma) as a agent with Gemini Enterprise — Deploys Gemma on Cloud Run, wraps it with ADK, deploys to Agent Engine, and registers it in Gemini Enterprise.
Vision (7)
- Imagen 3 Image Editing — Edits images with Imagen 3 using inpainting, background swap, outpainting, and mask-free prompts.
- Imagen 4 Image Upscale — Shows how to upscale generated, local, and Cloud Storage images with Imagen 4 using google-genai.
- Veo 3.1 Advanced Controls — Shows Veo 3.1 frame interpolation and video extension with Google Gen AI SDK on Agent Platform.
- Veo 3.1 Reference to Video — Generates Veo 3.1 videos from reference images using the Google Gen AI SDK.
- Veo 3.1 Video Generation — Generates Veo 3.1 videos from text and images with optional Gemini prompt optimization.
- Virtual Try-On: Image Generation — Uses Google Gen AI SDK to generate virtual try-on images from local and Cloud Storage clothing images.
- Virtual Try-On: Batch Generation Pipeline — Batch-generates virtual try-on images from person and apparel inputs using Google GenAI SDK.
Workshops (1)
- AI Agents for Engineers (Evolution of AI Agents) — Compares zero-shot, LangChain, and LangGraph essay generation with Gemini and Tavily search.
Entity · All entities · Home