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.
- 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
Here's what's included:
- app.py - The main application (user-friendly web interface)
- Supporting files - Handle document processing and retrieval in the background
- Python 3.10+
- OpenAI API key
- pip (Python package manager)
-
Navigate to the project directory
cd agentic-rag -
Create a virtual environment (recommended)
python -m venv venv # Activate it: # Windows: venv\Scripts\activate # macOS/Linux: source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure OpenAI API Key
Create a
.envfile in the project root:OPENAI_API_KEY=your_openai_api_key_here
streamlit run app.pyThis 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
The app uses OpenAI's GPT-4 by default. If you want to use a faster or cheaper model:
- Open
llm_config.py - Change
"model": "gpt-4"to:"gpt-4-turbo"- Faster and cheaper"gpt-3.5-turbo"- Much cheaper, slightly less accurate
- Save the file and restart the app
If responses are slow, try a faster model.
When you ask a question:
- The app searches all indexed documents for relevant information
- An AI assistant reads the relevant sections
- It synthesizes an answer based on what it found
- The answer is displayed with sources so you can verify it
- 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.
- 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
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
.envfile 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-turboin the configuration (much cheaper) - Ask more specific questions to reduce token usage
Responses are slow
- Use
gpt-3.5-turboinstead ofgpt-4(faster and cheaper) - Ask shorter, more focused questions
- 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
See LICENSE file for details.
For developers interested in how this works:
Last Updated: March 2026
