Gemini AI Studio icon

Gemini AI Studio

Use the Google Gemini API through direct AI Studio REST calls

Actions16

Embedding → Embed Content

AI-generated

Summary

Generate a single embedding vector for a given text or raw JSON input using a specified Gemini embedding model.

Inputs

  • Model (required) — ID or resource name of the embedding model to use, e.g., 'gemini-embedding-2'. Models are selectable via the 'getModels' method.
  • Input Mode (required) — Select between 'Simple Text' mode, where raw text is provided, or 'Raw Request JSON' mode, where a complete JSON request body is sent directly.
  • Text — The plain text to embed. Required only when Input Mode is 'Simple Text'.
  • Raw Request Body (JSON) — Complete JSON request body sent to the Gemini ':embedContent' API endpoint, used only when Input Mode is 'Raw Request JSON'.
  • Options — Optional parameters including output dimensionality (vector size), task type (e.g., semantic similarity, classification), and an optional title (for retrieval-document embeddings).

Output shape

A single JSON object containing the embedding model name, the generated embedding vector (array of numbers), and the full API response.

The embedding vector can vary in size depending on 'Output Dimensionality' specified in options. The output JSON includes the raw API response for additional details.

Examples

Example 1: Embed a simple text string using the default Gemini embedding model to generate a semantic similarity vector.

Set resource to 'Embedding', operation to 'Embed Content', model to 'gemini-embedding-2', input mode to 'Simple Text', and provide the text to embed.

Links

Discussion