This is a super-simple-but-effective chatbot based on the concept of information retrieval. You can have a full-fledged chat interface with it in your terminal.
This chatbot loads up files from a documents
folder. You can toss in text files, doc files, PDFs, PPTs, and pretty much anything textual. (You might need to install extra dependencies.) It then converts the contents into embeddings and stores them in a txt_docsearch
folder for quick and easy use.
See 🔐 Private ChatGPT for how this chatbot works. Also see 🦣 Fine-tuning Large Language Models to understand how LLM fine-tuning works.
We're currently using the "R For Data Science 2E" book as the training material. But the beauty of it is, you can plug in any text material you'd like!
- OpenAI API Key: You're going to need one. Grab yours here.
- Fork this Repository: Head over to this GitHub repo and fork it.
- Clone Your Fork:
git clone https://github.com/your-username/r4ds-book-chatbot.git
- Install Dependencies: Run
pip install -r requirements.txt
- Documents: Put in your custom documents in the
documents
folder, unless you want to use R4DS as your training material. - OpenAI API Key: Create a file named
api_key.txt
and paste your API key in it. Don't worry, it's in the.gitignore
file, so it won't be uploaded to GitHub. - Run the Bot: Navigate to the folder and run
python chatbot.py
- Conversational Memory: This chatbot remembers what you talked about!
- CSV Archives: All conversations are saved in a CSV file in
communications
directory, with a timestamp for easy retrieval.
So go ahead, give it a spin and let the chat begin! 🎉