This project integrates a Large Language Model (LLM) with a purchase orders dataset, allowing users to query and analyze the data through natural language conversations. The chatbot can understand and respond to questions about the dataset, providing insights and analysis based on the purchase order records.
- Docker and Docker Compose
- Postman (or any API testing tool)
- Git
git clone [email protected]:hozRifai/chatbot-SCPRS.git
cd chatbot-SCPRS
MONGO_ROOT_USERNAME=user
MONGO_ROOT_PASSWORD=password
MONGO_DATABASE=your database name
OPENAI_API_KEY=your openai api key
Run the following command in the project root directory:
docker-compose up -d
This will start two containers:
- MongoDB container for data storage
- Chatbot container with the LLM integration
After the containers are running, load the dataset into MongoDB using the following API endpoint:
curl --location --request POST 'http://localhost:8000/load-data'
You can either import the code above directly to Postman using Import button, or:
- Create a new POST request
- Enter URL:
http://localhost:8000/load-data
- Send the request
To interact with the chatbot, send POST requests to the chat endpoint. Here's an example:
curl --location 'http://localhost:8000/chat' \
--header 'Content-Type: application/json' \
--data '{
"message": "how many orders had REQ0011118 as their requisition number where the creation date was in 2013?"
}'
Using Postman:
- Create a new POST request
- Enter URL:
http://localhost:8000/chat
- Set header:
Content-Type: application/json
- Add request body:
{ "message": "your question here" }
You can ask questions about the purchase orders dataset such as:
- "How many orders were created in 2013?"
- "What are the most common requisition numbers?"
- "Show me orders with specific requisition numbers"
- "What's the date range of the orders?"
chatbot-SCPRS/
├── docker-compose.yml
├── dataset/
│ └── purchase.csv
├── mongodb/
│ └── persistent data here
├── chatbot/
│ └── [source files]
└── README.md
- If containers don't start, check if the required ports (8000 and 27017) are available
- If data loading fails, ensure MongoDB container is healthy
- For any connection issues, verify both containers are running:
docker ps
For issues and questions, please open an issue in the GitHub repository.