Skip to content

hsctim/ChatbotBert

Repository files navigation

ChatbotBert

Overview

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.

Features

  • 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.

Project Structure

  • 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.

Requirements

  • Python 3.8 or higher
  • Required Python packages are listed in requirements.txt.

Setup

  1. Clone the repository:
    git clone <repository-url>
    cd ChatbotBert
  2. Create a virtual environment:
    python -m venv env
    source env/bin/activate  # On Windows: .\env\Scripts\activate
  3. Install dependencies:
    pip install -r requirements.txt
  4. 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.

Usage

  1. Start the application:
    python app.py
  2. 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.

Development

  • Use azure-pipelines.yml for CI/CD integration with Azure DevOps.
  • Follow the project structure for adding new features or modifying existing ones.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for review.

About

The ChatbotBert repository contains the source code for a chatbot application powered by BERT, a state-of-the-art natural language processing (NLP) model. The project is designed to handle tasks such as training, inference, and deployment of the chatbot model.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages