How google-gemini/cookbook works
Purpose and Entry Points
This is a documentation-and-executable-notebook cookbook for the Gemini API, not a deployable application. Users enter through README.md, then run tutorials in hosted notebook environments or locally. Primary paths are quickstarts/ for single-feature API learning and examples/ for composed use cases.
Core Learning Tracks
• Authentication and baseline generation: establishes API-key/OAuth access and basic multimodal prompting. Paths: quickstarts/Authentication.ipynb, quickstarts/Authentication_with_OAuth.ipynb, quickstarts/Get_started.ipynb.
• Feature-specific API tutorials: isolated notebook entry points cover streaming, structured output, safety, files, embeddings, caching, batch, and function calls. Paths: quickstarts/Streaming.ipynb, quickstarts/JSON_mode.ipynb, quickstarts/File_Search.ipynb.
• Direct REST usage: a parallel tutorial track demonstrates the Gemini REST surface rather than SDK clients. Paths: quickstarts/rest/README.md, quickstarts/rest/Function_calling_REST.ipynb, quickstarts/rest/Streaming_REST.ipynb.
Realtime and Asynchronous Flows
Realtime clients establish streaming/WebSocket sessions, send multimodal audio/video or tool-enabled requests, and consume incremental events. Paths: quickstarts/Get_started_LiveAPI.py, quickstarts/websockets/Get_started_LiveAPI.py, quickstarts/Get_started_LiveTranslate.py.
Long-running operations use batch requests, media generation, or webhook notifications rather than a synchronous request/response loop. Paths: quickstarts/Batch_mode.ipynb, quickstarts/Webhooks.ipynb, quickstarts/Get_started_Veo.ipynb.
Model and Media Boundaries
Notebooks exercise Gemini text/multimodal inference plus specialized hosted model capabilities: image generation, video generation/editing, music, speech, transcription, and robotics/spatial reasoning. Paths: quickstarts/Get_Started_Nano_Banana.ipynb, quickstarts/Get_started_Omni.ipynb, quickstarts/Get_started_LyriaRealTime.py. The external service boundary is the Gemini API, accessed through REST or official language SDKs; credentials originate from Google AI Studio or OAuth.
Grounding, Retrieval, and Agent Composition
Examples combine model calls with tools and external knowledge/data systems. Grounding can use Google Search, Maps, URLs, and hosted File Search; retrieval examples integrate vector stores and orchestration frameworks. Paths: quickstarts/Grounding.ipynb, examples/qdrant/Hybrid_Search_Legal.ipynb, examples/langchain/SQL_Agent_Gemini_LangChain.ipynb. This is the main boundary between Gemini inference and third-party services such as Qdrant, Chroma, Pinecone, Weaviate, LangChain, LlamaIndex, and Google tools.
Practical Application Recipes
examples/ assembles multi-stage flows—input ingestion, prompts/tool calls, model inference, and rendered or persisted outputs—rather than supplying reusable application packages. Representative integrations include browser control, video production, observability, Gradio UI, and Google Apps Script. Paths: examples/Browser_as_a_tool.ipynb, examples/Animated_Story_Video_Generation_gemini.ipynb, examples/Cost_Estimation_And_Health_Monitoring.ipynb.
Repository Quality Pipeline
Repository-maintenance code validates and normalizes notebooks. tools/nb_tester/cli.py drives notebook execution, comparison, rule checks, security scanning, AI/security auditing, and reporting; tools/nblint_cli.py and tools/nbfmt_cli.py provide linting and formatting. Paths: tools/nb_tester/executor.py, tools/nb_tester/reporter.py, tools/nblint/linter.py. GitHub Actions runs notebook-related automation and repository hygiene. Paths: .github/workflows/notebooks.yaml, .github/workflows/new_examples_links_in_table_of_content.yml.
Main entry points: README.md Cookbook guide · cli.py Notebook test CLI · Browser_as_a_tool.ipynb Application recipes · Authentication.ipynb Auth and basics
Components 19
Learning tracks
Notebook and script entry points for API capabilities.
- Auth and basics · API key/OAuth setup and baseline multimodal generation.
quickstarts/Authentication.ipynb - Feature tutorials · Streaming, JSON output, and hosted file search tutorials.
quickstarts/Streaming.ipynb - REST tutorials · Parallel Gemini REST learning track.
quickstarts/rest/README.md - Realtime clients · Live streaming sessions for multimodal and tool-enabled requests.
quickstarts/Get_started_LiveAPI.py - Async operations · Batch, webhook, and long-running media workflows.
quickstarts/Batch_mode.ipynb - Specialized media models · Image, video, music, speech, and spatial capabilities.
quickstarts/Get_Started_Nano_Banana.ipynb - Grounding tutorials · Google tools, URLs, and hosted File Search grounding.
quickstarts/Grounding.ipynb
Composed recipes
Multi-stage example integrations.
- Retrieval and agents · Qdrant-backed retrieval and LangChain agent compositions.
examples/qdrant/Hybrid_Search_Legal.ipynb - Application recipes · Browser, video, observability, UI, and Apps Script recipes.
examples/Browser_as_a_tool.ipynb
Repository quality
Notebook validation and GitHub automation.
- Notebook test CLI · Drives execution, comparisons, checks, audits, and reporting.
tools/nb_tester/cli.py - Execution and comparison · Runs notebooks and evaluates outputs.
tools/nb_tester/executor.py - Lint and format · Notebook rule checking and normalization.
tools/nblint_cli.py - Reports and audits · Aggregates validation and audit results.
tools/nb_tester/reporter.py - GitHub Actions · Runs notebook automation and repository hygiene.
.github/workflows/notebooks.yaml
Other components
- Cookbook guide · Primary entry point to tutorials and examples.
README.md - Gemini API · External inference and specialized-model service boundary.
- AI Studio / OAuth · Sources of API-key and OAuth access.
- Official SDKs · Client boundary used by most cookbook flows.
- Tools and data services · Google tools, vector stores, and orchestration frameworks.
Connections 23
- Cookbook guide → Auth and basics: starts with
- Cookbook guide → Feature tutorials: links to
- Cookbook guide → REST tutorials: links to
- Cookbook guide → Application recipes: links to
- AI Studio / OAuth → Auth and basics: authorizes
- Auth and basics → Official SDKs: configures
- Official SDKs → Gemini API: calls
- REST tutorials → Gemini API: calls directly
- Feature tutorials → Gemini API: exercises
- Realtime clients → Gemini API: streams events with
- Async operations → Gemini API: submits long-running work
- Specialized media models → Gemini API: uses hosted capabilities
- Grounding tutorials → Gemini API: grounds inference
- Grounding tutorials → Tools and data services: uses
- Retrieval and agents → Tools and data services: integrates
- Retrieval and agents → Gemini API: composes with
- Application recipes → Gemini API: orchestrates
- Application recipes → Tools and data services: integrates
- Notebook test CLI → Execution and comparison: drives
- Notebook test CLI → Lint and format: runs checks
- Notebook test CLI → Reports and audits: emits results
- GitHub Actions → Notebook test CLI: automates
- GitHub Actions → Lint and format: runs