rag_saas / README.md
GodRad's picture
Upload 32 files
a3dd602 verified
|
Raw History Blame Contribute Delete
1.98 kB
---
title: RAG SaaS Platform
emoji: 🧠
colorFrom: blue
colorTo: indigo
sdk: docker
python_version: "3.11"
pinned: false
---
# RAG Systems as a Service (SAAS)
Enterprise-grade, multi-tenant RAG platform designed for Hugging Face Spaces. This project consists of two main components:
1. **`rag_saas` Backend**: A FastAPI-based REST API for managing multi-tenant retrieval and generation.
2. **`webapp` Playground**: A Streamlit interface for interactive testing, document ingestion, and "How it works" diagrams.
## Quick Start on HF Spaces
Since this is a decoupled system, we recommend deploying as two separate Spaces for optimal performance.
### 1. Backend (API)
- **Space Type**: Docker Space.
- **Root Files**: Use the root `Dockerfile` and `app/` folder.
- **Secrets**: Add `OPENAI_API_KEY` or `HUGGINGFACE_API_TOKEN`.
### 2. Frontend (Playground)
- **Space Type**: Docker Space (using `webapp/Dockerfile`).
- **Files**: Only upload the contents of the `webapp/` folder.
- **Link**: Paste your Backend Space URL into the "API Connection" section of the playground sidebar.
## Key Features
- **Multi-Tenant Isolation**: Secure data segregation using `X-Tenant-ID` headers.
- **Playground UI**: Modern chat interface, ingestion dashboard, and educational onboarding.
- **Enterprise-ready**: DB-backed tenant management and storage (SQLite/Postgres).
- **HF Optimized**: Docker images configured with user `1000` and port `7860`.
## API Documentation
Once the backend is deployed, visit `/docs` for the OpenAPI Swagger UI.
### Core Architecture
```mermaid
graph LR
User --> Streamlit[Web App Playground]
Streamlit --> API[FastAPI Backend]
API --> DB[(SQLite/Postgres)]
API --> VectorDB[(Vector Store)]
API --> LLM[OpenAI/HuggingFace]
```
## Local Development
```bash
# 1. Start Backend
uvicorn app.main:app --reload --port 7860
# 2. Start Web App
cd webapp
streamlit run app.py
```