When to use it
Gemini Embedding 2 (gemini-embedding-2) is a dense text embedding model from Google. Pinecone offers it for integrated embedding on document indexes, so you upsert and search with text and Pinecone embeds it through Google Vertex AI.The model embeds text differently for each task you choose with task_type, such as retrieval_document for stored text, question_answering or fact_verification for queries, or clustering for grouping texts. You can also override the query task for one search.Inputs, limits, and pricing
Monthly and per-minute limits depend on your plan. See Rate limits.
Quickstart
Installation
Integrated embedding on document indexes requires Python SDK10.1.0, Node.js SDK 9.1.0, or Go SDK 7.1.0 or later.Create index
This creates a document index whosechunk_text field embeds with gemini-embedding-2 at 768 dimensions. The field’s write task defaults to retrieval_document, and its queries default to retrieval_query.Embed & upsert
Upsert documents with plain text on the embedded field. Pinecone embeds each value on write, up to 96 documents per request.Query
Search with anembed clause, and Pinecone embeds the query text with the field’s read task.Parameters
Set these in the field’swrite_parameters and read_parameters. Set dimension and processing_location on the embed object itself, as embed.dimension and embed.processing_location. Putting either one in write_parameters or read_parameters returns a 400.Task types
Each task type is a write task, a query task, or a symmetric task. Set the write task in the field’swrite_parameters and the default query task in its read_parameters. A symmetric task embeds stored text and queries the same way, for comparing texts with each other rather than searching. For which tasks a field accepts, see Set task types on the field.For a field you search, the defaults fit general search. If a field’s queries are mostly questions answered by the stored text, claims to check against it, or plain-language lookups for code, set the matching query task in its read_parameters, or override the query task for one search. Use a symmetric task only for a field whose texts you compare with each other instead of searching, because you can’t change a field’s write task after you create the index.The model reads the task from a short prompt at the start of each input, in the formats Google defines in Task types with Embeddings 2. Pinecone adds the prompt for you from the task type, so send plain text and don’t add a prompt yourself.
retrieval_document uses Google’s document format, which has a title slot instead of a task, and Pinecone always sets the title to none. A symmetric task adds the same prompt to stored text and to queries. For example, a search for “Is the Eiffel Tower taller than 300 m?” on a field whose read_parameters.task_type is question_answering reaches the model as:Question answering prompt
embed_total_tokens, and it counts toward the 8,192-token limit, so with truncate: NONE the text itself can be at most about 8,185 tokens. A value truncated at the limit can report up to 8,256 tokens.Override the query task
To embed one query with a different task, setparameters on the embed clause. The Python SDK supports parameters in 10.3.0 and later. The Node.js and Go SDKs don’t support it yet, so use the REST API with them. This search embeds its query as a question with question_answering:Use a symmetric task
This creates an index that embeds support tickets withclustering. Its queries use clustering too, so a search returns the tickets most similar to the one you pass in, which you can use to find duplicates or group related issues.Good to know
- Dimension: 3,072 by default, or any integer from 128 to 3,072. The metric is
cosineonly. - Input: Text only. Pinecone doesn’t support image, audio, or video input for this model yet.
- Processing location:
globalonly. See Processing locations. - Availability: Integrated embedding on document indexes only, on the Builder, Standard, and Enterprise plans.