gemini-samples  by philschmid

Samples for DeepMind Gemini models

created 5 months ago
1,036 stars

Top 36.9% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This repository provides a collection of practical code samples, snippets, and guides for utilizing Google DeepMind's Gemini models. It targets developers and researchers looking to explore and implement advanced AI functionalities like function calling, structured outputs, and multimodal interactions with Gemini. The primary benefit is a readily accessible set of examples to accelerate development and experimentation with these powerful models.

How It Works

The repository showcases Gemini's capabilities through various implementations, including direct API calls, integration with popular frameworks like LangChain and LangGraph, and leveraging SDKs like the OpenAI SDK. It demonstrates techniques for structured data generation using Pydantic, dynamic schema creation via meta-prompts, and multimodal features such as audio transcription and native image generation. The examples highlight efficient use cases, including context caching for cost savings and integrating Google Search for real-time information.

Quick Start & Requirements

  • Primary install / run command: Clone the repository (git clone https://github.com/philschmid/gemini-samples.git) and explore the Jupyter notebooks or Python scripts.
  • Non-default prerequisites and dependencies: A Gemini API key is required, to be set in a .env file as GEMINI_API_KEY=your_api_key_here. Specific examples may have additional dependencies managed by their respective notebooks or scripts.
  • Links: Repository

Highlighted Details

  • Demonstrates function calling and ReAct agent implementation with LangGraph.
  • Includes examples for structured JSON outputs using Pydantic and dynamic JSON schema generation.
  • Showcases multimodal capabilities like audio transcription with timestamps and native image generation with Gemini 2.0 Flash.
  • Features context caching for potential cost savings of up to 75%.

Maintenance & Community

The repository is maintained by philschmid. Contributions are welcome via pull requests or issues.

Licensing & Compatibility

  • License type: MIT License.
  • Compatibility notes: The MIT license is permissive and generally compatible with commercial and closed-source applications.

Limitations & Caveats

Some examples, such as Gemini 2.0 Flash, are experimental. The repository contains personal snippets and may not represent official Google documentation or support.

Health Check
Last commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
1
Star History
518 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.