Original Embedding Node icon

Original Embedding Node

Generate embeddings using a custom embedding server

Overview

This node generates vector embeddings for text data by sending requests to a custom embedding server compatible with OpenAI's embedding API. It is useful in scenarios where you want to convert textual content into numerical vectors for tasks such as semantic search, recommendation systems, or natural language understanding.

Typical use cases include:

  • Creating embeddings for documents or sentences to enable similarity searches.
  • Processing multiple texts to generate embeddings for downstream AI workflows.
  • Integrating with a self-hosted or third-party embedding service that follows the OpenAI-compatible API format.

For example, you can input a string of text or an array of strings, and the node will return their corresponding embeddings by calling your specified embedding server endpoint.

Properties

Name Meaning
Endpoint URL The URL of your custom embedding server API endpoint (e.g., https://your-server.com/api/v1/openai-compatible/embeddings). This is required.
Batch Processing Whether to send multiple texts in a single API call for better performance (true or false).

Output

The node outputs an array of items, each containing a JSON object with the following structure:

  • embedding: An array of numbers representing the vector embedding of the input text.
  • text: The original input text that was embedded.
  • metadata (optional): If the input item contains metadata alongside the text, it is preserved here.

Output examples based on input types:

  • For a single string input:

    {
      "embedding": [0.123, 0.456, ...],
      "text": "Your input text"
    }
    
  • For an array of strings input:

    [
      {
        "embedding": [0.123, 0.456, ...],
        "text": "First string"
      },
      {
        "embedding": [0.789, 0.012, ...],
        "text": "Second string"
      }
    ]
    
  • For an object input with pageContent and optional metadata:

    {
      "embedding": [0.123, 0.456, ...],
      "text": "Page content text",
      "metadata": { "key": "value" }
    }
    

The node does not output binary data.

Dependencies

  • Requires access to a custom embedding server that exposes an OpenAI-compatible embeddings API endpoint.
  • Requires an API key credential configured in n8n for authenticating requests to the embedding server.
  • The node uses HTTP POST requests to communicate with the embedding server.

Troubleshooting

  • Missing Endpoint URL: If the "Endpoint URL" property is empty, the node will throw an error indicating that the endpoint is required. Ensure this field is correctly set.
  • Invalid Input Format: The node expects input data to be either a string, an array of strings, or an object with a pageContent string property. Providing other formats will cause an error.
  • Invalid Response Format: If the embedding server returns a response that does not contain a data array with embedding vectors, the node will raise an error about invalid response format. Verify that your embedding server complies with the expected API response structure.
  • Batch Processing Disabled: When batch processing is disabled, multiple inputs are processed individually, which may impact performance.
  • Authentication Errors: Ensure the API key credential is valid and has proper permissions to access the embedding server.

Links and References

Discussion