Spaces:
Sleeping
Sleeping
| title: LexGuard Backend | |
| emoji: ⚖️ | |
| colorFrom: indigo | |
| colorTo: purple | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| license: mit | |
| short_description: Multi-agent contract intelligence API — 5-agent pipeline | |
| # LexGuard Backend | |
| FastAPI service powering the LexGuard 5-agent contract analysis pipeline. | |
| ## Endpoints | |
| | Method | Path | Purpose | | |
| |---|---|---| | |
| | GET | `/api/health` | Liveness probe | | |
| | POST | `/api/analyze` | Upload PDF/DOCX/TXT → `{job_id}` | | |
| | GET | `/api/stream/{job_id}` | SSE stream of agent events + `report_complete` | | |
| | POST | `/api/negotiate/{clause_id}?job_id=...` | On-demand Negotiator agent | | |
| | POST | `/api/compare` | Compare clause against benchmark store | | |
| ## Environment (set as HF Space secrets) | |
| | Variable | Required | Description | | |
| |---|---|---| | |
| | `GROQ_API_KEY` | Yes | Groq API key (free tier works) | | |
| | `CORS_ORIGINS` | Yes | Your Vercel frontend URL, e.g. `https://lexguard.vercel.app` | | |
| | `GCP_PROJECT` | No | If set, switches to Vertex AI Gemini instead of Groq | | |
| | `GROQ_MODEL` | No | Default: `llama-3.3-70b-versatile` | | |
| ## Local Development | |
| ```bash | |
| cp .env.example .env # fill in GROQ_API_KEY | |
| pip install -e ".[dev]" | |
| uvicorn app.main:app --reload --port 8000 | |
| ``` | |