Skip to content

Gemini Embedding 2

Gemini Embedding 2 is Google's first natively multimodal embedding model, mapping text, images, video, audio, and documents into a single unified embedding space with support for interleaved multi-modal inputs and over 100 languages.

index.ts
import { embed } from 'ai';
const result = await embed({
model: 'google/gemini-embedding-2',
value: 'Sunny day at the beach',
})

Frequently Asked Questions

  • What modalities does Gemini Embedding 2 support?

    Text (up to 8,192 tokens), images (up to six per request, PNG and JPEG), video (up to 120 seconds, MP4 and MOV), audio (natively, without intermediate transcription), and documents (PDFs up to six pages).

  • What does it mean that all modalities share a single embedding space?

    Vectors produced from text, images, video, audio, and documents are directly comparable. A text query can retrieve semantically relevant images, or an audio clip can be compared to a PDF. No cross-modal alignment layers on top of separate per-modality models are needed.

  • Can I pass multiple modalities in a single embedding request?

    Yes. The model natively understands interleaved input, so you can pass an image and its text caption together. It captures the relationships between modalities in a single embedding.

  • How does the text context window in Gemini Embedding 2 compare to gemini-embedding-001?

    Gemini Embedding 2 supports up to 8,192 input tokens for text, four times the 2,048-token limit of gemini-embedding-001, making it better suited for embedding longer documents.

  • Does Gemini Embedding 2 use Matryoshka Representation Learning?

    Yes. Like gemini-embedding-001, it uses MRL to allow output dimensions to scale down from the default 3,072. Google recommends 3,072, 1,536, or 768 for highest quality results.

  • What vector database and framework integrations are available?

    Supported integrations include LangChain, LlamaIndex, Haystack, Weaviate, Qdrant, ChromaDB, and Vector Search.

  • What does Gemini Embedding 2 cost on AI Gateway?

    Pricing appears on this page and updates as providers adjust their rates. AI Gateway routes traffic through the configured provider.