Skip to main content
With Google’s Gemini, you can represent text (words, sentences, and blocks of text) in a vectorized form, making it easier to compare and contrast embeddings. For example, two texts that share a similar subject matter or sentiment should have similar embeddings, which can be identified through mathematical comparison techniques such as cosine similarity. For more on how and why you should use embeddings, refer to the Embeddings guide. The Gemini Embedding Model API supports various task types:
Task TypeDescription
retrieval_querySpecifies the given text is a query in a search/retrieval setting.
retrieval_documentSpecifies the given text is a document in a search/retrieval setting. Using this task type requires a title but is automatically proided by Embeddings API
semantic_similaritySpecifies the given text will be used for Semantic Textual Similarity (STS).
classificationSpecifies that the embeddings will be used for classification.
cluseringSpecifies that the embeddings will be used for clustering.
Usage Example: