| --- |
| title: legal-eye Hebrew Legal RAG |
| emoji: ⚖️ |
| colorFrom: indigo |
| colorTo: blue |
| sdk: docker |
| app_port: 8000 |
| pinned: false |
| --- |
| |
| # legal-eye — Hebrew Legal RAG |
|
|
| Verbatim-from-precedent retrieval over Israeli case law and statutes. |
|
|
| **No external LLM** — answers are exact quotations from the corpus, anchored to a |
| doctrine cluster (the leading case + its applications + its origins). The |
| service refuses to run if `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` are set in |
| the environment together with `TAU_RAG_AUTH_REQUIRED=true`. |
|
|
| ## API surface (key endpoints) |
|
|
| - `POST /v1/lawyer/ask` — primary user endpoint. Accepts `{question}`, returns |
| a structured response with `confidence`, `arguments[]`, `bundle`, and |
| `disclaimer_he`. |
| - `POST /v1/hgraph/argument` — bundle-only path. Faster and cheaper when the |
| caller doesn't need the legacy synthesizer output. |
| - `GET /v1/clusters?limit=N` — list doctrine clusters. |
| - `GET /v1/clusters/{cluster_id}` — full cluster detail with members. |
| - `GET /v1/system/dashboard` — live corpus + retriever metrics. |
|
|
| All `/v1/*` endpoints require `X-API-Key` (set via the `TAU_RAG_SEED_ADMIN_KEY` |
| Space secret). |
|
|
| ## Configuration |
|
|
| This Space loads the combined caselaw + kolzchut + statutes corpus |
| (`tau_rag/runtime/uploads/legal_eye_combined.jsonl`) on first boot. Auto-loading |
| parquet is intentionally **disabled** (`TAU_RAG_AUTOLOAD_PARQUET=0`) — the |
| 2.6 GB raw judgments file does not fit comfortably on the free CPU tier. |
|
|
| Performance characteristics on free CPU (16 GB): |
|
|
| | Phase | Time | |
| |---|---| |
| | First boot, retriever build (cold) | ~2 min | |
| | First `/v1/lawyer/ask` (cluster build, lazy) | ~30 s | |
| | Subsequent queries | 2-5 s | |
|
|
| The first query is slow because the doctrine cluster cache is built lazily. |
| Once the index is persisted (after first boot), reboots reuse it. |
|
|
| ## Required Space secrets |
|
|
| Set these in **Settings → Repository secrets** before the Space first boots: |
|
|
| | Name | How to generate | Purpose | |
| |---|---|---| |
| | `TAU_RAG_SEED_ADMIN_KEY` | `openssl rand -hex 32` | API key for `/v1/*` auth | |
| | `TAU_RAG_HMAC_SECRET` | `openssl rand -hex 32` | HMAC secret for signed URLs | |
| | `TAU_RAG_CORS_ORIGINS` | e.g. `https://legal-eye.vercel.app` | Frontend origin (CORS) | |
|
|
| ## Disclaimer |
|
|
| ⚠ This service is **not legal advice**. Output is a verbatim quotation from a |
| court ruling or statute, surfaced via doctrine matching. Any legal decision |
| must be reviewed by a licensed attorney. |
|
|