Gemini

Gemini examples for multimodal input, file search, grounding, knowledge, thinking, structured output, tools, and Vertex AI.

ExampleDescription
Gemini 3.8 Flash Market BriefCombine Google Search, URL context, and a Pydantic schema for a research brief.
Gemini 3.8 FlashUse web search tools with Gemini 3.8 Flash in synchronous, asynchronous, and streaming calls.
Agent with Thinking BudgetCap Gemini 2.5 Pro's reasoning with thinking_budget and surface thought summaries with include_thoughts.
Google Audio Input Bytes ContentPass a downloaded WAV file to Gemini as raw audio bytes for analysis.
Google Audio Input File UploadUpload an MP3 through the Gemini Files API and reuse the remote file across runs.
Google Audio Input Local File UploadSend a local MP3 to Gemini with Audio(filepath) and stream the analysis.
Google BasicRun a Gemini 3.7 Flash agent with sync, async, and streaming responses.
DBPersist Gemini agent sessions in Postgres and carry history across turns.
External URL InputPass a public HTTPS PDF URL straight to Gemini 3.7 Flash with File(url=...), no download step.
Google File Search AdvancedManage multiple Gemini File Search stores with custom chunking and metadata filters.
Google File Search BasicCreate a Gemini File Search store, upload a document, and query it with citations.
Google File Search RAG PipelineBuild an async RAG pipeline over a directory of files with Gemini File Search.
File Upload with CacheUpload a transcript with the Gemini Files API, cache it with a 5-minute TTL, and reuse the cached content across requests.
GCS File InputSummarize a PDF straight from a Google Cloud Storage gs:// URI using Gemini on Vertex AI, with no download or re-upload.
Gemini 2 to 3Continue a Gemini 3.7 Flash session to Gemini 3.1 Pro Preview by sharing history through SqliteDb.
Gemini 3 ProUse Gemini 3.1 Pro Preview with web search and SQLite chat history.
Gemini 3 Pro Thinking LevelSet Gemini 3.1 Pro Preview thinking level and stream an asynchronous response.
Grounding with GeminiGrounding enables Gemini to search the web and provide responses backed by real-time information with citations.
Google Image EditingSend an image to Gemini and get back an edited version using image response modalities.
Google Image GenerationGenerate an image with Gemini response modalities and open it with PIL.
Google Image InputPass an image URL to a Gemini agent and fetch related news with web search.
Google Image Input File UploadUpload an image through the Gemini Files API and combine it with web search.
Imagen ToolAdapt a historical Imagen toolkit example to a Gemini image-generation function tool.
Imagen Tool AdvancedAdapt a historical Imagen toolkit example to a Gemini image-generation function tool.
KnowledgeQuery a PDF knowledge base stored in PgVector with Gemini embeddings.
PDF Input File UploadUpload a PDF to the Gemini Files API, then ask an agent to summarize it and suggest a recipe from it.
Google PDF Input LocalAttach a local PDF to a Gemini agent and ask follow-up questions with history.
Google PDF Input URLSummarize a PDF from a URL and ask follow-ups using InMemoryDb chat history.
RetryReview retry settings and why invalid model IDs cannot reliably exercise the retry path.
S3 URL File InputGenerate an S3 pre-signed URL with boto3 and pass it straight to Gemini to summarize the PDF without downloading it.
Google Search with GeminiThe search tool enables Gemini to access current information from Google Search.
Storage and MemoryCombine PgVector knowledge, Postgres memory, session summaries, and web search on Gemini.
Google Structured OutputReturn an event plan as a Pydantic schema with enums, formats, and nested objects.
Google Text To SpeechGenerate speech with a Gemini TTS model and write the audio to a WAV file.
Google Thinking AgentSolve a logic puzzle with a Gemini thinking budget and thought summaries enabled.
Tool UseAdd web search tools to a Gemini agent and run sync, streaming, and async.
URL ContextCompare two recipe pages by enabling Gemini's url_context to fetch page content.
URL Context with SearchCombine URL context with Google Search for comprehensive web analysis.
Vertex AI Search with GeminiVertex AI Search allows Gemini to search through your data stores, providing grounded responses based on your private knowledge base.
Vertex AIAuthenticate Gemini against Vertex AI with environment variables or explicit project_id and location parameters on the Gemini model.
Google Vertex AI With CredentialsAuthenticate Gemini on Vertex AI with explicit service account credentials.
Google Video Input Bytes ContentDownload an MP4 and pass it to Gemini as raw video bytes for analysis.
Google Video Input File UploadUpload a video through the Gemini Files API and poll until it is ready to query.
Google Video Input Local File UploadPass a local video file to Gemini and ask the agent to describe its contents.
Google Video Input YouTubeSend a YouTube URL as video input to Gemini and have the agent describe it.
Google File Search Image UploadDemonstrates uploading images (JPEG, PNG) to Gemini File Search stores using the multimodal embedding model (gemini-embedding-2).
Grounding with Parallel Web Search on Vertex AIGround Gemini 3.7 Flash responses with Parallel web search on Vertex AI.