Actions20
- Assistant Actions
- Embedding Actions
- File Actions
- Report Actions
- Text Actions
- Thread Actions
Embedding → LLM Based Classify
AI-generatedOverview
This node provides a classification feature that uses Large Language Models (LLMs) to classify input text into predefined categories. It leverages OpenAI's LLMs to analyze the given text and assign it to one or more specified categories based on the model's understanding.
Common scenarios where this node is beneficial include:
- Automatically tagging or categorizing customer feedback, support tickets, or survey responses.
- Classifying documents or messages into topics or departments.
- Sorting content for routing or further processing in workflows.
For example, you can input a product review text and define categories like "Positive", "Negative", and "Neutral". The node will classify the review into one of these categories using an LLM such as GPT-4o-mini.
Properties
| Name | Meaning |
|---|---|
| Authentication | Choose between using dedicated OpenAI Analytics API credentials or existing OpenAI API credentials. |
| Target Text | The text string that you want the LLM to classify. |
| Categories | A list of categories (each a string) that the LLM will use to classify the target text. |
| Model | The specific LLM model to use for classification (e.g., gpt-4o-mini). |
| Response Format | The format of the response from the LLM: either plain text with just the category name, or JSON with detailed info including category, confidence, and reasoning. |
| Use Branch Outputs | Boolean flag to enable branching in the workflow based on classification results. |
Output
The node outputs JSON data representing the classification result. Depending on the selected response format:
- Text: The output JSON contains only the category name as a string.
- JSON: The output JSON includes a structured object with fields such as:
category: The assigned category name.confidence: A confidence score or probability indicating how sure the model is about the classification.reasoning: Explanation or rationale provided by the LLM for the classification decision.
If branching is enabled (Use Branch Outputs), the node also supports conditional workflow paths based on the classification outcome.
The node does not output binary data.
Dependencies
- Requires valid API credentials for OpenAI services, either through dedicated OpenAI Analytics API credentials or standard OpenAI API credentials.
- The node internally initializes an OpenAI client to communicate with the OpenAI API endpoints.
- The LLM models available for selection are dynamically loaded from the OpenAI API.
- No additional external dependencies beyond OpenAI API access.
Troubleshooting
- Credential Errors: If the node fails to authenticate, ensure that the correct API key credential is selected and properly configured in n8n.
- Model Not Found: If the selected LLM model is unavailable, verify that the model name is correct and accessible with your API plan.
- Empty or Invalid Categories: The node requires at least one non-empty category string; otherwise, it throws an error.
- Invalid Input Text: Ensure the target text is not empty and is a valid string.
- API Rate Limits or Quotas: Classification requests may fail if API usage limits are exceeded; monitor your OpenAI account usage.
- Branching Issues: If branching is enabled but no branches appear, confirm that the categories match the branch names exactly.
Links and References
This summary is based on static analysis of the node's source code and property definitions related to the Embedding resource's LLM Based Classify operation.