This folder contains a collection of examples for the Gemini API. These are advanced examples and might be quite complex as they often use one of more Gemini capabilities.
For introductions to those features it is recommended to start with the Quickstarts guides, and the Get started one in particular.
This is a collection of fun and helpful examples for the Gemini API.
Cookbook | Description | Features | Open |
---|---|---|---|
Plotting and mapping Live | Ask Gemini for complex graphs live | Live API, Code execution | |
Search grounding for research report | Use grounding to improve the quality of your research report | Grounding | |
3D Spatial understanding | Use Gemini 3D spatial abilities to understand 3D scenes and answer questions about them | Multimodal, Spatial understanding | |
Gradio and live API | Use gradio to deploy your own instance of the Live API | Live API | Python Code |
Invoice and Form Data Extraction | Use the Gemini API to extract information from PDFs | File API, Structured Outputs |
Some old examples are still using the legacy SDK, they should still work and are still worth checking to get ideas:
- Agents and Automatic Function Calling: Create an agent (Barrista-bot) to take your coffee order.
- Video Analysis: Three notebooks using multimodal capabilities of the Gemini model to classify the species of animals for a video, summarize one or recognizing when it happened,
- Anomaly Detection: Use embeddings to detect anomalies in your datasets.
- Analyze a Video with Summarization: This notebook shows how you can use Gemini API's multimodal capabilities for video summarization.
- Apollo 11 - long context example: Search a 400 page transcript from Apollo 11.
- Classify text with emeddings: Use embeddings from the Gemini API with Keras.
- Guess the shape: A simple example of using images in prompts.
- Market a Jet Backpack: Create a marketing campaign from a product sketch.
- Object detection: Extensive examples with object detection, including with multiple classes, OCR, visual question answering, and even an interactive demo.
- Opossum search: Code generation with the Gemini API. Just for fun, you'll prompt the model to create a web app called "Opossum Search" that searches Google with "opossum" appended to the query.
- Search Wikipedia with ReAct: Use ReAct prompting with Gemini Flash to search Wikipedia interactively.
- Search Re-ranking with Embeddings: Use embeddings to re-rank search results.
- Story writing with prompt chaining.ipynb: Write a story using two powerful tools: prompt chaining and iterative generation.
- Tag and Caption images: Use the Gemini model's vision capabilities and the embedding model to add tags and captions to images of pieces of clothing.
- Talk to documents: This is a basic intro to Retrieval Augmented Generation (RAG). Use embeddings to search through a custom database.
- Upload files to Colab: This is a helper notebook that shows how to upload files from your local computer to Colab. Note: to upload files to the Gemini API (text, code, images, audio, video), check out the Files quickstart.
- Voice Memos: You'll use the Gemini API to help you generate ideas for your next blog post, based on voice memos you recorded on your phone, and previous articles you've written.
- Translate a public domain: In this notebook, you will explore Gemini model as a translation tool, demonstrating how to prepare data, create effective prompts, and save results into a
.txt
file. - Working with Charts, Graphs, and Slide Decks: Gemini models are powerful multimodal LLMs that can process both text and image inputs. This notebook shows how Gemini Flash model is capable of extracting data from various images.
- Entity extraction: Use Gemini API to speed up some of your tasks, such as searching through text to extract needed information. Entity extraction with a Gemini model is a simple query, and you can ask it to retrieve its answer in the form that you prefer.
- Personalized Product Descriptions with Weaviate: Load data into a Weaviate vector DB, build a semantic search system using embeddings from the Gemini API, create a knowledge graph and generate unique product descriptions for personas using the Gemini API and Weaviate.
- Prompting examples: A directory with examples of various prompting techniques.
- JSON Capabilities: A directory with guides containing different types of tasks you can do with JSON schemas.
- Automate Google Workspace tasks with the Gemini API: This codelabs shows you how to connect to the Gemini API using Apps Script, and uses the function calling, vision and text capabilities to automate Google Workspace tasks - summarizing a document, analyzing a chart, sending an email and generating some slides directly. All of this is done from a free text input.
- Langchain examples: A directory with multiple examples using Gemini with Langchain.