knoten / builtin / ai / aiagents
Text Classifier
Classify text into one of a set of given categories using a LLM, or on-device with a Local Classifier
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Put a text into one of the categories you list, with a chat model or on-device.
Try it
Section titled “Try it”Classify and Route: ein Workflow mit 8 Schritten, beginnend mit Run now und endend mit Other branch, mit 1 Verzweigung.
- Technical branch(Display Markdown – zur Dokumentationsseite) wenn Technical
- Other branch(Display Markdown – zur Dokumentationsseite) wenn andernfalls
What it does
Section titled “What it does”Text Classifier reads Text and returns the best matching category from Categories in category. What you connect to Model decides how; there is no setting to switch:
- A chat model (for example Chat OpenAI or Web LLM) is told to answer with exactly one category name and nothing else, or
unknownwhen none fits. - A Local Classifier runs in your browser: free, private and offline. With a zero-shot model, your Categories are scored and the best one wins. With a fixed-label model (sentiment, toxicity), the model’s own labels are used and Categories is ignored. System message does not apply.
The node has one output. To send each category down its own path, follow it with a Switch.
When to use it
Section titled “When to use it”- Sort support requests into
billing, technical, salesand route each to the right team. - Tag articles or emails by topic before you save them.
- Detect the intent of a chat message (
question, complaint, order).
To label tone only, use Sentiment Analysis. To classify on-device without a model node, use Classify Text.
Inputs and settings
Section titled “Inputs and settings”| Einstellung | Typ | Was es bewirkt |
|---|---|---|
| Text (erforderlich) | Long text | The text to classify. |
| Categories (erforderlich) | Long text | Comma-separated category names to classify the text into. |
| Options | Group | The options for the node. |
| Options › System message | Long text | The system message to use. |
Fill Text with an expression such as {{ $input.text }}. Write Categories as a comma-separated list, for example billing, technical, sales. Short, clearly different names give the most reliable results. Use System message to describe a category when its name alone is ambiguous, such as "sales" means questions about buying or pricing.
Outputs
Section titled “Outputs”-
Output
Each output item has these fields:
| Field | Typ | What it holds |
|---|---|---|
| category | Any | The chosen category |
| scores | Key-value pairs | Every label's score, on-device |
{ "category": null, "scores": {}}category is one of your category names, or unknown when none fits (or when the on-device model returns no label). scores is only there with a Local Classifier.
Dependencies and credentials
Section titled “Dependencies and credentials”| Slot | Accepts | Connections |
|---|---|---|
| Model (erforderlich) | chat model, local classifier | One node. |
Connect a chat model, which holds its own API key, or a Local Classifier with a zero-shot model to classify on-device with your own categories.
Example workflow
Section titled “Example workflow”- Get Selected Text reads a support email you highlighted, with Output field name
text. - Text Classifier with Text
{{ $input.text }}and Categoriesbilling, technical, sales, with an Chat OpenAI model on Model. - Switch in Rules mode with one rule per category, each checking that
{{ $input.category }}equals the category name, and Add A Fallback Branch on forunknown. - Each branch posts to a different Slack channel.
Common issues
Section titled “Common issues”categoryis oftenunknown. Your categories do not cover the texts you receive, or the names are vague. Add a category, or explain them in System message.- The category does not match your Switch rules. A chat model may change the capitalisation or add words. Add
Answer with the category name exactly as written.in System message. - “Add at least one category: the zero-shot classifier scores the text against them.” A zero-shot Local Classifier is connected and Categories is empty.
- “Model not found”. The connected chat model node is not set up: open it and choose a model and its credential.
Related nodes
Section titled “Related nodes”- Switch: send each category down its own path.
- Sentiment Analysis: label tone.
- Classify Text: on-device classification without a model node.
- Local Classifier: the on-device model for this node.