IncarnaMind is an open-source, Python-based AI chatbot that allows users to have conversations with their personal documents like PDFs and text files using Large Language Models (LLMs) such as GPT and Claude.
It allows users to upload their own documents like research papers, reports, books etc. in PDF or text format. It then indexes and stores these documents in a database. Users can then have natural conversations with IncarnaMind by asking questions related to the content in their documents.
IncarnaMind utilizes advanced techniques like sliding window chunking and ensemble retrieval to quickly find relevant passages in the documents to augment the responses from the LLMs. This helps provide factual, relevant and coherent responses to the user’s questions without hallucinating or generating inconsistent responses.
How to use it:
1. To get started, ensure you have the following:
- Python: Ensure your system runs Python version 3.8, 3.9, 3.10, but not 3.11. Using Conda is recommended for managing Python environments.
- API Key: You’ll need an OpenAI API Key or an Anthropic Claude API Key to power the language models.
2. Clone the repository from GitHub.
git clone https://github.com/junruxiong/IncarnaMind cd IncarnaMind
3. Set Up the Conda Virtual Environment. Create a dedicated virtual environment for IncarnaMind. This ensures compatibility and prevents potential conflicts with other Python packages:
conda create -n IncarnaMind python=3.10
4. Activate the IncarnaMind Environment:
conda activate IncarnaMind
5. With the environment activated, it’s time to install the necessary packages:
pip install -r requirements.txt
6. Next, you’ll need to input your API keys. Open the configparser.ini
file with a text editor and find the [tokens]
section. Here, replace (replace_me)
with your actual keys:
OPENAI_API_KEY = sk-(your_openai_key_here) ANTHROPIC_API_KEY = sk-(your_anthropic_key_here)
7. In the same configparser.ini
file, you can also set custom parameters under the [parameters]
section, if needed:
PARAMETERS 1 = (your_value_here) PARAMETERS 2 = (your_value_here) ... PARAMETERS n = (your_value_here)
8. Upload and Process Your Documents:
- Prepare your documents by naming them appropriately for best performance.
- Move these files into the
/data
directory of IncarnaMind. - (Optional) If there are any example files in the
/data
directory, you can delete them. - Run the following command to process and ingest all the documents:
python docs2db.py
9. Now you’re all set to interact with your documents. Kickstart the chatbot by running:
python main.py
10. After starting the script, you’ll be prompted with:
Human:
Here, type your questions or prompts to converse with the chatbot based on your documents.
11. By default, all your interactions will be logged in the IncarnaMind.log
file. If you wish to modify the logging behavior, edit the [logging]
section in the configparser.ini
file:
enabled = True level = INFO filename = IncarnaMind.log format = %(asctime)s [%(levelname)s] %(name)s: %(message)s
You can change the logging level, filename, or format as per your preferences.