This is a RESTful API that serves as an integration layer for a BERT-based Python chatbot. It allows clients to send user messages and receive AI-generated responses using the BERT NLP model.
- Accepts user messages via HTTP requests
- Communicates with the BERT-based chatbot model
- Returns AI-generated responses
- Implements JWT authentication for secure API access
- .NET Core Web API (C#)
- Entity Framework Core (for database operations)
- JWT Authentication (for secure access)
- Python & BERT NLP Model (for chatbot responses)
- PostgreSQL / SQL Server (for message storage)
Ensure you have the following installed:
- .NET 7 or later
- Python 3.8+
- PostgreSQL or SQL Server (if using a database)
- Docker (optional, for containerization)
git clone https://github.com/yourusername/ChatBotModelAPI.git
cd ChatBotModelAPICreate an .env file in the project root:
JWT_SECRET=your_jwt_secret_key
BERT_API_URL=http://localhost:5001/api/chatbot
DATABASE_CONNECTION_STRING=your_database_connection_string
dotnet restoredotnet ef database updatedotnet runThe API will be available at http://localhost:5000.
Description: Sends a user message to the chatbot and returns a response.
{
"content": "Hello, how are you?"
}{
"response": "I'm just a bot, but I'm doing great! How can I help?"
}Authenticate and receive a JWT token.
{
"username": "user123",
"password": "securepassword"
}{
"token": "your_jwt_token"
}Headers:
Authorization: Bearer your_jwt_token[
{ "content": "Hello!", "response": "Hi there!" },
{ "content": "What's your name?", "response": "I'm a chatbot powered by BERT!" }
]docker build -t chatbot-api .
docker run -p 5000:5000 --env-file .env chatbot-apiFeel free to open a PR or issue for any improvements!
This project is licensed under the MIT License.