This project enables you to create a personalized chatbot running locally on your computer with your own files. By managing your own instance, you can ensure greater control over your data and use your own OpenAI API key for security. Learn more about data security with OpenAI here.
Begin by cloning the repository to your local machine using SSH or HTTPS. Choose a suitable directory on your computer where you would like to set up the project. Here's how you can clone using SSH:
git clone git@github.com:yourusername/yourprojectname.git
- If you already have an OpenAI API key, you may skip this step. If not, follow these instructions to obtain one:
- Visit OpenAI's website and sign up for an account if you do not already have one.
- Once logged in, navigate to the API section and generate a new API key.
- To ensure the security of your key, add it to your environment variables on your computer rather than directly embedding it in your code. This prevents accidental exposure of your key, especially if you plan to push your code to a public repository.
For detailed instructions on how to set an environment variable for your OpenAI API key, refer to this comprehensive guide here.
Open your project in your preferred IDE or in the terminal.
Use bash to install python on your computer if you haven't already. For IOS users, you can use homebrew to install python:
brew install python
python -m venv env
source env/bin/activate
pip install -r requirements.txt
Great job! Now you are ready to run your chatbot locally.
To run the chatbot, first insert files in the src/files directory. For now, it only works with pdf and docs. Execute the following command in your terminal to create the embeddings files.
python divide_chunks.py
python generate_embeddings.py
Then run the chatbot with the following command:
python made4you.py
Step 8: You can now open the chatbot in your browser by visiting the URL that is displayed in the terminal.
Step 9: Interact with your chatbot by asking questions or providing prompts. The chatbot will respond with information from the files you uploaded.
If you encounter any issues, ensure the following:
- Your Python version is up-to-date.
- All dependencies are installed (pip install -r requirements.txt).
- Your OpenAI API key is correctly set in your environment variables.
For additional support, feel free to raise an issue in the repository.