Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agentic RAG - Document Q&A Assistant

UI

An intelligent chatbot that can answer questions about your PDF documents. Simply upload a document and start asking questions - the system finds relevant information and provides accurate answers instantly.

📋 What Can You Do?

  • Upload and chat with PDFs: Ask questions about your documents without reading through everything
  • Get accurate answers: The system intelligently searches the document to find relevant information
  • Have natural conversations: Ask follow-up questions and the assistant remembers the context
  • See sources: Every answer includes references to where the information came from in your document
  • Multi-turn dialogue: Have a real conversation about your documents

📁 Project Files

Here's what's included:

  • app.py - The main application (user-friendly web interface)
  • Supporting files - Handle document processing and retrieval in the background

🚀 Setup Instructions

Prerequisites

  • Python 3.10+
  • OpenAI API key
  • pip (Python package manager)

Installation Steps

  1. Navigate to the project directory

    cd agentic-rag
  2. Create a virtual environment (recommended)

    python -m venv venv
    
    # Activate it:
    # Windows:
    venv\Scripts\activate
    # macOS/Linux:
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure OpenAI API Key

    Create a .env file in the project root:

    OPENAI_API_KEY=your_openai_api_key_here

🏃 Running the Application

Start the Chatbot

streamlit run app.py

This opens your browser to a chat interface. Now you can:

  • Upload a pdf document
  • Ask questions about your documents
  • Get instant answers with sources
  • Have a back-and-forth conversation
  • The assistant remembers the context of your conversation

🔧 Configuration

Choose Your AI Model

The app uses OpenAI's GPT-4 by default. If you want to use a faster or cheaper model:

  1. Open llm_config.py
  2. Change "model": "gpt-4" to:
    • "gpt-4-turbo" - Faster and cheaper
    • "gpt-3.5-turbo" - Much cheaper, slightly less accurate
  3. Save the file and restart the app

If responses are slow, try a faster model.

🤖 How It Works

When you ask a question:

  1. The app searches all indexed documents for relevant information
  2. An AI assistant reads the relevant sections
  3. It synthesizes an answer based on what it found
  4. The answer is displayed with sources so you can verify it
  5. When you ask a follow-up question, the assistant remembers what you discussed before

It's like having a smart research assistant that knows your documents inside and out.

Tips for Best Results

  • Ask clear, specific questions
  • Use follow-ups to explore topics further - the assistant remembers context
  • If an answer seems incomplete, ask for clarification
  • The system shows sources so you can verify answers in the original document

🐛 Troubleshooting

The app won't start

  • Make sure you installed all the dependencies: pip install -r requirements.txt
  • Verify Python 3.10 or higher is installed: python --version

"API key not found" error

  • Make sure you created a .env file with your OpenAI API key
  • Check that the file is in the project root directory
  • Restart the app after adding the API key

"Index not found" error

  • Check if the document db has been correctly built

API costs are high

  • Try switching to gpt-3.5-turbo in the configuration (much cheaper)
  • Ask more specific questions to reduce token usage

Responses are slow

  • Use gpt-3.5-turbo instead of gpt-4 (faster and cheaper)
  • Ask shorter, more focused questions

TODO

  • Add support for more document types (txt, web, docx, csv, ...)
  • Add more LLM providers (huggingface, ollama, azure-ai, vertex-ai, claude, ...)
  • Make the chat UI more user friendly

📝 License

See LICENSE file for details.

📚 Learn More

For developers interested in how this works:


Last Updated: March 2026

About

A simple Agentic-RAG using Microsoft Autogen and Langchain. You can upload and talk with your Documents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages