Spaces:
Sleeping
Sleeping
Commit
Β·
eb29e58
1
Parent(s):
73fd1fc
update the readme file
Browse files
README.md
CHANGED
|
@@ -77,8 +77,22 @@ Agents can intelligently:
|
|
| 77 |
- **Strict multi-tenant isolation** with tenant_id filtering
|
| 78 |
- **Intelligent text chunking** (~300 words per chunk)
|
| 79 |
- **Vector similarity search** using cosine distance
|
| 80 |
-
- **
|
| 81 |
-
- **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
### 3. π Live Web Search Tool
|
| 84 |
|
|
@@ -126,7 +140,27 @@ Comprehensive insights for:
|
|
| 126 |
- **Real-time analytics panel** in the frontend UI
|
| 127 |
- **Async analytics processing** via Celery workers
|
| 128 |
|
| 129 |
-
### 7.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
Each tenant gets:
|
| 132 |
|
|
@@ -155,6 +189,9 @@ Isolation is guaranteed via **Supabase Row-Level Security (RLS)**.
|
|
| 155 |
| **Slack / Email** | Alerting system |
|
| 156 |
| **Celery** | Async task queue for document ingestion and analytics |
|
| 157 |
| **Redis / RabbitMQ** | Message broker for Celery workers |
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
### Frontend
|
| 160 |
|
|
@@ -228,29 +265,33 @@ IntegraChat/
|
|
| 228 |
β β β βββ intent_classifier.py
|
| 229 |
β β β βββ redflag_detector.py
|
| 230 |
β β β βββ tool_selector.py
|
|
|
|
|
|
|
| 231 |
β β β βββ prompt_builder.py
|
| 232 |
-
β β β
|
|
|
|
| 233 |
β β βββ mcp_clients/
|
| 234 |
β β β βββ rag_client.py
|
| 235 |
β β β βββ web_client.py
|
| 236 |
β β β βββ admin_client.py
|
| 237 |
β β βββ models/
|
| 238 |
-
β β β βββ
|
| 239 |
-
β β β
|
| 240 |
-
β β β βββ agent_decision.py
|
| 241 |
-
β β β βββ embeddings.py
|
| 242 |
β β βββ utils/
|
| 243 |
-
β β β βββ logging.py
|
| 244 |
-
β β β βββ supabase_client.py
|
| 245 |
-
β β β βββ tenant_context.py
|
| 246 |
-
β β β βββ security.py
|
| 247 |
β β β βββ text_extractor.py
|
| 248 |
β β βββ config.py
|
| 249 |
β β
|
| 250 |
β βββ mcp_servers/
|
| 251 |
β β βββ main.py # RAG MCP Server (FastAPI)
|
| 252 |
-
β β βββ
|
| 253 |
-
β β
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
β β
|
| 255 |
β βββ workers/
|
| 256 |
β β βββ ingestion_worker.py # Celery tasks for document ingestion
|
|
@@ -258,10 +299,6 @@ IntegraChat/
|
|
| 258 |
β β βββ scheduler.py # Scheduled task definitions
|
| 259 |
β β βββ celeryconfig.py # Celery app configuration
|
| 260 |
β β
|
| 261 |
-
β βββ api/
|
| 262 |
-
β β βββ ingestion/
|
| 263 |
-
β β β βββ pdf.py # PDF processing utilities
|
| 264 |
-
β β
|
| 265 |
β βββ tests/
|
| 266 |
β β βββ test_agent.py
|
| 267 |
β β βββ test_rag.py
|
|
@@ -277,12 +314,11 @@ IntegraChat/
|
|
| 277 |
β β βββ layout.tsx # Root layout
|
| 278 |
β β βββ globals.css # Global styles
|
| 279 |
β β βββ knowledge-base/
|
| 280 |
-
β β βββ page.tsx # Knowledge base
|
| 281 |
β βββ components/
|
| 282 |
β β βββ chat-panel.tsx # Chat interface component
|
| 283 |
β β βββ analytics-panel.tsx # Analytics dashboard component
|
| 284 |
β β βββ knowledge-base-panel.tsx # Knowledge base search/ingest UI
|
| 285 |
-
β β βββ ingestion-card.tsx # Document ingestion card
|
| 286 |
β β βββ hero.tsx # Hero section
|
| 287 |
β β βββ feature-grid.tsx # Feature showcase grid
|
| 288 |
β β βββ footer.tsx # Footer component
|
|
@@ -333,12 +369,13 @@ IntegraChat/
|
|
| 333 |
Before you begin, ensure you have the following installed:
|
| 334 |
|
| 335 |
- β
**Python 3.10+**
|
| 336 |
-
- β
**Node.js
|
| 337 |
- β
**Supabase project** (with pgvector extension enabled)
|
| 338 |
- β
**PostgreSQL connection string** (from Supabase)
|
| 339 |
-
- β
**Ollama** (for local LLM)
|
| 340 |
-
- β
**DuckDuckGo Search
|
| 341 |
- β
**Slack/Email webhook** for alerts (optional)
|
|
|
|
| 342 |
|
| 343 |
### Backend Setup
|
| 344 |
|
|
@@ -368,23 +405,45 @@ Before you begin, ensure you have the following installed:
|
|
| 368 |
|
| 369 |
# LLM Configuration
|
| 370 |
OLLAMA_URL=http://localhost:11434
|
| 371 |
-
OLLAMA_MODEL=llama3
|
| 372 |
-
|
| 373 |
-
#
|
| 374 |
|
| 375 |
# Celery Configuration (for async workers)
|
| 376 |
CELERY_BROKER_URL=redis://localhost:6379/0
|
| 377 |
CELERY_RESULT_BACKEND=redis://localhost:6379/0
|
| 378 |
```
|
| 379 |
|
| 380 |
-
4. **Start the
|
|
|
|
|
|
|
| 381 |
```bash
|
| 382 |
cd backend/mcp_servers
|
| 383 |
python main.py
|
|
|
|
| 384 |
```
|
| 385 |
-
The server will automatically initialize the database schema on startup.
|
| 386 |
- Server runs on `http://localhost:8001`
|
| 387 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
|
| 389 |
5. **Start Celery workers** (for async document ingestion and analytics)
|
| 390 |
```bash
|
|
@@ -398,60 +457,101 @@ Before you begin, ensure you have the following installed:
|
|
| 398 |
6. **Run the main API server**
|
| 399 |
```bash
|
| 400 |
cd backend
|
| 401 |
-
uvicorn api.main:app --reload
|
| 402 |
```
|
|
|
|
|
|
|
| 403 |
|
| 404 |
-
### RAG
|
| 405 |
|
| 406 |
-
The RAG
|
| 407 |
|
| 408 |
-
**
|
| 409 |
```bash
|
| 410 |
-
curl -X POST http://localhost:
|
| 411 |
-H "Content-Type: application/json" \
|
|
|
|
| 412 |
-d '{
|
| 413 |
-
"
|
| 414 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
}'
|
| 416 |
```
|
| 417 |
|
| 418 |
-
**
|
| 419 |
```bash
|
| 420 |
-
curl -X POST http://localhost:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
-H "Content-Type: application/json" \
|
|
|
|
| 422 |
-d '{
|
| 423 |
-
"tenant_id": "tenant123",
|
| 424 |
"query": "What are the HR policies?"
|
| 425 |
}'
|
| 426 |
```
|
| 427 |
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
|
|
|
|
|
|
| 431 |
|
| 432 |
-
**
|
| 433 |
```bash
|
| 434 |
curl -X POST http://localhost:8000/rag/ingest \
|
| 435 |
-H "Content-Type: application/json" \
|
| 436 |
-H "x-tenant-id: tenant123" \
|
| 437 |
-d '{
|
| 438 |
-
"content": "Your document text here..."
|
| 439 |
-
"doc_id": "doc_001"
|
| 440 |
}'
|
| 441 |
```
|
| 442 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
**Supported formats:**
|
| 444 |
-
-
|
| 445 |
-
-
|
| 446 |
-
-
|
| 447 |
-
-
|
| 448 |
-
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
-
|
| 454 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
|
| 456 |
### Frontend Setup
|
| 457 |
|
|
@@ -478,9 +578,39 @@ The ingestion worker automatically:
|
|
| 478 |
```
|
| 479 |
|
| 480 |
The app will be available at `http://localhost:3000` with:
|
| 481 |
-
- **Main landing page** with
|
| 482 |
-
|
| 483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
|
| 485 |
### Quick Start with Docker
|
| 486 |
|
|
@@ -501,7 +631,9 @@ docker-compose up -d
|
|
| 501 |
| π **English Web Search** | Forces English language results for better accuracy |
|
| 502 |
| π’ **Production-Grade** | Multi-tenant design with strict Supabase RLS |
|
| 503 |
| π **Full Observability** | Logs, analytics, tool events, violations |
|
| 504 |
-
| π **Knowledge Base UI** | Complete document management
|
|
|
|
|
|
|
| 505 |
| β‘ **Async Processing** | Celery workers for scalable document ingestion and analytics |
|
| 506 |
| π― **Demo-Ready** | Perfect for enterprise presentations |
|
| 507 |
|
|
|
|
| 77 |
- **Strict multi-tenant isolation** with tenant_id filtering
|
| 78 |
- **Intelligent text chunking** (~300 words per chunk)
|
| 79 |
- **Vector similarity search** using cosine distance
|
| 80 |
+
- **Multi-format document ingestion**:
|
| 81 |
+
- **PDF files** - Server-side parsing with PyPDF2
|
| 82 |
+
- **DOCX files** - Server-side parsing with python-docx
|
| 83 |
+
- **TXT/Markdown files** - Direct text ingestion
|
| 84 |
+
- **URLs** - Automatic content fetching and extraction
|
| 85 |
+
- **Raw text** - Direct paste and ingest
|
| 86 |
+
- **File upload endpoint** (`/rag/ingest-file`) for binary file processing
|
| 87 |
+
- **Enhanced ingestion API** (`/rag/ingest-document`) with metadata support
|
| 88 |
+
- **Document listing** (`/rag/list`) with pagination and filtering
|
| 89 |
+
- **Knowledge base management UI**:
|
| 90 |
+
- Search interface with semantic search
|
| 91 |
+
- File upload with drag-and-drop support
|
| 92 |
+
- Source type selection (PDF, DOCX, TXT, URL, raw text)
|
| 93 |
+
- Document library page showing all ingested content
|
| 94 |
+
- Filter by document type (PDF, FAQ, Link, Text)
|
| 95 |
+
- **Async document ingestion** via Celery workers (optional)
|
| 96 |
|
| 97 |
### 3. π Live Web Search Tool
|
| 98 |
|
|
|
|
| 140 |
- **Real-time analytics panel** in the frontend UI
|
| 141 |
- **Async analytics processing** via Celery workers
|
| 142 |
|
| 143 |
+
### 7. π Document Ingestion System
|
| 144 |
+
|
| 145 |
+
Complete document management workflow:
|
| 146 |
+
|
| 147 |
+
- **Multiple ingestion methods**:
|
| 148 |
+
- File upload (PDF, DOCX, TXT, MD)
|
| 149 |
+
- URL fetching with HTML extraction
|
| 150 |
+
- Raw text pasting
|
| 151 |
+
- Programmatic API ingestion
|
| 152 |
+
- **Automatic type detection** from filename or content
|
| 153 |
+
- **Metadata support** (filename, URL, doc_id, custom fields)
|
| 154 |
+
- **Server-side parsing** for binary files (PDF/DOCX)
|
| 155 |
+
- **Text normalization** and sanitization
|
| 156 |
+
- **Knowledge base library** page with:
|
| 157 |
+
- Document grid view
|
| 158 |
+
- Type-based filtering (PDF, FAQ, Link, Text)
|
| 159 |
+
- Search functionality
|
| 160 |
+
- Document metadata display
|
| 161 |
+
- Creation date tracking
|
| 162 |
+
|
| 163 |
+
### 8. π’ Multi-Tenant Isolation
|
| 164 |
|
| 165 |
Each tenant gets:
|
| 166 |
|
|
|
|
| 189 |
| **Slack / Email** | Alerting system |
|
| 190 |
| **Celery** | Async task queue for document ingestion and analytics |
|
| 191 |
| **Redis / RabbitMQ** | Message broker for Celery workers |
|
| 192 |
+
| **PyPDF2** | PDF text extraction |
|
| 193 |
+
| **python-docx** | DOCX text extraction |
|
| 194 |
+
| **python-multipart** | File upload handling |
|
| 195 |
|
| 196 |
### Frontend
|
| 197 |
|
|
|
|
| 265 |
β β β βββ intent_classifier.py
|
| 266 |
β β β βββ redflag_detector.py
|
| 267 |
β β β βββ tool_selector.py
|
| 268 |
+
β β β βββ tool_scoring.py
|
| 269 |
+
β β β βββ semantic_encoder.py
|
| 270 |
β β β βββ prompt_builder.py
|
| 271 |
+
β β β βββ llm_client.py
|
| 272 |
+
β β β βββ document_ingestion.py
|
| 273 |
β β βββ mcp_clients/
|
| 274 |
β β β βββ rag_client.py
|
| 275 |
β β β βββ web_client.py
|
| 276 |
β β β βββ admin_client.py
|
| 277 |
β β βββ models/
|
| 278 |
+
β β β βββ agent.py
|
| 279 |
+
β β β βββ redflag.py
|
|
|
|
|
|
|
| 280 |
β β βββ utils/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
β β β βββ text_extractor.py
|
| 282 |
β β βββ config.py
|
| 283 |
β β
|
| 284 |
β βββ mcp_servers/
|
| 285 |
β β βββ main.py # RAG MCP Server (FastAPI)
|
| 286 |
+
β β βββ rag_server.py # Alternative RAG server implementation
|
| 287 |
+
β β βββ web_server.py # Web search MCP server
|
| 288 |
+
β β βββ admin_server.py # Admin governance MCP server
|
| 289 |
+
β β βββ database.py # Supabase/PostgreSQL connection + pgvector
|
| 290 |
+
β β βββ embeddings.py # Sentence transformers embeddings
|
| 291 |
+
β β βββ models/
|
| 292 |
+
β β βββ rag.py
|
| 293 |
+
β β βββ web.py
|
| 294 |
+
β β βββ admin.py
|
| 295 |
β β
|
| 296 |
β βββ workers/
|
| 297 |
β β βββ ingestion_worker.py # Celery tasks for document ingestion
|
|
|
|
| 299 |
β β βββ scheduler.py # Scheduled task definitions
|
| 300 |
β β βββ celeryconfig.py # Celery app configuration
|
| 301 |
β β
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
β βββ tests/
|
| 303 |
β β βββ test_agent.py
|
| 304 |
β β βββ test_rag.py
|
|
|
|
| 314 |
β β βββ layout.tsx # Root layout
|
| 315 |
β β βββ globals.css # Global styles
|
| 316 |
β β βββ knowledge-base/
|
| 317 |
+
β β βββ page.tsx # Knowledge base library page
|
| 318 |
β βββ components/
|
| 319 |
β β βββ chat-panel.tsx # Chat interface component
|
| 320 |
β β βββ analytics-panel.tsx # Analytics dashboard component
|
| 321 |
β β βββ knowledge-base-panel.tsx # Knowledge base search/ingest UI
|
|
|
|
| 322 |
β β βββ hero.tsx # Hero section
|
| 323 |
β β βββ feature-grid.tsx # Feature showcase grid
|
| 324 |
β β βββ footer.tsx # Footer component
|
|
|
|
| 369 |
Before you begin, ensure you have the following installed:
|
| 370 |
|
| 371 |
- β
**Python 3.10+**
|
| 372 |
+
- β
**Node.js 20+ (64-bit)** (for frontend - required for Next.js)
|
| 373 |
- β
**Supabase project** (with pgvector extension enabled)
|
| 374 |
- β
**PostgreSQL connection string** (from Supabase)
|
| 375 |
+
- β
**Ollama** (for local LLM) - [Installation Guide](#llm-setup)
|
| 376 |
+
- β
**DuckDuckGo Search** (built-in, no key required)
|
| 377 |
- β
**Slack/Email webhook** for alerts (optional)
|
| 378 |
+
- β
**Redis/RabbitMQ** (for Celery workers, optional)
|
| 379 |
|
| 380 |
### Backend Setup
|
| 381 |
|
|
|
|
| 405 |
|
| 406 |
# LLM Configuration
|
| 407 |
OLLAMA_URL=http://localhost:11434
|
| 408 |
+
OLLAMA_MODEL=llama3.1:latest
|
| 409 |
+
LLM_BACKEND=ollama
|
| 410 |
+
# Note: Install Ollama from https://ollama.ai and run: ollama pull llama3.1:latest
|
| 411 |
|
| 412 |
# Celery Configuration (for async workers)
|
| 413 |
CELERY_BROKER_URL=redis://localhost:6379/0
|
| 414 |
CELERY_RESULT_BACKEND=redis://localhost:6379/0
|
| 415 |
```
|
| 416 |
|
| 417 |
+
4. **Start the MCP Servers** (in separate terminals or use start.bat)
|
| 418 |
+
|
| 419 |
+
**RAG MCP Server:**
|
| 420 |
```bash
|
| 421 |
cd backend/mcp_servers
|
| 422 |
python main.py
|
| 423 |
+
# Or: uvicorn main:app --reload --port 8001
|
| 424 |
```
|
|
|
|
| 425 |
- Server runs on `http://localhost:8001`
|
| 426 |
+
- Automatically initializes database schema on startup
|
| 427 |
+
- API docs: `http://localhost:8001/docs`
|
| 428 |
+
|
| 429 |
+
**Web MCP Server:**
|
| 430 |
+
```bash
|
| 431 |
+
cd backend/mcp_servers
|
| 432 |
+
uvicorn web_server:web_app --reload --port 8002
|
| 433 |
+
```
|
| 434 |
+
|
| 435 |
+
**Admin MCP Server:**
|
| 436 |
+
```bash
|
| 437 |
+
cd backend/mcp_servers
|
| 438 |
+
uvicorn admin_server:admin_app --reload --port 8003
|
| 439 |
+
```
|
| 440 |
+
|
| 441 |
+
**Or use the start script:**
|
| 442 |
+
```bash
|
| 443 |
+
./start.bat # Windows
|
| 444 |
+
# or
|
| 445 |
+
./start.sh # Linux/Mac
|
| 446 |
+
```
|
| 447 |
|
| 448 |
5. **Start Celery workers** (for async document ingestion and analytics)
|
| 449 |
```bash
|
|
|
|
| 457 |
6. **Run the main API server**
|
| 458 |
```bash
|
| 459 |
cd backend
|
| 460 |
+
uvicorn backend.api.main:app --reload --port 8000
|
| 461 |
```
|
| 462 |
+
- Server runs on `http://localhost:8000`
|
| 463 |
+
- API docs: `http://localhost:8000/docs`
|
| 464 |
|
| 465 |
+
### RAG API Endpoints
|
| 466 |
|
| 467 |
+
The RAG system provides multiple endpoints:
|
| 468 |
|
| 469 |
+
**1. Enhanced Document Ingestion (with metadata):**
|
| 470 |
```bash
|
| 471 |
+
curl -X POST http://localhost:8000/rag/ingest-document \
|
| 472 |
-H "Content-Type: application/json" \
|
| 473 |
+
-H "x-tenant-id: tenant123" \
|
| 474 |
-d '{
|
| 475 |
+
"action": "ingest_document",
|
| 476 |
+
"source_type": "raw_text",
|
| 477 |
+
"content": "Your document text here...",
|
| 478 |
+
"metadata": {
|
| 479 |
+
"filename": "policy.txt",
|
| 480 |
+
"doc_id": "policy-001"
|
| 481 |
+
}
|
| 482 |
}'
|
| 483 |
```
|
| 484 |
|
| 485 |
+
**2. File Upload (PDF, DOCX, TXT, MD):**
|
| 486 |
```bash
|
| 487 |
+
curl -X POST http://localhost:8000/rag/ingest-file \
|
| 488 |
+
-H "x-tenant-id: tenant123" \
|
| 489 |
+
-F "file=@document.pdf"
|
| 490 |
+
```
|
| 491 |
+
|
| 492 |
+
**3. Semantic Search:**
|
| 493 |
+
```bash
|
| 494 |
+
curl -X POST http://localhost:8000/rag/search \
|
| 495 |
-H "Content-Type: application/json" \
|
| 496 |
+
-H "x-tenant-id: tenant123" \
|
| 497 |
-d '{
|
|
|
|
| 498 |
"query": "What are the HR policies?"
|
| 499 |
}'
|
| 500 |
```
|
| 501 |
|
| 502 |
+
**4. List All Documents:**
|
| 503 |
+
```bash
|
| 504 |
+
curl -X GET "http://localhost:8000/rag/list?limit=100&offset=0" \
|
| 505 |
+
-H "x-tenant-id: tenant123"
|
| 506 |
+
```
|
| 507 |
|
| 508 |
+
**5. Legacy Simple Ingestion:**
|
| 509 |
```bash
|
| 510 |
curl -X POST http://localhost:8000/rag/ingest \
|
| 511 |
-H "Content-Type: application/json" \
|
| 512 |
-H "x-tenant-id: tenant123" \
|
| 513 |
-d '{
|
| 514 |
+
"content": "Your document text here..."
|
|
|
|
| 515 |
}'
|
| 516 |
```
|
| 517 |
|
| 518 |
+
### Document Ingestion System
|
| 519 |
+
|
| 520 |
+
Documents can be ingested through multiple methods:
|
| 521 |
+
|
| 522 |
**Supported formats:**
|
| 523 |
+
- **PDF files** - Server-side parsing with PyPDF2
|
| 524 |
+
- **DOCX files** - Server-side parsing with python-docx
|
| 525 |
+
- **TXT/Markdown files** - Direct text ingestion
|
| 526 |
+
- **URLs** - Automatic content fetching and HTML extraction
|
| 527 |
+
- **Raw text** - Direct paste and ingest
|
| 528 |
+
|
| 529 |
+
**Ingestion methods:**
|
| 530 |
+
|
| 531 |
+
1. **File Upload** (recommended for PDF/DOCX):
|
| 532 |
+
- Use the frontend UI or `/rag/ingest-file` endpoint
|
| 533 |
+
- Files are parsed server-side automatically
|
| 534 |
+
|
| 535 |
+
2. **Enhanced API** (with metadata):
|
| 536 |
+
- Use `/rag/ingest-document` for structured ingestion
|
| 537 |
+
- Supports filename, URL, doc_id, and custom metadata
|
| 538 |
+
|
| 539 |
+
3. **Simple API** (legacy):
|
| 540 |
+
- Use `/rag/ingest` for quick text ingestion
|
| 541 |
+
|
| 542 |
+
**The ingestion process automatically:**
|
| 543 |
+
- Detects document type from filename or content
|
| 544 |
+
- Extracts text (PDF/DOCX parsed server-side)
|
| 545 |
+
- Normalizes and sanitizes text
|
| 546 |
+
- Chunks text with configurable overlap (~300 words)
|
| 547 |
+
- Generates embeddings using Sentence-Transformers (MiniLM)
|
| 548 |
+
- Stores chunks and embeddings in pgvector
|
| 549 |
+
- Preserves metadata (filename, URL, doc_id)
|
| 550 |
+
|
| 551 |
+
**Optional: Async Processing via Celery**
|
| 552 |
+
- For large-scale ingestion, use Celery workers
|
| 553 |
+
- Configure `CELERY_BROKER_URL` in `.env`
|
| 554 |
+
- Workers process ingestion tasks asynchronously
|
| 555 |
|
| 556 |
### Frontend Setup
|
| 557 |
|
|
|
|
| 578 |
```
|
| 579 |
|
| 580 |
The app will be available at `http://localhost:3000` with:
|
| 581 |
+
- **Main landing page** (`/`) with:
|
| 582 |
+
- Hero section and feature overview
|
| 583 |
+
- **Knowledge Base Panel** - Search and ingest documents
|
| 584 |
+
- **Chat Panel** - Interact with the AI agent
|
| 585 |
+
- **Analytics Panel** - View metrics and tool usage
|
| 586 |
+
- **Knowledge Base Library** (`/knowledge-base`) - Browse all ingested documents with filtering
|
| 587 |
+
|
| 588 |
+
### LLM Setup
|
| 589 |
+
|
| 590 |
+
**Ollama (Recommended for Local Development):**
|
| 591 |
+
|
| 592 |
+
1. **Install Ollama:**
|
| 593 |
+
- Download from https://ollama.ai
|
| 594 |
+
- Install and start the service
|
| 595 |
+
|
| 596 |
+
2. **Pull a model:**
|
| 597 |
+
```bash
|
| 598 |
+
ollama pull llama3.1:latest
|
| 599 |
+
```
|
| 600 |
+
|
| 601 |
+
3. **Verify it's running:**
|
| 602 |
+
```bash
|
| 603 |
+
curl http://localhost:11434/api/tags
|
| 604 |
+
```
|
| 605 |
+
|
| 606 |
+
4. **Configure in `.env`:**
|
| 607 |
+
```env
|
| 608 |
+
OLLAMA_URL=http://localhost:11434
|
| 609 |
+
OLLAMA_MODEL=llama3.1:latest
|
| 610 |
+
LLM_BACKEND=ollama
|
| 611 |
+
```
|
| 612 |
+
|
| 613 |
+
**Note:** If Ollama is not running, the system will show helpful error messages with setup instructions.
|
| 614 |
|
| 615 |
### Quick Start with Docker
|
| 616 |
|
|
|
|
| 631 |
| π **English Web Search** | Forces English language results for better accuracy |
|
| 632 |
| π’ **Production-Grade** | Multi-tenant design with strict Supabase RLS |
|
| 633 |
| π **Full Observability** | Logs, analytics, tool events, violations |
|
| 634 |
+
| π **Knowledge Base UI** | Complete document management with search, ingestion, and library view |
|
| 635 |
+
| π **Multi-Format Ingestion** | PDF, DOCX, TXT, URL, and raw text support with server-side parsing |
|
| 636 |
+
| π **Document Library** | Browse, filter, and search all ingested documents |
|
| 637 |
| β‘ **Async Processing** | Celery workers for scalable document ingestion and analytics |
|
| 638 |
| π― **Demo-Ready** | Perfect for enterprise presentations |
|
| 639 |
|