From 4a505990555532c8978228f779fbdf718682a551 Mon Sep 17 00:00:00 2001 From: ShubhamSaboo Date: Tue, 30 Apr 2024 15:23:16 -0500 Subject: [PATCH] Added new app demo --- README.md | 29 +++++++++++++++- chat_with_gmail/README.md | 42 +++++++++++++++++++++++ chat_with_gmail/chat_gmail.py | 40 +++++++++++++++++++++ chat_with_gmail/requirements.txt | 2 ++ chat_with_pdf/README.md | 2 +- chat_with_youtube_videos/README.md | 2 +- chat_with_youtube_videos/requirements.txt | 2 ++ 7 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 chat_with_gmail/README.md create mode 100644 chat_with_gmail/chat_gmail.py create mode 100644 chat_with_gmail/requirements.txt create mode 100644 chat_with_youtube_videos/requirements.txt diff --git a/README.md b/README.md index f4ea30a..d9cb6ab 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@

- Unwind AI + + Unwind AI +

@@ -25,3 +27,28 @@ Engage in intelligent conversation and question-answering based on the content o ### 📽️ Chat with YouTube Videos Dive into the world of video content with interactive conversation and question-answering based on YouTube videos. Simply provide a YouTube video URL and start engaging with the video's content through natural language. + +## 🚀 Getting Started + +1. Clone the repository + +```bash +git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git +``` + +2. Navigate to the desired project directory + +```bash +cd awesome-llm-apps/chat_with_gmail +``` + +3. Install the required dependencies + +```bash +pip install -r requirements.txt +``` + +4. Follow the project-specific instructions in each project's README.md file to set up and run the app. + +### 🤝 Contributing +Contributions are welcome! If you have any ideas, improvements, or new apps to add, please submit a pull request. Make sure to follow the existing project structure and include a detailed README.md for each new app. diff --git a/chat_with_gmail/README.md b/chat_with_gmail/README.md new file mode 100644 index 0000000..e216e89 --- /dev/null +++ b/chat_with_gmail/README.md @@ -0,0 +1,42 @@ +## 📨 Chat with Gmail Inbox + +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 +``` +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 +``` + + diff --git a/chat_with_gmail/chat_gmail.py b/chat_with_gmail/chat_gmail.py new file mode 100644 index 0000000..7cb6e2f --- /dev/null +++ b/chat_with_gmail/chat_gmail.py @@ -0,0 +1,40 @@ +import tempfile +import streamlit as st +from embedchain import App + +# Define the embedchain_bot function +def embedchain_bot(db_path, api_key): + return App.from_config( + config={ + "llm": {"provider": "openai", "config": {"model": "gpt-4-turbo", "temperature": 0.5, "api_key": api_key}}, + "vectordb": {"provider": "chroma", "config": {"dir": db_path}}, + "embedder": {"provider": "openai", "config": {"api_key": api_key}}, + } + ) + +# Create Streamlit app +st.title("Chat with your Gmail Inbox 📧") +st.caption("This app allows you to chat with your Gmail inbox using OpenAI API") + +# Get the OpenAI API key from the user +openai_access_token = st.text_input("Enter your OpenAI API Key", type="password") + +# Set the Gmail filter statically +gmail_filter = "to: me label:inbox" + +# Add the Gmail data to the knowledge base if the OpenAI API key is provided +if openai_access_token: + # Create a temporary directory to store the database + db_path = tempfile.mkdtemp() + # Create an instance of Embedchain App + app = embedchain_bot(db_path, openai_access_token) + app.add(gmail_filter, data_type="gmail") + st.success(f"Added emails from Inbox to the knowledge base!") + + # Ask a question about the emails + prompt = st.text_input("Ask any question about your emails") + + # Chat with the emails + if prompt: + answer = app.query(prompt) + st.write(answer) \ No newline at end of file diff --git a/chat_with_gmail/requirements.txt b/chat_with_gmail/requirements.txt new file mode 100644 index 0000000..edfcfe9 --- /dev/null +++ b/chat_with_gmail/requirements.txt @@ -0,0 +1,2 @@ +streamlit +embedchain[gmail] \ No newline at end of file diff --git a/chat_with_pdf/README.md b/chat_with_pdf/README.md index 6117e14..4994d4e 100644 --- a/chat_with_pdf/README.md +++ b/chat_with_pdf/README.md @@ -1,4 +1,4 @@ -## Chat with PDF 📄 +## 📄 Chat with PDF LLM app with RAG to chat with PDF 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 the uploaded PDF. diff --git a/chat_with_youtube_videos/README.md b/chat_with_youtube_videos/README.md index 71fe19a..69e8d8e 100644 --- a/chat_with_youtube_videos/README.md +++ b/chat_with_youtube_videos/README.md @@ -1,4 +1,4 @@ -## Chat with YouTube Videos 📺 +## 📽️ Chat with YouTube Videos LLM app with RAG to chat with YouTube Videos 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 the uploaded video. diff --git a/chat_with_youtube_videos/requirements.txt b/chat_with_youtube_videos/requirements.txt new file mode 100644 index 0000000..3d083f6 --- /dev/null +++ b/chat_with_youtube_videos/requirements.txt @@ -0,0 +1,2 @@ +streamlit +embedchain[youtube] \ No newline at end of file