Exploring Google DeepMind Gemini Models: Samples, Snippets, and Practical Guides
Artificial intelligence (AI) models have rapidly evolved in recent years. Among the most advanced offerings are Google DeepMind’s Gemini series, which brings powerful capabilities to natural language understanding, multi-modal generation, and agent-based workflows. This comprehensive guide breaks down a personal repository of tiny samples, snippets, and step‑by‑step guides to help developers—from those with vocational college backgrounds to seasoned engineers—get hands‑on with Gemini models. All instructions and explanations here are drawn exclusively from the repository’s README and accompanying notebooks, ensuring fidelity to the source and avoiding any extraneous assumptions.
Table of Contents
-
Introduction to the Repository -
Quick Start: Cloning and Setup -
Deep Dive into Guides - ◉
Function Calling - ◉
ReAct Agents - ◉
Agentic Patterns - ◉
Memory Integration
- ◉
-
Hands‑On Examples - ◉
OpenAI SDK Integration - ◉
Google Search Integration - ◉
Structured Outputs with Pydantic - ◉
Audio Transcription - ◉
Native Image Generation - ◉
File Editing - ◉
LangChain Integration - ◉
Context Caching
- ◉
-
Scripts and Automation -
JavaScript Examples -
Gemma: Another GenAI Option -
Contributing and License -
Practical Tips and Best Practices
Introduction to the Repository
This GitHub repository titled “Google DeepMind Models Samples, Snippets and Guides” is a curated collection of miniature code experiments, illustrative notebooks, and step‑by‑step tutorials centered on Google DeepMind’s Gemini family of AI models. Whether you want to explore basic model calls or build sophisticated multi‑agent systems, you’ll find:
- ◉
Examples folder with Jupyter notebooks demonstrating direct API usage. - ◉
Guides folder offering conceptual walkthroughs (e.g., function calling workflows). - ◉
Scripts folder for command‑line automation and batch processing. - ◉
JavaScript examples for embedding Gemini capabilities in web or Node.js contexts.
Every item in the repository is designed to be as small and focused as possible, making it easy to extract the core idea and adapt it into your own projects. All materials are released under the MIT License, inviting you to fork, modify, and extend without restrictions.
“
Image credit: Unsplash
Source code examples adapted from the official README.
Quick Start: Cloning and Setup
Getting started takes just a few commands:
-
Clone the repository
git clone https://github.com/philschmid/gemini-samples.git cd gemini-samples
-
Environment variables
Create a.env
file in the root directory with your API key:GEMINI_API_KEY=your_api_key_here
-
Install dependencies
Depending on your preferred environment, install the Python packages:pip install -r requirements.txt
or, for JavaScript examples:
npm install
-
Explore notebooks
Launch JupyterLab:jupyter lab
Open any
.ipynb
underexamples/
orguides/
to follow along interactively.

Deep Dive into Guides
The guides/ directory walks you through high‑level patterns and implementation recipes.
1. Function Calling Guide
– File: guides/function-calling.ipynb
– Overview: Shows you how to structure prompts and use function‑calling APIs so that the model outputs JSON conforming to a predefined schema. Ideal for building tool‑augmented chatbots.
2. ReAct Agent
– File: guides/langgraph-react-agent.ipynb
– Overview: Demonstrates the ReAct paradigm—interleaving reasoning steps and actions (e.g., API calls or external lookups) in an agent loop. You’ll see how to integrate LangGraph to orchestrate complex workflows.
3. Agentic Patterns
– File: guides/agentic-pattern.ipynb
– Overview: Explores different agent topologies—single‑step agents, multi‑step planners, and loop‑based controllers—so you can choose the right pattern for your use case.
4. Gemini with Memory
– File: guides/gemini-with-memory.ipynb
– Overview: Teaches long‑term memory integration, preserving context across sessions. Learn how to store, retrieve, and update memory entries to build stateful experiences.
“
Pro Tip: Focus on one guide at a time, adapt the provided code snippets, and test in isolation before combining patterns.
Hands‑On Examples
Under examples/, you’ll find bite‑sized notebooks that demonstrate direct usage of various DeepMind models.
-
Gemini with OpenAI SDK (
examples/gemini-with-openai-sdk.ipynb
)
Load the official SDK, authenticate with your key, and execute simple completion calls. -
Gemini with Google Search (
examples/gemini-google-search.ipynb
)
Augment your prompts with real‑time web data. Discover how to securely chain a search API call before feeding results back into the model. -
Structured Outputs (
examples/gemini-structured-outputs.ipynb
)
Use Pydantic schemas to validate model outputs at runtime, ensuring type safety in downstream code. -
Meta Prompts (
examples/gemini-meta-prompt-structured-outputs.ipynb
)
Dynamically generate JSON schemas by prompting the model itself, then use the schema to guide subsequent completions. -
Audio Transcription (
examples/gemini-transcribe-with-timestamps.ipynb
)
Transcribe audio files with precise timecodes, enabling subtitle or podcast indexing workflows. -
Gemini Native Image Output (
examples/gemini-native-image-out.ipynb
)
Leverage the Gemini 2.0 Flash experimental model to generate images directly from your prompt—no separate image API needed. -
Gemini File Editing (
examples/gemini-file-editing.ipynb
)
Perform complex refactoring and code transformation tasks by uploading files and letting the model edit in place. -
Gemini LangChain Integration (
examples/gemini-langchain.ipynb
)
Plug Gemini into LangChain’s agent framework, combining structured tools, memory, and chain-of-thought reasoning. -
Code Executor Data Analysis (
examples/gemini-code-executor-data-analysis.ipynb
)
Run Python code in‑context to analyze data, generate plots, and return visualizations—all within the same notebook. -
Gemini ADK MCP (
examples/gemini-adk-mcp.ipynb
)
Explore Model Context Protocol to manage request/response payloads across a multi‑step interaction. -
Gemini CrewAI (
examples/gemini-crewai.ipynb
)
Preview experimental CrewAI features with Gemini 2.5 Pro. -
Sequential Function Calling (
examples/gemini-sequential-function-calling.ipynb
)
Chain multiple function calls in a single dialog, maintaining context across each step. -
Gemini Batch API (
examples/gemini-batch-api.ipynb
)
Optimize throughput by batching multiple prompts in one API request.
Scripts and Automation
In scripts/, standalone Python files showcase practical automation:
- ◉
gemini-browser-use.py
– Simulate browser interactions: fetch pages, extract text, feed it to the model. - ◉
gemini-mcp-agent.py
&gemini-mcp-pipedream.py
– Lightweight agents demonstrating the Model Context Protocol; one using Pipedream for event-driven workflows. - ◉
gemini-veo-meta.py
– Optimize prompts for Gemini Veo3 via meta‑learning techniques. - ◉
veo3-generate-viral-vlogs.py
– Auto‑generate short video scripts by chaining multiple model calls. - ◉
gemini-image-meta.py
– Blend Gemini with Imagen for rich, context‑aware image metadata.
These scripts can be integrated into larger pipelines, scheduled with cron jobs, or deployed as serverless functions.
JavaScript Examples
The javascript-examples/ folder contains Node.js scripts:
- ◉
gemini-native-image-out.js
– Leverage Gemini 2.0 Flash for direct image generation in JavaScript.
Just install the official GenAI package:
npm install @google/genai
and run:
node javascript-examples/gemini-native-image-out.js
Gemma: Another GenAI Option
Beyond Gemini, the repository includes Gemma examples:
- ◉
examples/gemma-with-genai-sdk.ipynb
– Use Google’s GenAI API with Gemma 3 27B. - ◉
examples/gemma-function-calling.ipynb
– Implement function calling patterns specifically for Gemma 3.
Gemma offers comparable capabilities to Gemini but under a different model family. Feel free to compare both sets of notebooks to decide which best fits your performance and cost requirements.
Contributing and License
Contributions are warmly welcomed! To submit improvements:
-
Fork the repository and create a feature branch. -
Run existing notebooks to ensure compatibility. -
Add new examples or refine documentation. -
Open a pull request and describe your changes.
This project uses the MIT License, granting you freedom to adapt and redistribute.
Practical Tips and Best Practices
- ◉
Start Small: Begin with a single example or guide; verify your API key and environment first. - ◉
Isolate and Experiment: Copy a single notebook, strip out unrelated cells, and experiment with prompts. - ◉
Schema Validation: Whenever possible, define Pydantic or JSON schemas for critical outputs—this prevents downstream surprises. - ◉
Memory Management: Use the memory guide sparingly; only store high‑value context to avoid performance degradation. - ◉
Batch Wisely: For high‑volume use cases, leverage the batch API to reduce latency and cost. - ◉
Stay Updated: Check the repository for newly added examples of cutting‑edge features in Gemini Pro releases.

By following the structured samples, guides, and scripts in this repository, you can accelerate your journey from “Hello, world!” completions to production‑ready AI agents. Dive in, adapt the code to your domain, and unlock the full potential of Google DeepMind’s Gemini models today.