# Gemini Embedding 2

> Gemini Embedding 2 maps text, images, video, audio and PDFs into one vector space: its dimensions, limits, task prefixes, pricing and migration pitfalls.

Source: https://www.honeyhive.ai/learn/gemini-embedding-2 (updated 2026-11-29)

Gemini Embedding 2 (`gemini-embedding-2`) is the Gemini API's first multimodal embedding model. Google's [embeddings guide](https://aistudio.google.com/docs/embeddings) says it maps text, images, video, audio and documents into one embedding space, which allows cross-modal search, classification and clustering across over 100 languages. A text query can retrieve an image or a PDF page because all of them land in the same vectors.

This page covers the model itself. For how to pick between embedding models, see [embedding models](/learn/embedding-models); for scoring with the vectors, see [semantic similarity](/learn/semantic-similarity).

## Specs at a glance

| Property | Value |
|---|---|
| Model code | `gemini-embedding-2`, per the [model page](https://aistudio.google.com/docs/models/gemini-embedding-2) |
| Input | Text, image, video, audio and PDF, per the [model page](https://aistudio.google.com/docs/models/gemini-embedding-2) |
| Output | A text embedding vector. The default is [3072 dimensions](https://aistudio.google.com/docs/embeddings) |
| Dimensions | [Flexible from 128 to 3072](https://aistudio.google.com/docs/models/gemini-embedding-2), with 768, 1536 and 3072 recommended |
| Input limit | [8,192 tokens](https://aistudio.google.com/docs/models/gemini-embedding-2) overall |
| Status | Stable. The model page lists the latest update as April 2026, and the [changelog](https://aistudio.google.com/docs/changelog) says it reached general availability on April 22, 2026 |

## Modalities and limits

The guide's [limits table](https://aistudio.google.com/docs/embeddings) sets per-request caps:

| Input | Limit |
|---|---|
| Text | Up to 8,192 tokens |
| Image | Up to 6 images per request. PNG and JPEG |
| Audio | Up to 180 seconds. MP3 and WAV |
| Video | Up to 120 seconds. MP4 and MOV, with H264, H265, AV1 or VP9 codecs |
| PDF | 1 file per request, up to 6 pages |

For video, Google [says](https://aistudio.google.com/docs/embeddings) the system processes at most 32 frames: videos of 32 seconds or less are sampled at 1 frame per second, and longer ones are sampled uniformly down to 32 frames. Audio tracks inside video files are not processed. If you need the speech in a video, extract it and embed it as audio.

Anything longer than these caps has to be split first. The 8,192-token limit is shared across all modalities, and Google [says](https://aistudio.google.com/docs/embeddings) inputs over it are silently truncated. For PDFs it strongly recommends 1 page per file for the best quality. Splitting text follows the usual [chunking strategies](/learn/chunking-strategies); for a long PDF, that means batches of pages.

## Basic call

Google's quickstart uses `embedContent`:

```python
from google import genai

client = genai.Client()

result = client.models.embed_content(
        model="gemini-embedding-2",
        contents="What is the meaning of life?"
)

print(result.embeddings)
```

## One embedding or many

This is the behavior change most likely to bite. A note in the [guide](https://aistudio.google.com/docs/embeddings) says that `gemini-embedding-001` returns an embedding per string in a list, while Gemini Embedding 2 produces a single aggregated embedding for multiple inputs. The docs describe three patterns:

- Several parts passed directly in `contents` give one aggregated embedding for all of them.
- Each input wrapped in its own `Content` object gives a separate embedding per entry.
- For an object such as a social post with several media items, Google [recommends](https://aistudio.google.com/docs/embeddings) embedding the pieces separately and aggregating them, for example by averaging.

The [Batch API](https://aistudio.google.com/docs/embeddings) is the other route to many separate embeddings at once. If you pass a list of 100 document chunks as plain parts and expect 100 vectors, you will get one.

## Task types are now prompt prefixes

With `gemini-embedding-001` you set a `task_type` such as `RETRIEVAL_DOCUMENT`. Google's [guide](https://aistudio.google.com/docs/embeddings) says the field cannot be used with `gemini-embedding-2`. For text-only tasks it strongly recommends putting the task instruction in the text itself:

| Use case | Query | Document |
|---|---|---|
| Search query | `task: search result \| query: {content}` | `title: {title} \| text: {content}` (use `title: none` without a title) |
| Question answering | `task: question answering \| query: {content}` | `title: {title} \| text: {content}` |
| Fact checking | `task: fact checking \| query: {content}` | `title: {title} \| text: {content}` |
| Code retrieval | `task: code retrieval \| query: {content}` | `title: {title} \| text: {content}` |

Symmetric tasks use one format for both sides: `task: classification | query: {content}`, `task: clustering | query: {content}` and `task: sentence similarity | query: {content}`. Google [warns](https://aistudio.google.com/docs/embeddings) that the sentence similarity format is for semantic textual similarity and should not be used for search or retrieval.

Two rules from the docs:

- Use the task format consistently. If documents are embedded with the classification format, the queries must be too.
- When one embedding comes from multimodal input, Google generally [does not recommend](https://aistudio.google.com/docs/embeddings) prefixing the text part. It says a prefix helps in some cases and hurts in others, so test it on your data.

## Choosing a dimension

Both `gemini-embedding-001` and `gemini-embedding-2` are [trained](https://aistudio.google.com/docs/embeddings) with Matryoshka Representation Learning, so a prefix of the vector is still a useful embedding. Set `output_dimensionality` to shorten it:

```python
config=types.EmbedContentConfig(output_dimensionality=768)
```

Google [publishes](https://aistudio.google.com/docs/embeddings) MTEB scores by size, without saying which of its two models they come from, and notes that quality is not strictly tied to dimension:

| Dimensions | MTEB score |
|---|---|
| 2048 | 68.16 |
| 1536 | 68.17 |
| 768 | 67.99 |
| 512 | 67.55 |
| 256 | 66.19 |
| 128 | 63.31 |

The table is Google's, and it does not list 3072. Use it as a guide to the shape of the trade-off, then measure retrieval on your own queries before cutting storage. See [embedding models](/learn/embedding-models) for how to run that test.

Normalization differs by model. Gemini Embedding 2 [automatically normalizes](https://aistudio.google.com/docs/embeddings) vectors shortened below 3072 dimensions. With `gemini-embedding-001` you had to normalize non-3072 vectors yourself, so code carried over from that model does not need the extra step here.

## Pricing

Google's [model page](https://aistudio.google.com/docs/models/gemini-embedding-2) lists these paid-tier prices per 1 million tokens in USD, as of November 2026. Prices change, so confirm them before budgeting.

| Input | Standard | Batch |
|---|---|---|
| Text | $0.20 | $0.10 |
| Image | $0.45 ($0.00012 per image) | $0.225 ($0.00006 per image) |
| Audio | $6.50 ($0.00016 per second) | $3.25 ($0.00008 per second) |
| Video | $12.00 ($0.00079 per frame) | $6.00 ($0.000395 per frame) |

The standard tier has a free tier, which the page says is used to improve Google's products. The paid tier is not. The batch tier has no free option. Google's guide [says](https://aistudio.google.com/docs/embeddings) the Batch API gives much higher throughput at 50% of the default price, which matches the table. Audio and video cost far more per token than text, so a media-heavy corpus is where the bill concentrates.

## Migrating

Two separate moves are easy to confuse.

**From gemini-embedding-2-preview.** Google's [changelog](https://aistudio.google.com/docs/changelog) marks the preview model as deprecated and says that from November 6, 2026, requests to it route to `gemini-embedding-2`, with the same API schema, pricing and embedding space. The entry says no other code changes or vector re-indexing are needed. Changing the model string to `gemini-embedding-2` is still the clean fix, since a routed name is a name Google can retire.

**From gemini-embedding-001.** This one is a real migration. The [guide](https://aistudio.google.com/docs/embeddings) says the embedding spaces are incompatible, so you cannot compare vectors across the two models and must re-embed all existing data. A checklist drawn from the docs:

1. Re-embed the whole corpus, since vectors from the two models cannot be compared.
2. Replace `task_type` with the prompt prefixes above.
3. Check any call that passes a list, because it now returns one aggregated embedding unless you wrap each item in a `Content` object or use the Batch API.
4. Drop manual normalization for shortened vectors.

Google also [says](https://aistudio.google.com/docs/embeddings) `gemini-embedding-001` remains available for text-only use cases, so staying on it is a valid choice if you do not need other modalities.

## Common pitfalls

- **Mixing vectors from two models in one index.** Similarity scores between them are meaningless.
- **Missing or inconsistent prefixes.** Documents embedded with one task format and queries with another degrade retrieval.
- **Expecting a vector per list item.** See the aggregation section.
- **Exceeding per-request caps.** 6 images, 180 seconds of audio, 120 seconds of video and 6 PDF pages per request.
- **Assuming video audio is searchable.** The audio track is not processed.
- **Choosing a dimension by guess.** Test 768 against 3072 on real queries.

## Where it fits in a retrieval stack

Embeddings are the first stage of [semantic search](/learn/semantic-search) and a [RAG pipeline](/learn/rag-pipeline). Google lists [retrieval-augmented generation](https://aistudio.google.com/docs/embeddings), information retrieval, search reranking, anomaly detection, classification and clustering as use cases. Pairing vector search with keyword search is covered in [hybrid search](/learn/hybrid-search), and a model that reorders the top results is covered in [reranking](/learn/reranking). To judge whether a change of embedding model helped, use a [golden dataset](/learn/golden-dataset) and the metrics in [RAG evaluation](/learn/rag-evaluation).

## Tracing embedding calls in HoneyHive

HoneyHive's [Gemini integration guide](https://docs.honeyhive.ai/v2/integrations/gemini.md) says it traces Gemini chat, embeddings and multimodal requests with OpenInference. HoneyHive's [multi-modal tracing guide](https://docs.honeyhive.ai/v2/tracing/multi-modal.md) advises storing references such as paths, URLs or IDs instead of raw media bytes. That fits an embedding pipeline over images, audio or video: log which model and prefix produced each vector, so a retrieval regression after a migration can be traced to its cause.

## FAQ

### What is Gemini Embedding 2?

It is Google's first multimodal embedding model in the Gemini API. Google's [docs](https://aistudio.google.com/docs/embeddings) say it maps text, images, video, audio and documents into a unified embedding space, with support for over 100 languages. The model code is `gemini-embedding-2`.

### How many dimensions does Gemini Embedding 2 output?

3072 by default. The [model page](https://aistudio.google.com/docs/models/gemini-embedding-2) says any size from 128 to 3072 is supported and recommends 768, 1536 or 3072. Set `output_dimensionality` to shorten the vector.

### Can I mix Gemini Embedding 2 and gemini-embedding-001 vectors?

No. Google's [migration notes](https://aistudio.google.com/docs/embeddings) say the two embedding spaces are incompatible, so moving to Gemini Embedding 2 means re-embedding all existing data.

### Does Gemini Embedding 2 support task_type?

No. The [embeddings guide](https://aistudio.google.com/docs/embeddings) says the `task_type` field cannot be used with it. For text, put the task in the prompt, for example `task: search result | query: {content}`.

### What happened to gemini-embedding-2-preview?

Google's [changelog](https://aistudio.google.com/docs/changelog) says requests to it route to `gemini-embedding-2` from November 6, 2026, and that no other code changes or vector re-indexing are needed. Update the model string anyway.
