Classifier Service
Learn how to use the Classifier Service to classify text into predefined categories using AI.
Overview
The Classifier Service is a specialized service designed to classify text into predefined categories using LLMs. It supports both single-class and multi-class classification, with configurable allowed classes and classification types, making it highly flexible for various classification tasks.
- Single and Multi-Class Classification: Support for both single and multiple category assignments
- Configurable Categories: Define allowed classes through enums
- Context-Aware Classification: Domain-specific classification with type specification
- Configurable Output: Control over classification parameters and model behavior
- Confidence Scoring: Detailed confidence metrics for classifications
- Explanatory Reasoning: Comprehensive explanation for classification decisions
Traditional text classification often involves rule-based systems, statistical models, or manual category mapping. The Classifier Service improves this by using LLMs for intelligent classification, supporting multiple classification modes, providing detailed reasoning, and maintaining high accuracy through controlled parameters.
Endpoints
Process Endpoint
The process endpoint performs text classification with AI-powered category assignment.
API Endpoint
Endpoint Parameters
Request
content
(string, required)
The text to classify.
context
(object, required)
Classification type and allowed classes:
classificationType
(string, optional): Domain specification for classificationallowedClasses
(string[]): Valid category list to classify intomultiClass
(boolean, optional): Whether to allow multiple class assignments (default: false)
config
(object, optional)
Model and classification configuration:
modelId
(string): Model to use for classification (default: "mistral-large-2411")temperature
(number): Controls classification precision (default: 0.1, range: 0.0-1.0)
Response
status
(string)
Status of the processing ("success" or "error").
result
(object)
For successful responses:
class
(string): Assigned class (single-class mode)classes
(string[]): Assigned classes (multi-class mode)confidence
(number): Confidence score for the classificationexplanation
(string): Detailed reasoning for the classification decision
metadata
(object)
Processing metadata:
model
(string): Model usedcreated_at
(string): Creation timestampprocessed_at
(string): Processing timestampinstance_id
(string): Instance identifiertracking_id
(string): Unique tracking IDclassification_type
(string): Type of classification performedmode
(string): Classification mode used ("single_class" or "multi_class")
Examples
Request
Full Request (Single-Class Classification)
Multi-Class Classification
Domain-Specific Classification
Sentiment Classification
Content Category Classification
Language Detection
Response
Single-Class Response
Multi-Class Response
Error Response
Classification Modes
Single-Class Mode
- One class per input
- Higher confidence threshold
- Strict class selection
Multi-Class Mode
- Multiple classes per input
- Confidence per class
- Class relationship analysis