Actions20
- Assistant Actions
- Embedding Actions
- File Actions
- Report Actions
- Text Actions
- Thread Actions
Embedding → Embedding Based Classify
AI-generatedOverview
The "Embedding Based Classify" operation in this node enables classification of input text by comparing its embedding vector with embeddings of predefined categories. It uses OpenAI embedding models to convert text into numerical vectors and then measures similarity scores to determine the best matching category or multiple categories above a threshold.
This node is useful when you want to categorize or label text data based on semantic similarity rather than keyword matching. For example, it can classify customer feedback into sentiment categories, group support tickets by topic, or tag documents by subject area using vector similarity.
Practical examples:
- Automatically assign incoming emails to departments based on content similarity.
- Classify product reviews into categories like "quality", "delivery", or "customer service".
- Group news articles by topics using semantic embeddings.
Properties
| Name | Meaning |
|---|---|
| Authentication | Choose between using dedicated OpenAI Analytics API credentials or existing OpenAI API credentials for authentication. |
| Target Text | The text string that you want to classify using embeddings. |
| Model | The embedding model used to generate embeddings for classification. Options are dynamically loaded but include models like text-embedding-3-small. |
| Categories Mode | Whether to create new category embeddings from provided category names ("Create New Categories") or use previously saved category embeddings ("Use Saved Categories"). |
| Categories | A collection of categories for classification. Each category has: - Category name (string) - Optional embedding vector (JSON array). If embedding is empty, it will be auto-generated. |
| Similarity Threshold | Minimum similarity score (0 to 1) required to consider a category as a match. |
| Classification Type | Classification method: - Single (Best Match): returns only the best matching category. - Multiple (All Above Threshold): returns all categories exceeding the threshold. |
| Use Branch Outputs | Boolean flag to enable branching in workflows based on classification results. |
Output
The output JSON contains the classification results of the target text against the specified categories. Depending on the classification type:
- Single (Best Match): Returns the single category with the highest similarity score above the threshold.
- Multiple (All Above Threshold): Returns an array of all categories whose similarity scores exceed the threshold.
Each result includes at least:
- The category name.
- The similarity score indicating how close the target text embedding is to the category embedding.
If branching is enabled, the node also supports workflow branching based on classification outcomes.
No binary data output is involved in this operation.
Dependencies
- Requires valid OpenAI API credentials, either through dedicated OpenAI Analytics API credentials or standard OpenAI API credentials.
- Uses OpenAI embedding models to generate embeddings for both the target text and categories.
- Network access to OpenAI endpoints is necessary.
- n8n environment must have these credentials configured properly.
Troubleshooting
Error: Missing or empty category text
Occurs if a category name is empty when creating new category embeddings. Ensure all categories have non-empty names.Authentication errors
If the node cannot authenticate with OpenAI, verify that the API key credential is correctly set up and has appropriate permissions.Similarity threshold too high
If no categories are returned, try lowering the similarity threshold to allow more matches.Empty or invalid embedding vectors
If custom embeddings are provided for categories, ensure they are valid JSON arrays of numbers. Otherwise, leave empty to auto-generate.API rate limits or network issues
May cause failures in embedding generation. Check API usage limits and network connectivity.