ChatbotBert is a Python-based NLP chatbot API powered by BERT, designed for seamless integration and building intelligent conversational agents. It provides a lightweight and efficient solution for multi-tenant SaaS applications, focusing on NLP tasks such as text similarity, intent recognition, and conversational AI.
- BERT Integration: Leverages the power of BERT for enhanced natural language understanding.
- Customizable Neural Network: Includes a flexible neural network architecture for training and predictions.
- RESTful API: Provides endpoints for chatbot predictions, training, and model management.
- Lightweight Design: Optimized for environments with limited computational resources.
- Multi-Tenant Support: Designed for SaaS applications with multiple tenants.
- app.py: Entry point for the Flask-based RESTful API.
- azure-pipelines.yml: Azure DevOps pipeline configuration for CI/CD.
- ChatbotBert.pyproj: Project configuration for Visual Studio.
- ComputeSubProcess.py: Handles subprocesses for model training and computations.
- globalvars.py: Defines global variables and shared resources.
- ModelFile.py: Manages saving, loading, and deleting model files.
- NlpBert.py: Implements BERT-based NLP operations.
- NlpCbTrainingThread.py: Manages training threads for the chatbot.
- NlpChatbotModel.py: Core logic for chatbot training and predictions.
- NlpNN.py: Defines the neural network architecture.
- NlpWebClient.py: Handles API interactions for training and model updates.
- SingleInstanceChecker.py: Ensures only one instance of the application runs at a time.
- Python 3.8 or higher
- Required Python packages are listed in
requirements.txt.
- Clone the repository:
git clone <repository-url> cd ChatbotBert
- Create a virtual environment:
python -m venv env source env/bin/activate # On Windows: .\env\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Set environment variables:
Path_Model: Path to the directory for storing models.Path_Log: Path to the directory for storing logs.NlpChatbot_NetToken: Security token for API interactions.NlpChatbot_NlpChatbotWebAPI: Base URL for the chatbot API.
- Start the application:
python app.py
- Access the API endpoints:
GET /: Health check endpoint.POST /RequestTraining: Request model training.POST /CancelTraining: Cancel ongoing training.POST /GetTrainingStatus: Get the status of training.POST /ChatbotPredict: Get predictions from the chatbot.POST /Similarity: Calculate text similarity.
- Use
azure-pipelines.ymlfor CI/CD integration with Azure DevOps. - Follow the project structure for adding new features or modifying existing ones.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please fork the repository and submit a pull request for review.