# Chat With Gmail

> LLM app with RAG to chat with Gmail in just 30 lines of Python Code. The app uses Retrieval Augmented Generation (RAG) to provide accurate answers to questions based on the content of your Gmail Inbox.

- Source: https://doutorai.pt/en/apps/chat-with-gmail
- Category: Chat with Your Data
- Difficulty: Easy
- Models: OpenAI
- Frameworks: -
- Runs locally?: Needs cloud APIs
- Required keys: None
- License: Apache-2.0
- Site: Doutor AI (https://doutorai.pt/en) - AI tools for small businesses

## Full tutorial

## 📨 Chat with Gmail Inbox 

### 🎓 FREE Step-by-Step Tutorial 
**👉 [Click here to follow our complete step-by-step tutorial](https://www.theunwindai.com/p/build-rag-app-to-chat-with-your-gmail-inbox) and learn how to build this from scratch with detailed code walkthroughs, explanations, and best practices.**

LLM app with RAG to chat with Gmail in just 30 lines of Python Code. The app uses Retrieval Augmented Generation (RAG) to provide accurate answers to questions based on the content of your Gmail Inbox.

### Features

- Connect to your Gmail Inbox
- Ask questions about the content of your emails
- Get accurate answers using RAG and the selected LLM

### Installation

1. Clone the repository

```bash
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
cd advanced_llm_apps/chat_with_X_tutorials/chat_with_gmail
```
2. Install the required dependencies

```bash
pip install -r requirements.txt
```

3. Set up your Google Cloud project and enable the Gmail API:

- Go to the [Google Cloud Console](https://console.cloud.google.com/) and create a new project.
- Navigate to "APIs & Services > OAuth consent screen" and configure the OAuth consent screen.
- Publish the OAuth consent screen by providing the necessary app information.
- Enable the Gmail API and create OAuth client ID credentials.
- Download the credentials in JSON format and save them as `credentials.json` in your working directory.

4. Get your OpenAI API Key

- Sign up for an [OpenAI account](https://platform.openai.com/) (or the LLM provider of your choice) and obtain your API key.

4. Run the Streamlit App

```bash
streamlit run chat_gmail.py
```

## Save hours every week with AI, no hassle

**Doutor AI** gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further. [See plans →](https://doutorai.pt/en/pricing)

---
Content by Doutor AI (https://doutorai.pt/en). When quoting, please cite the source: https://doutorai.pt/en/apps/chat-with-gmail
