Skip to content

Abadli-Badro/Smart-Prompt-Routing-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Prompt Routing System

System Architecture

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

Overview

System Architecture

This project implements a smart routing system that:

  1. Classifies user intent using a trained machine learning classifier
  2. Routes prompts to the appropriate NLP model
  3. Returns intelligent responses based on the detected task

Supported Tasks

  • 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

Models Used

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

Directory Layout

SMART-PROMPT-ROUTING-SYSTEM/
├── app/
│   ├── config/
│   ├── model/
│   ├── routers/
│   ├── util/
│   ├── __init__.py
│   └── main.py
├── data/
├── notebooks/
├── .env.example
├── .gitattributes
└── README.md

Directory Descriptions

/app

The main application directory containing all core application code.

  • config/ - Configuration files and settings for the application
  • model/ - Machine learning models and model-related code
  • routers/ - API route definitions and endpoint handlers
  • util/ - Utility functions and helper modules
  • main.py - Application entry point and main execution file

/data

Storage directory for data files, datasets, and data-related resources.

/notebooks

Jupyter notebooks for experimentation, analysis, and documentation.

Root Files

  • .env.example - Template for environment variables configuration
  • .gitattributes - Git attributes configuration for repository
  • README.md - Project documentation and overview

Installation

  1. Clone the repository:
git clone
cd smart-prompt-routing-system
  1. Install dependencies:
pip install -r requirements.txt
  1. Ensure you have the trained classifier models in the app/model directory:
    • intent_classifier.pkl
    • label_encoder.pkl

Usage

Command Line Interface

Run the interactive CLI:

python main.py

Acknowledgments

  • 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

About

A Smart Multi-Agent System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors