This project provides a Python chatbot built with Langchain, Chainlit, AWS Bedrock (Amazon Titan Embeddings G1 - Text and Anthropic's Claude LLM) to interact with users about educational resources.
- Python 3.12.1 (or a compatible version): This project requires a specific Python version to ensure compatibility with its dependencies. You can check your Python version by running
python --versionorpython3 --versionin your terminal. If you don't have the correct version, download it from https://www.python.org/downloads/. virtualenvtool: It helps isolate project dependencies. Install it usingpip install virtualenvif you haven't already.
This section provides instructions on how to set up the project's environment to run smoothly.
-
Clone the Repository:
Before setting up the environment, clone this repository from GitHub using the following command:
git clone https://github.com/i-do-dev/educational-library-bot
This will clone the repository into a local directory named
educational-library-bot. You can change this name if you prefer. -
Change Directory:
Navigate into the project directory using the following command:
cd educational-library-bot
-
Create a Virtual Environment:
-
Open your terminal and navigate to your project directory (where you cloned the repository).
-
Create a virtual environment named
venv(you can choose any name) using the following command:virtualenv venv
-
Activate the virtual environment:
- Windows:
venv\Scripts\activate.bat
- macOS/Linux:
source venv/bin/activate
The terminal prompt should change to indicate that the virtual environment is active (usually prefixed with the environment name).
- Windows:
-
-
Install Dependencies
(Optional) Environment Variables: The project might utilize environment variables stored in a
.envfile. If a file named.env-sampleexists, copy it to.envand update the values according to the instructions within the.env-samplefile. These variables might be essential for the project's functionality.Now that the virtual environment is activated, install the required packages listed in the
requirements.txtfile using the following command:pip install -r requirements.txt
This will download and install all the necessary Python packages for your project within the isolated virtual environment.
-
Verify Installation
(Optional) After installation, you can try running a simple script from your project to ensure everything is set up correctly.
-
Start the Bot:
Once you've completed the setup steps, you can start the chatbot using the following command:
chainlit run chat.py --port 80
Replace
chat.pywith the actual filename of your main chatbot script if it's named differently. This command instructs Chainlit to run the specified Python script (chat.py) and exposes it on port 80 (you can change the port number if needed).This will launch your chatbot in a web interface accessible from any web browser on your machine by visiting
http://localhost:80(or the port you specified).
Note:
- Replace
venvwith the actual name you gave to your virtual environment. - Deactivate the virtual environment when you're done working on the project by running
deactivatein your terminal.
By following these steps, you'll have a properly configured environment to run this Python chatbot project using Python 3.12.1 (or a compatible version) and its dependencies isolated within the virtual environment. You can then launch the chatbot using the provided command.