File size: 2,459 Bytes
65840c8
3be54c6
 
 
 
65840c8
3be54c6
65840c8
 
 
3be54c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
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.