You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Query documents using either the OpenAI or local model:
93
+
94
+
Query documents using either OpenAI or a local model:
95
+
91
96
```bash
92
97
# Using OpenAI (requires API key in .env)
93
-
python rag_agent.py --query "What are the main topics?" --store-path my_chroma_db
98
+
python rag_agent.py --query "Can you explain the DaGAN Approach proposed in the Depth-Aware Generative Adversarial Network for Talking Head Video Generation article?"
94
99
95
100
# Using local Mistral model
96
-
python local_rag_agent.py --query "What are the main topics?" --store-path my_chroma_db
101
+
python local_rag_agent.py --query "Can you explain the DaGAN Approach proposed in the Depth-Aware Generative Adversarial Network for Talking Head Video Generation article?"
97
102
```
98
103
99
104
### 3. Complete Pipeline Example
100
105
101
106
Here's how to process a document and query it using the local model:
python local_rag_agent.py --query "What is the main conclusion?" --store-path my_chroma_db
116
+
python local_rag_agent.py --query "Can you explain the DaGAN Approach proposed in the Depth-Aware Generative Adversarial Network for Talking Head Video Generation article?"
111
117
```
112
118
113
119
Or using OpenAI (requires API key):
114
120
```bash
115
121
# Same steps 1 and 2 as above, then:
116
-
python rag_agent.py --query "What is the main conclusion?" --store-path my_chroma_db
122
+
python rag_agent.py --query "Can you explain the DaGAN Approach proposed in the Depth-Aware Generative Adversarial Network for Talking Head Video Generation article?"
117
123
```
118
124
119
125
## API Endpoints
@@ -153,11 +159,19 @@ The system consists of several key components:
153
159
- Local Agent: Uses `Mistral-7B` as an open-source alternative
154
160
4. **FastAPI Server**: Provides REST API endpoints for document upload and querying
155
161
162
+
The RAG Agent flow is the following:
163
+
164
+
1. Analyzes query type
165
+
2. Try to find relevant PDF context, regardless of query type
166
+
3. If PDF context is found, use it to generate a response.
167
+
4. If no PDF context is found OR if it's a general knowledge query, use the pre-trainedLLM directly
168
+
5. Fall back to a "no information" response only in edge cases.
169
+
156
170
## Hardware Requirements
157
171
158
-
- For OpenAI Agent: Standard CPU machine
159
-
- For Local Agent:
160
-
- Minimum 16GB RAM, recommended more than 24GBs
172
+
- For the OpenAI Agent: Standard CPU machine
173
+
- For the Local Agent:
174
+
- Minimum 16GB RAM (recommended >24GBs)
161
175
- GPU with 8GB VRAM recommended for better performance
162
176
- Will run on CPU if GPU is not available, but will be significantly slower.
0 commit comments