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.

AI Coding Screen

Table of Contents

  1. Introduction to the Repository
  2. Quick Start: Cloning and Setup
  3. Deep Dive into Guides


    • Function Calling

    • ReAct Agents

    • Agentic Patterns

    • Memory Integration
  4. Hands‑On Examples


    • OpenAI SDK Integration

    • Google Search Integration

    • Structured Outputs with Pydantic

    • Audio Transcription

    • Native Image Generation

    • File Editing

    • LangChain Integration

    • Context Caching
  5. Scripts and Automation
  6. JavaScript Examples
  7. Gemma: Another GenAI Option
  8. Contributing and License
  9. 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:

  1. Clone the repository

    git clone https://github.com/philschmid/gemini-samples.git
    cd gemini-samples
    
  2. Environment variables
    Create a .env file in the root directory with your API key:

    GEMINI_API_KEY=your_api_key_here
    
  3. Install dependencies
    Depending on your preferred environment, install the Python packages:

    pip install -r requirements.txt
    

    or, for JavaScript examples:

    npm install
    
  4. Explore notebooks
    Launch JupyterLab:

    jupyter lab
    

    Open any .ipynb under examples/ or guides/ to follow along interactively.

Working on Code

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.

  1. Gemini with OpenAI SDK (examples/gemini-with-openai-sdk.ipynb)
    Load the official SDK, authenticate with your key, and execute simple completion calls.

  2. 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.

  3. Structured Outputs (examples/gemini-structured-outputs.ipynb)
    Use Pydantic schemas to validate model outputs at runtime, ensuring type safety in downstream code.

  4. 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.

  5. Audio Transcription (examples/gemini-transcribe-with-timestamps.ipynb)
    Transcribe audio files with precise timecodes, enabling subtitle or podcast indexing workflows.

  6. 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.

  7. 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.

  8. Gemini LangChain Integration (examples/gemini-langchain.ipynb)
    Plug Gemini into LangChain’s agent framework, combining structured tools, memory, and chain-of-thought reasoning.

  9. 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.

  10. Gemini ADK MCP (examples/gemini-adk-mcp.ipynb)
    Explore Model Context Protocol to manage request/response payloads across a multi‑step interaction.

  11. Gemini CrewAI (examples/gemini-crewai.ipynb)
    Preview experimental CrewAI features with Gemini 2.5 Pro.

  12. Sequential Function Calling (examples/gemini-sequential-function-calling.ipynb)
    Chain multiple function calls in a single dialog, maintaining context across each step.

  13. 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:

  1. Fork the repository and create a feature branch.
  2. Run existing notebooks to ensure compatibility.
  3. Add new examples or refine documentation.
  4. 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.
Team Collaboration

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.