File size: 3,063 Bytes
aca8ab4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Quick Start Guide

## Installation & Setup (5 minutes)

### 1. Install Dependencies

```bash
pip install -r requirements.txt
```

### 2. Configure Azure OpenAI

Create a `.env` file with your Azure OpenAI credentials:

```bash
cp .env.example .env
```

Edit `.env`:
```
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_API_KEY=your-api-key-here
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o-mini
```

### 3. Run the Application

```bash
python app.py
```

Visit `http://localhost:7860` in your browser.

## First Query

Try this example query:

```
Research Question: "What are the latest advances in multi-agent reinforcement learning?"
Category: cs.AI - Artificial Intelligence
Number of Papers: 3
```

Click "Analyze Papers" and wait ~1-2 minutes.

## Expected Output

You should see:

1. **Papers Tab**: Table with 3 retrieved papers
2. **Analysis Tab**: Detailed analysis of each paper
3. **Synthesis Tab**:
   - Executive summary
   - Consensus findings (green highlights)
   - Contradictions (yellow highlights)
   - Research gaps
4. **Citations Tab**: APA-formatted references
5. **Stats Tab**: Processing time and cost (~$0.20-0.40)

## Troubleshooting

### Error: "No module named 'xyz'"
```bash
pip install -r requirements.txt --upgrade
```

### Error: "Azure OpenAI authentication failed"
- Check your `.env` file has correct credentials
- Verify your Azure OpenAI deployment name matches your actual deployment

### Error: "Failed to download paper"
- Some arXiv papers may have download issues
- Try a different query or category

### Error: "ChromaDB error"
```bash
rm -rf data/chroma_db/
# Restart the app
```

## Architecture Overview

```
User Query
    ↓
Retriever Agent (arXiv search + PDF processing)
    ↓
Analyzer Agent (RAG-based analysis per paper)
    ↓
Synthesis Agent (Cross-paper comparison)
    ↓
Citation Agent (Validation + APA formatting)
    ↓
Gradio UI (4 output tabs)
```

## Key Features

- **Temperature=0**: Deterministic outputs
- **RAG Grounding**: All claims backed by source text
- **Semantic Caching**: Repeated queries use cache
- **Cost Tracking**: Real-time cost estimates
- **Error Handling**: Graceful failures with user-friendly messages

## Performance Benchmarks

| Papers | Time | Cost | Chunks |
|--------|------|------|--------|
| 3      | ~90s | $0.25 | ~150   |
| 5      | ~120s| $0.40 | ~250   |
| 10     | ~180s| $0.75 | ~500   |

## Next Steps

1. **Customize Categories**: Edit `ARXIV_CATEGORIES` in `app.py`
2. **Adjust Chunking**: Modify `chunk_size` in `utils/pdf_processor.py`
3. **Change Top-K**: Update `top_k` in `rag/retrieval.py`
4. **Add Logging**: Increase log level in agents for debugging

## Deployment to Hugging Face

```bash
# 1. Create a new Space on huggingface.co
# 2. Upload all files
# 3. Add secrets in Space settings:
#    - AZURE_OPENAI_ENDPOINT
#    - AZURE_OPENAI_API_KEY
#    - AZURE_OPENAI_DEPLOYMENT_NAME
# 4. Space will auto-deploy
```

## Support

For issues: https://github.com/yourusername/Multi-Agent-Research-Paper-Analysis-System/issues