PrompTrend: Intelligent Chat Support System
PrompTrend is an advanced chat support system that combines intent classification and contextual bandit algorithms to provide personalized recommendations and responses. The system uses BERT for intent classification and implements a contextual multi-armed bandit approach for dynamic learning from user interactions.
🌟 Key Features
- Intent classification using BERT
- Contextual bandit-based recommendation system
- Real-time user feedback processing
- Automatic question generation
- Redis caching for improved performance
- Comprehensive API documentation
- Robust error handling
- Database persistence with PostgreSQL
🛠️ Technology Stack
- Framework: FastAPI
- ML Models: BERT (Transformers), T5
- Database: PostgreSQL
- Caching: Redis
- ML Libraries: PyTorch, Scikit-learn
- Testing: Pytest
- Documentation: OpenAPI (Swagger)
📋 Prerequisites
- Python 3.8+
- PostgreSQL
- Redis
- CUDA-compatible GPU (optional, for faster model training)
⚙️ Installation
You can install PrompTrend directly via pip (once published):
pip install promptrend
For development, clone the repository and install in editable mode:
git clone https://github.com/yourusername/promptrend.git
cd promptrend
pip install -e .[test]
Set up environment variables:
python scripts/setup_env.py --env development
🚀 Running the Application
- Start the Redis server:
redis-server
- Start the application using the CLI:
promptrend-server
The API will be available at http://localhost:8000
📚 API Documentation
Once the application is running, you can access the interactive API documentation at:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
🧪 Testing
The project includes comprehensive tests for all components. To run the tests:
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=app tests/
# Run specific test file
pytest tests/test_intent_classifier.py
📂 Project Structure
promptrend/
├── api/
│ └── routes.py # API endpoints
├── core/
│ ├── config.py # Configuration management
│ ├── database.py # Database setup
│ ├── models.py # Data models
│ └── cache.py # Redis cache implementation
├── services/
│ ├── intent_classifier.py # BERT classifier
│ ├── recommender.py # Contextual bandit
│ ├── recommendation_service.py
│ ├── question_generator.py # T5 question generator
│ └── error_handler.py # Error handling service
├── tests/
│ ├── test_intent_classifier.py
│ ├── test_recommender.py
│ ├── test_api.py
│ └── test_integration.py
├── scripts/
│ └── setup_env.py
├── main.py
├── requirements.txt
└── README.md
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Hugging Face for the Transformers library
- FastAPI team for the amazing framework
- The open-source community for various dependencies
📞 Contact
For questions and feedback, please create an issue in the GitHub repository.
Release files for promptrend 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| promptrend-1.0.0.tar.gz | 19.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| promptrend-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.6 kB
Release files / promptrend-1.0.0.tar.gz
| Download URL | promptrend-1.0.0.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a02b0e466e957cac0db15100cb008dd91732ecb4010c56f0d901f113e6463eae
|
|
BLAKE2b-256 checksum How to use checksums |
2558a9cd428a542eb7b247c44e663e59117875a50bf7df5f797bd57c01ee2e85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / promptrend-1.0.0-py3-none-any.whl
| Download URL | promptrend-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68e434d0438a55bf3ac09cd863e4ab85728f3d8c4ab88fe56f1c8deb72c35818
|
|
BLAKE2b-256 checksum How to use checksums |
8361f52ed784cab3afea3506a0edb4dc10bdcaf318675e71872bb2e3bd5d2a27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|