PAIAssistant is a AI tool designed for users interact with emails via natural language queries. This demo showcases its ability to organize emails using a vector database. It features various Retrieval-Augmented Generation (RAG) methods including Basic Retrieval, Sentence Window Retrieval, and Auto-Merging Retrieval. These methods enhance the processing of user queries, which are then handled by a Large Language Model (LLM) like OpenAI's. The AI generates responses that can be either displayed on-screen or read aloud, offering a comprehensive and user-friendly email management experience.
The best way to support TruLens is to give us a β on GitHub and join our slack community!
The steps below can be used to setup the enviroment for this demo to run on Ubuntu 20.04.6 LTS. Alternatively you can setup the python3.10 environment on a windows machine with Nvidia gpu card with necessary drivers. The install will run with or without GPU. Running locally would be very slow on CPU inference. Running with OpenAI support could be alternative if GPU is not available. Check flag/api key settings in documentation to use OpenAI.
NOTE: This example VM setup will work for OpenAI inference. Local inference will be very slow due to lack of GPU. For local inference use a machine with GPU, windows or linux.
- Download Ubuntu 20.04.6 LTS server ISO image.
- Download Oracle VirtualBox.
- Create a new virtual machine with the ubuntu image downloaded above. Sample configuration is 4gb ram, 2 vcpu, bridged network settting, 25 gb disk.
- Signup for platform.openai.com and generate OpenAI api key
sudo apt install net-tools
sudo apt update && sudo apt upgrade
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install python3.10
sudo apt install python-is-python3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --config python3
curl https://bootstrap.pypa.io/get-pip.py | python
sudo apt install python3.10-distutils
sudo apt install npm
sudo reboot now
- Change directory to web. If necessary update host/port parameter in config.json
- Change directory to web/public. Update the completion.apiendpoint to the ip address of your instance.
- Change directory to api. Update config.ini to update host/port parameters if needed.
Current version has 250 random emails in email folder ready for indexing. Basic and sentence indexes are also provided so you can start playing with demo without further indexing work. If you need to index with your own custom data follow these steps.
- You can use your own email data in plain text format or use the data set used in this example and random sample from Kaggle
- Copy these emails to emails folder and run createindex.py to create the vector index (basic/sentence/automerge) for query.
cd api
export OPENAI_API_KEY=<YOUR OPENAI API KEY>
python createindex.py
Choose which version of index to query by updating the config.ini in api folder [api] section.
cd web
npm install
npm start
cd api
pip install -r requirements.txt
export OPENAI_API_KEY=<YOUR OPENAI API KEY>
python api.py
To use openai set the following attribute in api/config.ini. By default it is set to false.
useopenai=true
- https://[ipaddress]:4000 in chrome browser to use the demo.
- https://[ipaddress]:7860 gradio text input/response interface.
- Create a jupyter notebook
- Create google colab notebook
- Create Docker image
- Create git workflow to post to hosting platform to visualize it.
This project is Apache-2.0 licensed.