Actions20
- Assistant Actions
- Embedding Actions
- File Actions
- Report Actions
- Text Actions
- Thread Actions
Overview
The "Create Embeddings" operation of the Text resource in this OpenAI Analytics node generates vector embeddings from input text data using OpenAI's embedding models. This operation transforms textual information into numerical vectors that capture semantic meaning, enabling advanced use cases such as similarity search, clustering, and machine learning.
Common scenarios where this node is beneficial:
- Converting product descriptions or documents into embeddings for semantic search.
- Preparing text data for machine learning models that require numeric input.
- Generating embeddings to compare similarity between texts.
- Creating feature vectors for recommendation systems.
Practical example:
You have a list of customer reviews and want to find which reviews are semantically similar. You can use this node to create embeddings for each review, then calculate similarity scores externally to group related reviews.
Properties
Name | Meaning |
---|---|
Authentication | Choose between two types of API credentials: - OpenAI Analytics API - OpenAI API |
Additional input properties specific to the "Create Embeddings" operation (extracted from bundled code and property definitions):
Name | Meaning |
---|---|
Model | The embedding model to use (e.g., text-embedding-ada-002 ). |
Input Type | Type of input text: - Single Text - Multiple Texts (comma-separated) - JSON Input (array of texts) |
Text | The single text string to embed (required if Input Type is Single Text). |
Texts | Array of texts to embed, provided as multiple values (required if Input Type is Multiple Texts). |
JSON Input | 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. - 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, each containing a json
field with the embedding results. The structure typically includes:
- The original input text(s).
- The generated embedding vector(s), either as an array of floats or base64 encoded string depending on the encoding format option.
If binary data is involved (not typical for embeddings), it would be summarized accordingly, but this operation focuses on JSON embedding vectors.
Dependencies
- Requires valid API credentials for OpenAI services, either via dedicated OpenAI Analytics API credentials or standard OpenAI API credentials.
- Uses OpenAI's official SDK to interact with the embedding endpoints.
- Network access to OpenAI API endpoints (default base URL:
https://api.openai.com/v1
unless overridden).
Troubleshooting
- Error loading credentials: Ensure that the API key credential is correctly configured in n8n and has permissions for embedding operations.
- Unsupported resource error: This node only supports predefined resources; ensure "Text" resource and "Create Embeddings" operation are selected.
- Invalid input errors: When providing multiple texts or JSON input, ensure the format matches the expected type (e.g., valid JSON array).
- Model not found or invalid: If the selected embedding model is unavailable, try selecting a default or supported model like
text-embedding-ada-002
. - API rate limits or network issues: Check your OpenAI account limits and network connectivity.
Links and References
- OpenAI Embeddings Documentation
- OpenAI API Reference - Embeddings
- n8n Documentation - Creating Custom Nodes
Summary of execute() logic for Resource: Text, Operation: Create Embeddings
- Retrieves input data items.
- For each item:
- Reads parameters: resource ("text"), operation ("create").
- Initializes OpenAI client with appropriate credentials.
- Calls the embedding handler function with parameters including model, input type, and text(s).
- Embedding handler calls OpenAI's embeddings API to generate embeddings.
- Collects all results into output array.
- Supports error handling with continue-on-fail option.
This node operation enables transforming text inputs into meaningful vector representations using OpenAI's embedding models within n8n workflows.