Embeddings OpenAI (Proxy) icon

Embeddings OpenAI (Proxy)

Generate text embeddings with OpenAI models using an optional HTTP(S) proxy.

Overview

This node generates text embeddings using OpenAI models, with support for routing requests through an optional HTTP/HTTPS proxy. Text embeddings are numerical vector representations of text that capture semantic meaning, useful in tasks like search, clustering, recommendation, and natural language understanding.

Common scenarios where this node is beneficial include:

  • Creating vector representations of documents or sentences to enable semantic search in a vector store.
  • Generating embeddings for downstream AI workflows such as similarity matching or classification.
  • Integrating OpenAI embedding capabilities into automated pipelines while respecting network proxy requirements.

For example, you might use this node to convert a batch of product descriptions into embeddings, then store them in a vector database to power a semantic product search feature.

Properties

Name Meaning
This node must be connected to a vector store. Insert one A notice indicating the node requires connection to a vector store node to function properly.
Model The OpenAI model used to generate embeddings. Default is text-embedding-3-small.
Options Additional options to customize the embedding request:
Base URL: Override the default API base URL.
Batch Size: Max number of documents per request (max 2048).
Dimensions: Output embedding size (256, 512, 1024, 1536, 3072).
Strip New Lines: Whether to remove new lines from input text.
Timeout: Max request time in seconds (-1 means no timeout).
Proxy URL Optional HTTP/HTTPS proxy URL (supports basic authentication). Leave empty to connect directly without proxy.

Output

The node outputs data on the ai_embedding output channel with the following structure:

  • json: Contains the generated embeddings for the input text(s). Each embedding is a numeric vector representing the semantic content of the input.
  • No binary data output is produced by this node.

The embeddings can be directly consumed by vector stores or other nodes requiring vector representations.

Dependencies

  • Requires an API key credential for OpenAI to authenticate requests.
  • Supports configuration of an HTTP/HTTPS proxy via the "Proxy URL" property.
  • Uses the @langchain/openai package internally to interact with OpenAI's embedding API.
  • Optionally overrides the API base URL if specified.

Troubleshooting

  • Invalid API Key or Authentication Errors: Ensure the provided API key credential is valid and has permissions to access the OpenAI embeddings endpoint.
  • Proxy Connection Issues: If using a proxy, verify the proxy URL is correct and accessible. Check for required authentication details if applicable.
  • Timeouts: Requests may time out if the "Timeout" option is set too low or network latency is high. Increase the timeout or set it to -1 for no timeout.
  • Batch Size Too Large: Setting batch size above the maximum allowed (2048) may cause errors. Reduce batch size accordingly.
  • Unsupported Dimensions: Only certain embedding dimensions are supported depending on the model; ensure the selected dimension matches the model capabilities.

Links and References

Discussion