This project is a psychotherapist chatbot using the LangChain library with the Llama-2 model. The bot assists users with psychological counselling by engaging in a conversation, recognizing emotions, and managing chat history.
- Emotion recognition in user input.
- Management of chat history.
- Handling of edge cases and invalid input.
- Python 3.8+
- Required Python libraries (see
requirements.txt
)
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required libraries:
pip install -r requirements.txt
-
Ensure you have the Llama-2 model files in the correct directory (
model/llama-2-7b-chat.Q4_0.gguf
). If you don't, create a folder called 'model' and download from here.
-
Run the chat bot:
python main.py
-
The bot will prompt you to enter your questions. Type your questions and press Enter. Type 'exit' to end the conversation.
Run the unit tests using unittest
:
python -m unittest discover
This repository also includes a more complicated solution using Flask, located in the chatbot
folder.