Dynamic Text Classifier v4

Clasifica texto en categorías basadas en intents dinámicos

Dynamic Text Classifier v4

AI-generated

Overview

This node is a Dynamic Text Classifier that categorizes input text into one or more predefined intents (categories) based on their descriptions and priorities. It uses an AI language model to analyze the text and determine which intent(s) it belongs to, optionally allowing multiple classifications per input.

Common scenarios where this node is useful:

  • Automatically tagging customer support messages with relevant topics for routing.
  • Categorizing user feedback or survey responses into themes.
  • Sorting incoming chat messages by intent to trigger specific workflows.
  • Any use case requiring dynamic classification of free-text inputs into custom categories defined at runtime.

Practical example:

You provide a list of intents such as "Billing Issue," "Technical Support," and "General Inquiry," each with a description and priority. When a user submits a message like "I can't access my account," the node classifies it under "Technical Support" based on the AI model's understanding and the priority rules.


Properties

Name Meaning
Text to Classify The input text string that you want to classify according to the provided intents.
Intents An array of intent objects defining the categories for classification. Each intent should have a name, description, and priority.
Options A collection of optional settings:
- Allow Multiple Classes: Boolean flag to allow the text to belong to multiple categories simultaneously.
- System Prompt Template: Custom prompt template for the AI system message.
- Enable Auto-Fixing: Enables automatic correction of the AI output format.

Output

The node outputs an array of results corresponding to each intent provided. Each element in the output array corresponds to one intent and contains either:

  • An object with:
    • input_text: The original input text.
    • confidence: Always set to 1 (indicating full confidence in classification).
    • intent_data: The matched intent object including its name, description, and priority.

or

  • An error object if classification failed, containing:
    • error: The error message.
    • input_text: The original input text.

If Allow Multiple Classes is enabled, multiple intents can be marked true; otherwise, only the highest priority matching intent is returned.

The output JSON structure is dynamically generated based on the intents, with boolean flags indicating whether the input matches each intent.

No binary data output is produced by this node.


Dependencies

  • Requires an AI language model connection configured in n8n (e.g., OpenAI or other supported LLM).
  • Uses structured output parsing and prompt templates from LangChain libraries bundled within the node.
  • No external API keys are directly referenced here, but the AI model credential must be properly set up in n8n.

Troubleshooting

  • Error: "No se recibieron intents para la clasificación"
    This means no intents were provided as input. Ensure that the "Intents" property is populated with valid intent objects before execution.

  • Error: "No se encontraron intents válidos"
    Indicates that after sorting and filtering, no valid intents remain. Check that intents have correct properties and priorities.

  • Unexpected output or parsing errors
    If the AI model returns malformed JSON or unexpected formats, try disabling or enabling the "Enable Auto-Fixing" option to let the node attempt to correct the output automatically.

  • Multiple classes not working as expected
    Verify that the "Allow Multiple Classes" option is enabled if you want the text to be classified into more than one intent.

  • AI model connection issues
    Make sure the AI language model node is correctly connected and authenticated in your workflow.


Links and References

Discussion