gemini-2.5-pro| input-price: 1.25 output-price: 10 max-context-length: 200_000 (cost: $0.02) Β· Anfrage: 2025-07-28T09:05:51.752455
Generated by rs-summarizer Version unbekannt
Abstract:
This document serves as a technical guide to the text embedding models available through the Google Gemini API, with a focus on the newest model, gemini-embedding-001. It details how these models convert text into numerical vector representations to power advanced Natural Language Processing (NLP) applications such as semantic search, classification, clustering, and particularly Retrieval-Augmented Generation (RAG). The guide outlines key features for optimizing performance, including the use of task_type to tailor embeddings for specific functions and the ability to control embedding size via output_dimensionality. This dimensionality control, enabled by Matryoshka Representation Learning (MRL), allows for more efficient storage and computation. The document provides code examples for generating embeddings, explains the necessity of normalizing smaller-dimension vectors, lists common use cases, and recommends vector database solutions for storage in production environments.
A Guide to Gemini API Text Embeddings
gemini-embedding-001 being the newest, to convert text (words, phrases, sentences, and code) into numerical vectors. These embeddings are foundational for advanced AI tasks.embedContent method. It can process a single string of text or a list of strings for batch processing, improving efficiency.task_type in your request. Supported types include SEMANTIC_SIMILARITY, CLASSIFICATION, RETRIEVAL_DOCUMENT (for documents being searched), and RETRIEVAL_QUERY (for the search query itself).gemini-embedding-001 model uses Matryoshka Representation Learning (MRL), which allows you to truncate the default 3072-dimension vector to smaller sizes (e.g., 768, 1536) using the output_dimensionality parameter. This reduces storage and computational costs with minimal loss in quality.gemini-embedding-001 is the current, recommended model. Legacy models (embedding-001 and text-embedding-004) are being deprecated and should be avoided for new projects.