OpenAI Analytics icon

OpenAI Analytics

Use OpenAI Analytics API

Overview

This node enables the creation of text embeddings using OpenAI's embedding models via the OpenAI Analytics API or the standard OpenAI API. Embeddings are numerical vector representations of text that capture semantic meaning, useful for tasks such as semantic search, clustering, recommendation systems, and natural language understanding.

Typical use cases include:

  • Converting single or multiple pieces of text into embeddings for similarity comparison.
  • Preparing data for machine learning models that require vector inputs.
  • Enhancing search functionality by comparing query embeddings with document embeddings.
  • Classifying or clustering texts based on their semantic content.

For example, you can input a product description and get its embedding to find similar products, or embed customer feedback texts to analyze sentiment clusters.

Properties

Name Meaning
Authentication Choose between using dedicated OpenAI Analytics API credentials or existing OpenAI API credentials.
Model The embedding model to use. Options are dynamically loaded from available embedding models (e.g., text-embedding-ada-002).
Input Type The type of input to embed:
- Single Text: A single string.
- Multiple Texts: An array of strings.
- JSON Input: A JSON string containing an array of texts.
Text The single text string to embed (required if Input Type is Single Text).
Texts The list of texts to embed, entered as multiple values separated by commas (required if Input Type is Multiple Texts).
JSON Input A JSON array of texts to embed (required if Input Type is JSON Input).
Options Additional options for embedding:
- Dimensions: Number of dimensions for output embeddings (only for certain newer models).
- Encoding Format: Format of returned embeddings (float or base64).
- User: Unique identifier for end-user to help monitor abuse.

Output

The node outputs an array of items where each item contains a json field with the embedding results. Each embedding corresponds to one input text and includes the embedding vector in the specified encoding format (float array or base64 string).

If multiple texts are embedded, the output will contain multiple embedding vectors accordingly.

Binary data output is not applicable for this operation.

Dependencies

  • Requires valid API credentials for either the OpenAI Analytics API or the standard OpenAI API.
  • The node dynamically loads available embedding models from the API.
  • No additional external dependencies beyond the OpenAI API client.

Troubleshooting

  • Credential Errors: If the node cannot load credentials, ensure that the API key credential is correctly configured in n8n and has access to the required OpenAI services.
  • Model Not Found: If no embedding models are found, verify your API access and permissions.
  • Input Validation: Ensure that the input text(s) are provided according to the selected Input Type. For JSON Input, the JSON must be a valid array of strings.
  • Dimension Option: Specifying dimensions for unsupported models may cause errors; omit this option unless using supported newer models.
  • API Rate Limits: Large batches or frequent requests may hit rate limits; consider batching or adding delays.

Links and References

Discussion