Skip to content

Built an intelligent document analysis system that allows users to upload PDF, DOCX, or TXT files and have natural conversations with their content using advanced AI technology.

Notifications You must be signed in to change notification settings

PTHARRISH/rag_chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‚ RAG Application with Langchain

A Retrieval-Augmented Generation (RAG) application built with Streamlit and Langchain, powered by Google's Gemini AI models. This application allows users to upload documents and interact with them through intelligent Q&A.

RAG Application Screenshot

🌟 Features

  • Document Upload: Support for PDF, DOCX, and TXT file formats
  • Smart Document Processing: Automatic text extraction and processing
  • AI-Powered Q&A: Chat with your documents using Google's Gemini 1.5 Flash model
  • Vector Embeddings: Efficient document search using Google's embedding models
  • User-Friendly Interface: Clean and intuitive Streamlit web interface

πŸš€ Technologies Used

  • Streamlit: Web application framework
  • Langchain: LLM application framework
  • Google Gemini AI: Large language model (gemini-1.5-flash)
  • Google Generative AI Embeddings: Document embedding model (embedding-001)
  • Python: Programming language

πŸ“‹ Prerequisites

Before running this application, make sure you have:

  • Python 3.7 or higher
  • Google API key for Gemini AI
  • Required Python packages (see Installation)

πŸ› οΈ Installation

  1. Clone the repository
git clone https://github.com/PTHARRISH/rag_chatbot.git
cd rag-langchain-app
  1. Install required packages
pip install streamlit langchain google-generativeai
  1. Set up your Google API key
- Get your API key from [Google AI Studio](https://makersuite.google.com/app/apikey)
- Set it as an environment variable or add it to your code

πŸ”§ Usage

  1. Run the application
streamlit run app.py
  1. Upload a document
  • Click on the file uploader
  • Select a PDF, DOCX, or TXT file
  • Wait for the file to be processed
  1. Start chatting
  • Ask questions about your uploaded document
  • Get AI-powered answers based on the document content

πŸ“ Project Structure

rag-langchain-app/
β”‚
β”œβ”€β”€ app.py # Main Streamlit application
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ README.md # Project documentation
└── temp # Temporary uploaded files (auto-generated)

πŸ”‘ Environment Variables


Create a `.env` file in the root directory:

GOOGLE_API_KEY=your_google_api_key_here

πŸ“ Code Overview

The application uses:

  • ChatGoogleGenerativeAI for conversational AI capabilities
  • GoogleGenerativeAIEmbeddings for document vectorization
  • Streamlit for the web interface
  • File handling for document processing

Note: This is a learning project created following a YouTube tutorial. Feel free to fork and enhance it further!

About

Built an intelligent document analysis system that allows users to upload PDF, DOCX, or TXT files and have natural conversations with their content using advanced AI technology.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages