gemini-samples  by philschmid

Samples for DeepMind Gemini models

Created 7 months ago
1,218 stars

Top 32.2% on SourcePulse

GitHubView on GitHub
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

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
60 stars in the last 30 days

Explore Similar Projects

Starred by Nir Gazit Nir Gazit(Cofounder of Traceloop), Chris Van Pelt Chris Van Pelt(Cofounder of Weights & Biases), and
1 more.

go-openai by sashabaranov

0.1%
10k
Go client for OpenAI API
Created 5 years ago
Updated 6 days ago
Feedback? Help us improve.