akashub
commited on
Commit
Β·
f4ffd7e
1
Parent(s):
b20698b
fix(README.md setup)
Browse files- .gitignore +1 -0
- README.md +10 -210
- README_ref.md +213 -0
- requirements.txt +0 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.env
|
README.md
CHANGED
|
@@ -1,213 +1,13 @@
|
|
| 1 |
-
# πΎ Alert Summary Prototype Backend
|
| 2 |
-
|
| 3 |
-
**Multi-stage MCP Pipeline for Agricultural Intelligence**
|
| 4 |
-
|
| 5 |
-
---
|
| 6 |
-
|
| 7 |
-
## π― Overview
|
| 8 |
-
|
| 9 |
-
Farmer.Chat uses a **4-stage pipeline** to process agricultural queries:
|
| 10 |
-
|
| 11 |
-
```
|
| 12 |
-
Query β Router β Executor (Parallel) β Compiler β Translator β Advice
|
| 13 |
-
```
|
| 14 |
-
|
| 15 |
-
### Architecture
|
| 16 |
-
|
| 17 |
-
1. **Stage 1: Query Router** - Analyzes farmer's question and selects relevant MCP servers
|
| 18 |
-
2. **Stage 2: MCP Executor** - Calls multiple APIs in parallel (weather, soil, water, elevation, pests)
|
| 19 |
-
3. **Stage 3: Response Compiler** - Merges data from all sources
|
| 20 |
-
4. **Stage 4: Farmer Translator** - Converts technical data to actionable farmer advice
|
| 21 |
-
|
| 22 |
-
---
|
| 23 |
-
|
| 24 |
-
## π API Endpoints
|
| 25 |
-
|
| 26 |
-
### `POST /api/query`
|
| 27 |
-
Process a farmer's question
|
| 28 |
-
|
| 29 |
-
**Request:**
|
| 30 |
-
```json
|
| 31 |
-
{
|
| 32 |
-
"query": "Should I plant rice today?",
|
| 33 |
-
"location": {
|
| 34 |
-
"name": "Bangalore",
|
| 35 |
-
"lat": 12.8716,
|
| 36 |
-
"lon": 77.4946
|
| 37 |
-
}
|
| 38 |
-
}
|
| 39 |
-
```
|
| 40 |
-
|
| 41 |
-
**Response:**
|
| 42 |
-
```json
|
| 43 |
-
{
|
| 44 |
-
"success": true,
|
| 45 |
-
"query": "Should I plant rice today?",
|
| 46 |
-
"advice": "...",
|
| 47 |
-
"routing": {...},
|
| 48 |
-
"data": {...},
|
| 49 |
-
"execution_time_seconds": 3.5
|
| 50 |
-
}
|
| 51 |
-
```
|
| 52 |
-
|
| 53 |
-
### `POST /api/export-pdf`
|
| 54 |
-
Export query result as PDF
|
| 55 |
-
|
| 56 |
-
**Request:** Same as `/api/query`
|
| 57 |
-
|
| 58 |
-
**Response:** PDF file download
|
| 59 |
-
|
| 60 |
-
### `GET /api/health`
|
| 61 |
-
Health check
|
| 62 |
-
|
| 63 |
-
### `GET /api/servers`
|
| 64 |
-
List available MCP servers
|
| 65 |
-
|
| 66 |
-
---
|
| 67 |
-
|
| 68 |
-
## π οΈ MCP Servers
|
| 69 |
-
|
| 70 |
-
| Server | Data Source | Information |
|
| 71 |
-
|--------|-------------|-------------|
|
| 72 |
-
| **weather** | Open-Meteo | Current weather, 7-day forecasts |
|
| 73 |
-
| **soil_properties** | SoilGrids | Clay, sand, pH, nutrients |
|
| 74 |
-
| **water** | GRACE Satellite | Groundwater levels, drought status |
|
| 75 |
-
| **elevation** | OpenElevation | Field elevation, terrain data |
|
| 76 |
-
| **pests** | iNaturalist | Recent pest observations |
|
| 77 |
-
|
| 78 |
-
---
|
| 79 |
-
|
| 80 |
-
## π Deployment Instructions
|
| 81 |
-
|
| 82 |
-
### 1. Create Hugging Face Space
|
| 83 |
-
|
| 84 |
-
1. Go to https://huggingface.co/new-space
|
| 85 |
-
2. Space name: `farmer-chat-backend`
|
| 86 |
-
3. Owner: `aakashdg`
|
| 87 |
-
4. SDK: **Gradio** (we'll use FastAPI inside)
|
| 88 |
-
5. Set to **Public**
|
| 89 |
-
|
| 90 |
-
### 2. Upload Files
|
| 91 |
-
|
| 92 |
-
Upload all files maintaining this structure:
|
| 93 |
-
```
|
| 94 |
-
farmer-chat-backend/
|
| 95 |
-
βββ app.py
|
| 96 |
-
βββ requirements.txt
|
| 97 |
-
βββ README.md
|
| 98 |
-
βββ src/
|
| 99 |
-
β βββ __init__.py
|
| 100 |
-
β βββ pipeline.py
|
| 101 |
-
β βββ router.py
|
| 102 |
-
β βββ executor.py
|
| 103 |
-
β βββ compiler.py
|
| 104 |
-
β βββ translator.py
|
| 105 |
-
β βββ pdf_generator.py
|
| 106 |
-
β βββ servers/
|
| 107 |
-
β βββ __init__.py
|
| 108 |
-
β βββ (all server classes in one file or separate)
|
| 109 |
-
```
|
| 110 |
-
|
| 111 |
-
### 3. Set Environment Variables
|
| 112 |
-
|
| 113 |
-
In Space Settings β Variables and secrets:
|
| 114 |
-
- Add secret: `OPENAI_API_KEY` = your OpenAI API key
|
| 115 |
-
|
| 116 |
-
### 4. Deploy!
|
| 117 |
-
|
| 118 |
-
Space will auto-deploy. Access at:
|
| 119 |
-
```
|
| 120 |
-
https://huggingface.co/spaces/aakashdg/farmer-chat-backend
|
| 121 |
-
```
|
| 122 |
-
|
| 123 |
---
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
"query": "What is the soil composition?",
|
| 134 |
-
"location": {"name": "Bangalore", "lat": 12.8716, "lon": 77.4946}
|
| 135 |
-
}'
|
| 136 |
-
```
|
| 137 |
-
|
| 138 |
-
### Test with Python:
|
| 139 |
-
|
| 140 |
-
```python
|
| 141 |
-
import requests
|
| 142 |
-
|
| 143 |
-
response = requests.post(
|
| 144 |
-
"https://huggingface.co/spaces/aakashdg/farmer-chat-backend/api/query",
|
| 145 |
-
json={
|
| 146 |
-
"query": "Will it rain this week?",
|
| 147 |
-
"location": {"name": "Bangalore", "lat": 12.8716, "lon": 77.4946}
|
| 148 |
-
}
|
| 149 |
-
)
|
| 150 |
-
|
| 151 |
-
print(response.json())
|
| 152 |
-
```
|
| 153 |
-
|
| 154 |
-
---
|
| 155 |
-
|
| 156 |
-
## π Performance
|
| 157 |
-
|
| 158 |
-
- **Parallel execution**: All MCP servers called simultaneously
|
| 159 |
-
- **Typical response time**: 3-5 seconds
|
| 160 |
-
- **Success rate**: ~95% (graceful degradation if servers fail)
|
| 161 |
-
|
| 162 |
-
---
|
| 163 |
-
|
| 164 |
-
## π Security
|
| 165 |
-
|
| 166 |
-
- OpenAI API key stored as HF Space secret
|
| 167 |
-
- CORS enabled for frontend integration
|
| 168 |
-
- Rate limiting: 100 queries/hour per IP (configurable)
|
| 169 |
-
|
| 170 |
-
---
|
| 171 |
-
|
| 172 |
-
## π Scaling
|
| 173 |
-
|
| 174 |
-
To add more MCP servers:
|
| 175 |
-
|
| 176 |
-
1. Create new server class in `src/servers/`
|
| 177 |
-
2. Add to `MCP_SERVER_REGISTRY` in `executor.py`
|
| 178 |
-
3. Router will automatically include it in routing decisions
|
| 179 |
-
|
| 180 |
-
---
|
| 181 |
-
|
| 182 |
-
## π Troubleshooting
|
| 183 |
-
|
| 184 |
-
### "OPENAI_API_KEY not set"
|
| 185 |
-
- Check HF Space Settings β Variables and secrets
|
| 186 |
-
- Ensure secret name is exactly `OPENAI_API_KEY`
|
| 187 |
-
|
| 188 |
-
### Slow responses
|
| 189 |
-
- Normal for first query (cold start)
|
| 190 |
-
- Subsequent queries faster due to caching
|
| 191 |
-
|
| 192 |
-
### Server failures
|
| 193 |
-
- System uses graceful degradation
|
| 194 |
-
- If one server fails, others still provide data
|
| 195 |
-
- Check `failed_servers` in response
|
| 196 |
-
|
| 197 |
-
---
|
| 198 |
-
|
| 199 |
-
## π Support
|
| 200 |
-
|
| 201 |
-
- GitHub Issues: [Link to repo]
|
| 202 |
-
- Creator: @aakashdg
|
| 203 |
-
- Built for: Farmer.chat product demo
|
| 204 |
-
|
| 205 |
-
---
|
| 206 |
-
|
| 207 |
-
## π License
|
| 208 |
-
|
| 209 |
-
MIT License
|
| 210 |
-
|
| 211 |
---
|
| 212 |
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# πΎ Alert Summary Prototype Backend
|
| 2 |
+
|
| 3 |
+
**Multi-stage MCP Pipeline for Agricultural Intelligence**
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## π― Overview
|
| 8 |
+
|
| 9 |
+
Farmer.Chat uses a **4-stage pipeline** to process agricultural queries:
|
| 10 |
+
|
| 11 |
+
```
|
| 12 |
+
Query β Router β Executor (Parallel) β Compiler β Translator β Advice
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
### Architecture
|
| 16 |
+
|
| 17 |
+
1. **Stage 1: Query Router** - Analyzes farmer's question and selects relevant MCP servers
|
| 18 |
+
2. **Stage 2: MCP Executor** - Calls multiple APIs in parallel (weather, soil, water, elevation, pests)
|
| 19 |
+
3. **Stage 3: Response Compiler** - Merges data from all sources
|
| 20 |
+
4. **Stage 4: Farmer Translator** - Converts technical data to actionable farmer advice
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## π API Endpoints
|
| 25 |
+
|
| 26 |
+
### `POST /api/query`
|
| 27 |
+
Process a farmer's question
|
| 28 |
+
|
| 29 |
+
**Request:**
|
| 30 |
+
```json
|
| 31 |
+
{
|
| 32 |
+
"query": "Should I plant rice today?",
|
| 33 |
+
"location": {
|
| 34 |
+
"name": "Bangalore",
|
| 35 |
+
"lat": 12.8716,
|
| 36 |
+
"lon": 77.4946
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
**Response:**
|
| 42 |
+
```json
|
| 43 |
+
{
|
| 44 |
+
"success": true,
|
| 45 |
+
"query": "Should I plant rice today?",
|
| 46 |
+
"advice": "...",
|
| 47 |
+
"routing": {...},
|
| 48 |
+
"data": {...},
|
| 49 |
+
"execution_time_seconds": 3.5
|
| 50 |
+
}
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
### `POST /api/export-pdf`
|
| 54 |
+
Export query result as PDF
|
| 55 |
+
|
| 56 |
+
**Request:** Same as `/api/query`
|
| 57 |
+
|
| 58 |
+
**Response:** PDF file download
|
| 59 |
+
|
| 60 |
+
### `GET /api/health`
|
| 61 |
+
Health check
|
| 62 |
+
|
| 63 |
+
### `GET /api/servers`
|
| 64 |
+
List available MCP servers
|
| 65 |
+
|
| 66 |
+
---
|
| 67 |
+
|
| 68 |
+
## π οΈ MCP Servers
|
| 69 |
+
|
| 70 |
+
| Server | Data Source | Information |
|
| 71 |
+
|--------|-------------|-------------|
|
| 72 |
+
| **weather** | Open-Meteo | Current weather, 7-day forecasts |
|
| 73 |
+
| **soil_properties** | SoilGrids | Clay, sand, pH, nutrients |
|
| 74 |
+
| **water** | GRACE Satellite | Groundwater levels, drought status |
|
| 75 |
+
| **elevation** | OpenElevation | Field elevation, terrain data |
|
| 76 |
+
| **pests** | iNaturalist | Recent pest observations |
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
## π Deployment Instructions
|
| 81 |
+
|
| 82 |
+
### 1. Create Hugging Face Space
|
| 83 |
+
|
| 84 |
+
1. Go to https://huggingface.co/new-space
|
| 85 |
+
2. Space name: `farmer-chat-backend`
|
| 86 |
+
3. Owner: `aakashdg`
|
| 87 |
+
4. SDK: **Gradio** (we'll use FastAPI inside)
|
| 88 |
+
5. Set to **Public**
|
| 89 |
+
|
| 90 |
+
### 2. Upload Files
|
| 91 |
+
|
| 92 |
+
Upload all files maintaining this structure:
|
| 93 |
+
```
|
| 94 |
+
farmer-chat-backend/
|
| 95 |
+
βββ app.py
|
| 96 |
+
βββ requirements.txt
|
| 97 |
+
βββ README.md
|
| 98 |
+
βββ src/
|
| 99 |
+
β βββ __init__.py
|
| 100 |
+
β βββ pipeline.py
|
| 101 |
+
β βββ router.py
|
| 102 |
+
β βββ executor.py
|
| 103 |
+
β βββ compiler.py
|
| 104 |
+
β βββ translator.py
|
| 105 |
+
β βββ pdf_generator.py
|
| 106 |
+
β βββ servers/
|
| 107 |
+
β βββ __init__.py
|
| 108 |
+
β βββ (all server classes in one file or separate)
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
### 3. Set Environment Variables
|
| 112 |
+
|
| 113 |
+
In Space Settings β Variables and secrets:
|
| 114 |
+
- Add secret: `OPENAI_API_KEY` = your OpenAI API key
|
| 115 |
+
|
| 116 |
+
### 4. Deploy!
|
| 117 |
+
|
| 118 |
+
Space will auto-deploy. Access at:
|
| 119 |
+
```
|
| 120 |
+
https://huggingface.co/spaces/aakashdg/farmer-chat-backend
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
## π§ͺ Testing
|
| 126 |
+
|
| 127 |
+
### Test with cURL:
|
| 128 |
+
|
| 129 |
+
```bash
|
| 130 |
+
curl -X POST https://huggingface.co/spaces/aakashdg/farmer-chat-backend/api/query \
|
| 131 |
+
-H "Content-Type: application/json" \
|
| 132 |
+
-d '{
|
| 133 |
+
"query": "What is the soil composition?",
|
| 134 |
+
"location": {"name": "Bangalore", "lat": 12.8716, "lon": 77.4946}
|
| 135 |
+
}'
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
### Test with Python:
|
| 139 |
+
|
| 140 |
+
```python
|
| 141 |
+
import requests
|
| 142 |
+
|
| 143 |
+
response = requests.post(
|
| 144 |
+
"https://huggingface.co/spaces/aakashdg/farmer-chat-backend/api/query",
|
| 145 |
+
json={
|
| 146 |
+
"query": "Will it rain this week?",
|
| 147 |
+
"location": {"name": "Bangalore", "lat": 12.8716, "lon": 77.4946}
|
| 148 |
+
}
|
| 149 |
+
)
|
| 150 |
+
|
| 151 |
+
print(response.json())
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
---
|
| 155 |
+
|
| 156 |
+
## π Performance
|
| 157 |
+
|
| 158 |
+
- **Parallel execution**: All MCP servers called simultaneously
|
| 159 |
+
- **Typical response time**: 3-5 seconds
|
| 160 |
+
- **Success rate**: ~95% (graceful degradation if servers fail)
|
| 161 |
+
|
| 162 |
+
---
|
| 163 |
+
|
| 164 |
+
## π Security
|
| 165 |
+
|
| 166 |
+
- OpenAI API key stored as HF Space secret
|
| 167 |
+
- CORS enabled for frontend integration
|
| 168 |
+
- Rate limiting: 100 queries/hour per IP (configurable)
|
| 169 |
+
|
| 170 |
+
---
|
| 171 |
+
|
| 172 |
+
## π Scaling
|
| 173 |
+
|
| 174 |
+
To add more MCP servers:
|
| 175 |
+
|
| 176 |
+
1. Create new server class in `src/servers/`
|
| 177 |
+
2. Add to `MCP_SERVER_REGISTRY` in `executor.py`
|
| 178 |
+
3. Router will automatically include it in routing decisions
|
| 179 |
+
|
| 180 |
+
---
|
| 181 |
+
|
| 182 |
+
## π Troubleshooting
|
| 183 |
+
|
| 184 |
+
### "OPENAI_API_KEY not set"
|
| 185 |
+
- Check HF Space Settings β Variables and secrets
|
| 186 |
+
- Ensure secret name is exactly `OPENAI_API_KEY`
|
| 187 |
+
|
| 188 |
+
### Slow responses
|
| 189 |
+
- Normal for first query (cold start)
|
| 190 |
+
- Subsequent queries faster due to caching
|
| 191 |
+
|
| 192 |
+
### Server failures
|
| 193 |
+
- System uses graceful degradation
|
| 194 |
+
- If one server fails, others still provide data
|
| 195 |
+
- Check `failed_servers` in response
|
| 196 |
+
|
| 197 |
+
---
|
| 198 |
+
|
| 199 |
+
## π Support
|
| 200 |
+
|
| 201 |
+
- GitHub Issues: [Link to repo]
|
| 202 |
+
- Creator: @aakashdg
|
| 203 |
+
- Built for: Farmer.chat product demo
|
| 204 |
+
|
| 205 |
+
---
|
| 206 |
+
|
| 207 |
+
## π License
|
| 208 |
+
|
| 209 |
+
MIT License
|
| 210 |
+
|
| 211 |
+
---
|
| 212 |
+
|
| 213 |
+
**Built with β€οΈ for farmers**
|
requirements.txt
ADDED
|
File without changes
|