Skip to content

sahilrider/RAG-Email-Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAG-Email-Chatbot

A Retrieval-Augmented Generation (RAG) based chatbot for email interactions. This project implements an intelligent email assistant that can understand and process email content using advanced language models and RAG techniques.

Features

  • Email processing and analysis
  • RAG-based response generation
  • Gmail API integration
  • Pinecone based Vector Database
  • OPENAI for embeddings and as generator

Example

Example Chat

Prerequisites

  • Python 3.8 or higher
  • uv package manager (for dependency management)
  • Gmail API credentials

Installation

  1. First, install uv if you haven't already:
pip install uv
  1. Clone the repository:
git clone https://github.com/yourusername/RAG-Email-Chatbot.git
cd RAG-Email-Chatbot
  1. Create and activate a virtual environment using uv:
uv venv
.venv/Scripts/activate  # On Windows
source .venv/bin/activate  # On Unix/MacOS
  1. Install dependencies using uv:
uv pip install -r requirements.txt

Configuration

  1. Create a .env file in the root directory with the following variables:
OPENAI_API_KEY=<your_openai_api_key>
PINECONE_APT_KEY=<your_pinecone_key>
COHERE_API_KEY=<your_cohere_key>
  1. Set up Gmail API credentials:
  • Go to the Google Cloud Console
  • Create a new project or select an existing one
  • Enable the Gmail API
  • Create credentials (OAuth 2.0 Client ID)
  • Download the credentials and save as credentials.json in the project root

Running the Project

  1. Ensure your virtual environment is activated:
.venv/Scripts/activate  # On Windows
source .venv/bin/activate  # On Unix/MacOS
  1. Run the main application with ingest to upsert emails in vector db:
python ./src/main.py --ingest
  1. Run the main application (chatbot mode):
python ./src/main.py

Project Structure

RAG-Email-Chatbot/
├── src/               # Source code
│   ├── __init__.py   # Package initializer
│   ├── main.py       # Main application entry point
│   ├── mail.py       # Email handling and Gmail API integration
│   ├── generator.py  # RAG-based response generation
│   ├── vector_db.py  # Vector database operations
│   └── utils.py      # Utility functions and helpers
├── tests/            # Test files
├── logs/             # Application logs
├── requirements.txt  # Project dependencies
└── .env             # Environment variables

TODO

  • Email text cleaning function
  • Open source encoder
  • Option to change LLM
  • Add open source LLMs.
  • Code cleanup
  • Add testcases using tox.
  • Create Docker Image.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributors

Sahil Kumar
Sahil Kumar

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages