Prompt Buddy logoPrompt Buddy

google · Google AI Docs

Gemini API Embeddings

An overview of how to generate vector representations of text using the Gemini API to enable semantic search and similarity tasks.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Gemini API Embeddings

An overview of how to generate vector representations of text using the Gemini API to enable semantic search and similarity tasks.

When To Use

Use when you need to convert text into numerical vectors for semantic search, clustering, or similarity comparisons within an application.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/gemini-api-embeddings-workflow-guide.mdA guide explaining how to generate embeddings for text, images, and video using the Gemini API.Questions about a guide explaining how to generate embeddings for text, images, and video using the Gemini API.
examples/gemini-api-embeddings-python-embedcontent.textA Python code example demonstrating how to use the genai client to generate embeddings for text content using the gemini-embedding-2 model.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the genai client to generate embeddings for text content using the gem...
examples/gemini-api-embeddings-nodejs-embed.textA Node.js code example demonstrating how to use the GoogleGenAI SDK to generate content embeddings using the gemini-embedding-2 model.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the GoogleGenAI SDK to generate content embeddings using the gemini-e...
examples/gemini-api-embeddings-golang-embedcontent.textA Go program demonstrating how to use the genai client to generate content embeddings for a text string.Exact payloads, commands, or snippets shown in A Go program demonstrating how to use the genai client to generate content embeddings for a text string.
examples/gemini-api-embeddings-curl-request.textA curl command demonstrating how to send a POST request to the gemini-embedding-2 model endpoint to generate text embeddings.Exact payloads, commands, or snippets shown in A curl command demonstrating how to send a POST request to the gemini-embedding-2 model endpoint to generate text emb...
examples/gemini-api-embeddings-python-query-preparation.textPython code demonstrating how to format task-specific query strings for generating embeddings.Exact payloads, commands, or snippets shown in Python code demonstrating how to format task-specific query strings for generating embeddings.
examples/gemini-api-embeddings-python-query-document-preparation.textA Python function demonstrating how to format text content with specific task prefixes for embedding generation.Exact payloads, commands, or snippets shown in A Python function demonstrating how to format text content with specific task prefixes for embedding generation.
examples/gemini-api-embeddings-python-embedcontent-2.textA Python code example demonstrating how to use the genai client to generate embeddings for multiple text strings using the embedcontent method.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the genai client to generate embeddings for multiple text strings usin...
examples/gemini-api-embeddings-nodejs-semantic-similarity.textA Node.js code example demonstrating how to generate text embeddings using the Gemini API with a semantic similarity task type.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to generate text embeddings using the Gemini API with a semantic similarity...
examples/gemini-api-embeddings-golang-cosine-similarity.textA Go implementation demonstrating how to calculate cosine similarity between two embedding vectors.Exact payloads, commands, or snippets shown in A Go implementation demonstrating how to calculate cosine similarity between two embedding vectors.
examples/gemini-api-embeddings-curl-embedcontent-request.textA curl command demonstrating how to call the embedContent endpoint using the gemini-embedding-001 model with a SEMANTIC_SIMILARITY task type.Exact payloads, commands, or snippets shown in A curl command demonstrating how to call the embedContent endpoint using the gemini-embedding-001 model with a SEMANT...
examples/gemini-api-embeddings-python-embedcontent-3.textA Python code example demonstrating how to use the genai client to generate content embeddings with a specified output dimensionality.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the genai client to generate content embeddings with a specified outpu...
examples/gemini-api-embeddings-nodejs-embed-2.textA Node.js code example demonstrating how to generate content embeddings using the GoogleGenAI SDK with a specified output dimensionality.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to generate content embeddings using the GoogleGenAI SDK with a specified ou...
examples/gemini-api-embeddings-golang.textA Go program demonstrating how to initialize a GenAI client and generate text embeddings using the Gemini API.Exact payloads, commands, or snippets shown in A Go program demonstrating how to initialize a GenAI client and generate text embeddings using the Gemini API.
examples/gemini-api-embeddings-curl-request-2.textA curl command demonstrating how to send a POST request to the gemini-embedding-2 model to generate text embeddings.Exact payloads, commands, or snippets shown in A curl command demonstrating how to send a POST request to the gemini-embedding-2 model to generate text embeddings.
examples/gemini-api-embeddings.textA text representation of a sample embedding response showing the vector length of 768.Exact payloads, commands, or snippets shown in A text representation of a sample embedding response showing the vector length of 768.
examples/gemini-api-embeddings-numpy-normalization.textA Python code snippet demonstrating how to normalize Gemini API embedding vectors using NumPy.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to normalize Gemini API embedding vectors using NumPy.
examples/gemini-api-embeddings-normed-length.textA text example demonstrating the normed embedding length and norm values for Gemini API embeddings.Exact payloads, commands, or snippets shown in A text example demonstrating the normed embedding length and norm values for Gemini API embeddings.
examples/gemini-api-embeddings-python-multimodal-embedcontent.textA Python code example demonstrating how to use the Gemini API to generate embeddings for image data using the genai client.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Gemini API to generate embeddings for image data using the genai c...
examples/gemini-api-embeddings-nodejs-multimodal-image-embedding.textA Node.js code example demonstrating how to generate embeddings for an image using the Gemini API.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to generate embeddings for an image using the Gemini API.
examples/gemini-api-embeddings-multimodal-curl-request.textA curl command demonstrating how to send a base64 encoded image to the gemini-embedding-2 model for multimodal embedding generation.Exact payloads, commands, or snippets shown in A curl command demonstrating how to send a base64 encoded image to the gemini-embedding-2 model for multimodal embedd...
examples/gemini-api-embeddings-python-multimodal-embedcontent-2.textA Python code example demonstrating how to use the genai client to generate embeddings for both text and image content using the gemini-embedding-2 model.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the genai client to generate embeddings for both text and image conten...
examples/gemini-api-embeddings-nodejs-multimodal.textA Node.js code example demonstrating how to generate embeddings for both text and image data using the Gemini API.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to generate embeddings for both text and image data using the Gemini API.
examples/gemini-api-embeddings-curl-multimodal-request.textA curl command demonstrating how to send a multimodal request containing both text and base64 encoded image data to the Gemini embedding model.Exact payloads, commands, or snippets shown in A curl command demonstrating how to send a multimodal request containing both text and base64 encoded image data to t...
examples/gemini-api-embeddings-python-multimodal-embedcontent-3.textA Python code example demonstrating how to use the Gemini API to generate embeddings for both text and image content using the genai client.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Gemini API to generate embeddings for both text and image content...
examples/gemini-api-embeddings-multimodal-nodejs.textA Node.js code example demonstrating how to generate embeddings for both text and image data using the Gemini API.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to generate embeddings for both text and image data using the Gemini API.
examples/gemini-api-embeddings-gemini-api-batch-embed-contents-curl.textA curl command demonstrating how to send a batch request to the gemini-embedding-2 model using the batchEmbedContents endpoint.Exact payloads, commands, or snippets shown in A curl command demonstrating how to send a batch request to the gemini-embedding-2 model using the batchEmbedContents...
examples/gemini-api-embeddings-python-audio-embedcontent.textA Python code example demonstrating how to use the Gemini API to generate embeddings from an audio file using the embedcontent method.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the Gemini API to generate embeddings from an audio file using the emb...
examples/gemini-api-embeddings-nodejs-audio-embed.textA Node.js code example demonstrating how to generate embeddings for audio data using the GoogleGenAI SDK.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to generate embeddings for audio data using the GoogleGenAI SDK.
examples/gemini-api-embeddings-audio-curl-request.textA curl command demonstrating how to generate embeddings for audio data using the Gemini API.Exact payloads, commands, or snippets shown in A curl command demonstrating how to generate embeddings for audio data using the Gemini API.
examples/gemini-api-embeddings-gemini-api-python-embedcontent-video.textA Python code snippet demonstrating how to use the Gemini API to generate embeddings from video file bytes using the genai client.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use the Gemini API to generate embeddings from video file bytes using the...
examples/gemini-api-embeddings-nodejs-video.textA Node.js code example demonstrating how to generate embeddings for video content using the GoogleGenAI SDK.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to generate embeddings for video content using the GoogleGenAI SDK.
examples/gemini-api-embeddings-video-embedcontent-curl.textA curl command demonstrating how to generate embeddings for a video file using the gemini-embedding-2 model.Exact payloads, commands, or snippets shown in A curl command demonstrating how to generate embeddings for a video file using the gemini-embedding-2 model.
examples/gemini-api-embeddings-gemini-api-python-embedcontent-pdf.textA Python code snippet demonstrating how to use the Gemini API to generate embeddings from a PDF file using the genai client.Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to use the Gemini API to generate embeddings from a PDF file using the genai...
examples/gemini-api-embeddings-nodejs-pdf-embedding.textA Node.js code example demonstrating how to generate embeddings from a base64 encoded PDF file using the GoogleGenAI SDK.Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to generate embeddings from a base64 encoded PDF file using the GoogleGenAI...
examples/gemini-api-embeddings-pdf-curl-request.textA curl command demonstrating how to generate embeddings for a PDF file using the Gemini API.Exact payloads, commands, or snippets shown in A curl command demonstrating how to generate embeddings for a PDF file using the Gemini API.

What This Skill Covers

  • The Gemini API offers embedding models to generate embeddings for text, images, video, and other content. These resulting embeddings can then be used for tas...
  • Main sections: Generating embeddings, Python, JavaScript, Go, REST.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://ai.google.dev/gemini-api/docs/embeddings