MultiAgent Doc QnA uses a team of AI agents that work together to understand documents and answer questions based on them. Rather than using traditional vector embeddings like RAG systems, it relies on intelligent document summarization and contextual relevance scoring.
The Document Analysis Agent
first creates comprehensive appendices of documents, the Research Agent
evaluates question relevance against these appendices, and the Reply Agent
generates answers using the most relevant document, by loading it in the system message as a whole.
Choose this solution when:
- You are handling highly complicated documents that RAG struggles with
- The answers are based on multiple parts of the same document
- Context from the whole document might be needed to answer a question
- Looking for a simpler deployment without vector databases
- Need transparent agent-based processing pipeline
- Not designed to handle a large amount of documents (30 documents and over will be a stretch)
- Doesn't perform cross-document answer generation (each answer comes from a single document)
- Higher token usage compared to RAG systems
- May be slower for very large document collections
- Maximum token limit per document chunk (120k tokens)
- Requires Azure OpenAI access
- No persistent document storage (session-based only)
-
Document Analysis Agent 📄
- Processes PDF documents
- Extracts and chunks text content
- Generates document summaries
- Manages token limitations
-
Research Agent 🔍
- Analyzes question relevance
- Scores document sections
- Identifies most pertinent content
- Provides relevance metrics
-
Reply Agent 💡
- Generates accurate answers
- Uses context-aware processing
- Maintains source truthfulness
- Provides clear explanations
- Python 3.8+
- Azure OpenAI API access
# Clone repository
git clone https://github.com/yourusername/multiagent-doc-qna.git
cd multiagent-doc-qna
# Set up virtual environment
python -m venv venv
source venv/bin/activate # Unix
.\venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your credentials
# Launch application
streamlit run app.py
- Create an Azure OpenAI resource
- Deploy a model
- Get API credentials
- Configure environment variables
- Launch the application
- Click "Upload Documents"
- Select one or more PDF files
- Wait for processing completion
- Type your question in the input field
- Click "Submit Question"
- View document relevance scores
- Read the generated answer
- Relevance Scores: Shows how relevant each document is to your question
- Token Counts: Displays processing efficiency metrics
- Document Summaries: Provides quick content overview
- System Status: Shows real-time processing information
- Maximum tokens per chunk: 120,000
- Automatic chunking for large documents
- Token count monitoring
- Optimization for Azure OpenAI context limits
- No document storage
- Session-only processing