---
title: "Question Classifier"
description: "Intelligently categorize user input to route workflow paths"
icon: "sitemap"
---

The Question Classifier node intelligently categorizes user input to route conversations down different workflow paths. Instead of building complex conditional logic, you define categories and let the LLM determine which one fits best based on semantic understanding.

## Configuration

### Input and Model Setup

**Input Variable** - Select what to classify, typically `sys.query` for user questions, but can be any text variable from previous workflow nodes.

**Model Selection** - Choose an LLM for classification. Faster models work well for simple categories, while more powerful models handle nuanced distinctions better.

<Frame caption="Question Classifier configuration interface">
  <img src="https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/2f039c5ff3f095b0eed291101d9bff15.png" alt="Question Classifier setup" />
</Frame>

### Category Definition

Create clear, descriptive labels for each category with specific descriptions of what belongs in each. Be precise about boundaries between categories to help the LLM make accurate decisions.

Each category becomes a potential output path that you can connect to different downstream nodes like specialized knowledge bases, response templates, or processing workflows.

## Classification Example

Here's how the Question Classifier works in a customer service scenario:

<Frame caption="Customer service classification workflow">
  <img src="https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/2f06ecce149c844c23be70a8fcff09bc.png" alt="Customer service classification" />
</Frame>

**Categories Defined:**
- **After-sales service** - Warranty claims, returns, repairs, and post-purchase support
- **Product usage** - Setup instructions, troubleshooting, feature explanations  
- **Other questions** - General inquiries not covered by specific categories

**Classification Results:**
- "How to set up contacts on iPhone 14?" → **Product usage**
- "What is the warranty period for my purchase?" → **After-sales service**  
- "What's the weather like today?" → **Other questions**

Each classification result routes to different knowledge bases and response strategies, ensuring users receive relevant, specialized assistance.

## Advanced Configuration

### Instructions and Guidelines

Add detailed classification guidelines in the **Instructions** field to handle edge cases, ambiguous scenarios, or specific business rules. This helps the LLM understand nuanced distinctions between categories.

### Memory Integration

Enable **Memory** to include conversation history when classifying input. This improves accuracy in multi-turn conversations where current input depends on previous context.

**Memory Window** controls how much conversation history to include, balancing context awareness with token efficiency and processing speed.

## Output Usage

The classifier outputs a `class_name` variable containing the matched category label. Use this variable in downstream nodes for:

**Conditional Routing** - Connect different workflow paths based on classification results

**Knowledge Base Selection** - Route to specialized knowledge bases for each category

**Response Customization** - Apply different response templates or processing logic

**Analytics and Logging** - Track distribution of user inquiries across categories

## Best Practices

**Clear Category Boundaries** - Define distinct, non-overlapping categories with specific descriptions to improve classification accuracy.

**Appropriate Model Selection** - Choose models based on classification complexity. Simple binary classifications work with faster models, while nuanced multi-category classification may require more capable models.

**Test Edge Cases** - Verify classification behavior with ambiguous inputs that could fit multiple categories.

**Use Conversation Context** - Enable memory for conversational applications where classification depends on previous interactions.

**Monitor and Iterate** - Review classification results and refine category descriptions based on real usage patterns.