An intelligent multi-task NLP system that automatically detects user intent and routes prompts to specialized language models for translation, summarization, sentiment analysis, question-answering, and conversational chat.
Examples
This project implements a smart routing system that:
- Classifies user intent using a trained machine learning classifier
- Routes prompts to the appropriate NLP model
- Returns intelligent responses based on the detected task
- Translation (EN → FR): Translate English text to French
- Summarization: Generate concise summaries of longer texts
- Sentiment Analysis: Analyze emotional tone (positive/negative)
- Question Answering: Answer factual questions
- Conversational Chat: Engage in casual dialogue
| Task | Model | Size | Description |
|---|---|---|---|
| Intent Classification | Logistic Regression + TF-IDF | ~1 MB | Custom-trained classifier to detect user intent |
| Translation | Helsinki-NLP/opus-mt-en-fr |
~300 MB | English to French translation |
| Summarization | t5-small |
~240 MB | Text summarization with repetition prevention |
| Sentiment Analysis | distilbert-base-uncased-finetuned-sst-2-english |
~250 MB | Binary sentiment classification |
| Question Answering | google/flan-t5-small |
~300 MB | Factual question answering |
| Chat | microsoft/DialoGPT-small |
~350 MB | Conversational dialogue generation |
SMART-PROMPT-ROUTING-SYSTEM/
├── app/
│ ├── config/
│ ├── model/
│ ├── routers/
│ ├── util/
│ ├── __init__.py
│ └── main.py
├── data/
├── notebooks/
├── .env.example
├── .gitattributes
└── README.md
The main application directory containing all core application code.
config/- Configuration files and settings for the applicationmodel/- Machine learning models and model-related coderouters/- API route definitions and endpoint handlersutil/- Utility functions and helper modulesmain.py- Application entry point and main execution file
Storage directory for data files, datasets, and data-related resources.
Jupyter notebooks for experimentation, analysis, and documentation.
.env.example- Template for environment variables configuration.gitattributes- Git attributes configuration for repositoryREADME.md- Project documentation and overview
- Clone the repository:
git clone
cd smart-prompt-routing-system- Install dependencies:
pip install -r requirements.txt- Ensure you have the trained classifier models in the
app/modeldirectory:intent_classifier.pkllabel_encoder.pkl
Run the interactive CLI:
python main.py- Made by ABADLI Badreddine, MAHAMMED Abdallah Slimane and BOUHAMZA Abderrahmane
- Hugging Face for the Transformers library
- Model creators: Helsinki-NLP, Google, Microsoft, Hugging Face team
- scikit-learn for machine learning utilities





