Skip to main content

Batch Embeddings

Generates embeddings for multiple text inputs using Google's Gemini API.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Connection Id - The connection ID obtained from the Connect node.
  • Contents - An array of text strings to generate embeddings for.

Options

  • TaskType - The type of task for which the embeddings will be used. Options include:
    • Retrieval Query
    • Retrieval Document
    • Semantic Similarity
    • Classification
    • Clustering
    • Question Answering
    • Fact Verification
  • Embedding Model - The model to use for generating embeddings. Default is "text-embedding-004".
  • Title - Title for RETRIEVAL_DOCUMENT task type.
  • Output Dimensionality - Reduced dimension count (e.g., 256).
  • Truncate - Whether to truncate inputs longer than max tokens. Default is true.

Output

  • Embeddings - The generated embeddings as an array of values with associated metadata.

How It Works

The Batch Embeddings node generates embeddings for multiple text inputs using Google's Gemini API. When executed, the node:

  1. Validates the provided connection ID and content inputs
  2. Ensures the content array is not empty and doesn't exceed 100 texts
  3. Retrieves the configured embedding model (defaults to "text-embedding-004" if not specified)
  4. Builds the embedding configuration with optional parameters like task type, title, and output dimensionality
  5. Generates embeddings for each text in the content array
  6. Returns a structured response containing the embeddings, model information, and metadata

Requirements

  • A valid Google Gemini API key
  • Connection ID from a successful Connect node execution
  • An array of text strings to generate embeddings for

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Connection Id
  • Empty or invalid Contents array
  • Too many contents (maximum 100 texts allowed per batch)
  • Empty text found in contents array
  • Invalid output dimensionality value
  • API errors from Google's Gemini service

Usage Notes

  • The maximum number of texts allowed per batch is 100
  • The Title option is only supported for RETRIEVAL_DOCUMENT task type
  • Output dimensionality must be a positive integer if specified
  • Each text in the contents array must be non-empty
  • The embeddings output includes statistics like token count and truncation information when available