AI Medical Assistant (demo) established the regulated-demo template: disclaimer UI, allowlist, educational RAG, refuse canaries, no real sensitive data. AI Legal Assistant (demo) applies the same engineering pattern to law. Domain theory is Vol. 21 Legal AI; citation lock and invented-case failures are Vol. 19 hallucination tests; privilege/PII, copyright, and transparency are Vol. 20 privacy, copyright, transparency. Backend is Vol. 18 FastAPI.
This lecture is an engineering product pattern and a classroom demo. It is not legal advice, not the practice of law, not an ethics opinion, and not for real clients or real matters. After this, the module returns to unregulated-but-still-HITL product builds: customer support.
Learning Objectives
By the end of this lesson, students should be able to:
- State that this capstone is not legal advice and does not authorize practicing law or serving real clients.
- Split MVP vs stretch: educational research Q&A with disclaimer vs attorney-HITL draft queue (still not a lawyer-in-a-box).
- Require jurisdiction pin, citation lock, and RAG over published educational/legal-public sources only—no real client files.
- Sketch FastAPI refuse + dangling-cite gates and a persistent disclaimer UI.
- Write acceptance criteria and eval (attribution, refuse canaries, no-PII)—without fake win-rate benchmarks.
- Know that production would require lawyer-in-the-loop, matter ACLs, and counsel on UPL/ethics; this demo does not complete that pathway.
An AI Legal Assistant (demo) is a classroom product that retrieves from a small corpus of published educational legal materials (open statutes/opinions you are allowed to use, textbook excerpts, public explainer pages—not client files, privileged mail, or classmate disputes) and drafts a cited educational answer behind a persistent disclaimer. The model does not give legal advice, file anything, or conclude what a user should do in a real matter. Success is: pin jurisdiction when relevant, cite retrieved ids only, refuse advice-oracle asks, and keep attorney-review state if the demo is stretched toward production shape (Vol. 21 Legal AI).
Nothing here or in the student demo is legal advice, an ethics ruling, or authorization to practice law. Do not use it with real clients, real disputes, or real matter documents. Do not ingest PII or privileged files. Court-citation tokens in sketches are synthetic. Unauthorized-practice, privilege, and advertising rules vary by jurisdiction—involve licensed counsel. A footer does not make “AI lawyer” an in-scope claim. If this pattern ever left class, a licensed lawyer must review before any client-facing use.
MVP vs Stretch
| Slice | MVP (classroom demo) | Stretch (still not the practice of law) |
|---|---|---|
| Claim | “Educational research over a public/educational corpus. Not legal advice.” | Same claim; attorney-review queue for synthetic memo drafts |
| UI | Banner + per-reply disclaimer; jurisdiction field | Matter_id (synthetic), reviewer inbox, audit viewer |
| Data | 8–20 published educational/legal-public chunks; synthetic queries | Larger licensed educational corpus; still zero real client PII |
| RAG | Cite chunk ids; fail dangling reporters; refuse if no retrieval | Matter-scoped shards (canary test); hybrid search (Vol. 14) |
| HITL | User sees draft/not-advice; no “send to court/client” button | Lawyer role must edit+sign before any release flag |
| Out of scope | “Should I sue?”, “file this,” fake case law, win predictions | Same refusals—stretch does not unlock advice |
Architecture (Demo Product Pattern)
Ack + jurisdiction pin before research.
Educational research / define / compare KB text.
Only retrieved ids; fail dangling cites.
Pending attorney review on stretch.
Citation lock (Vol. 19)
- Only cite retrieved, allowed sources
- Fail dangling reporter / cite tokens
- Quote spans must match chunk text
- Pin jurisdiction + “as of” corpus date
Privilege / PII (demo)
- No real client files, ever
- Stretch: synthetic matter_id shards
- Canary chunk from Matter A \(\neq\) Matter B
- Vendor no-train; minimize logs
Attorney HITL
- MVP: no client-send side effect
- Stretch: edit + sign before release
- Disclose AI use (Vol. 20 transparency)
- Escalate UPL/ethics questions to counsel
Counsel-assist demo buys
- Teachable citation + jurisdiction gates
- Honest portfolio: tool pattern, not a lawyer
- Eval on attribution, not “win rate”
Advice-oracle costs
- Invented cases (famous real-world failures)
- Cross-matter / PII leaks
- UPL exposure if marketed as a lawyer
In-Scope vs Out-of-Scope (Demo)
| Usually in-scope (educational demo) | Always out-of-scope as the product claim |
|---|---|
| Summarize a retrieved public statute/opinion excerpt with cites | Public chatbot answering “what should I file?” as advice |
| Define a term from the educational KB | “You will win” / “sue them tomorrow” |
| Compare two KB clauses the user already loaded (synthetic) | Binding negotiation or unsupervised filing |
| Plain-language rewrite of retrieved, cited text | Invented case law or fake quotations |
| Refuse + “consult licensed counsel” | Silent model-to-client advice without disclosure |
Unauthorized practice of law is a product and go-to-market issue, not a prompt suffix (Vol. 21 Legal AI). If the user is not in a classroom demo context, the safer default remains refuse or redirect.
FastAPI Sketch (Educational Demo Only)
Illustrative engineering hooks. Not an ethics opinion. Not legal advice. Synthetic citation tokens only. No real client data.
Acceptance Criteria
| ID | Must pass for MVP demo |
|---|---|
| AC-1 | Disclaimer banner + API reject unless ack_disclaimer is true. |
| AC-2 | Missing jurisdiction blocks research (no invented circuit). |
| AC-3 | Advice-oracle prompts (“should I sue?”) return refuse. |
| AC-4 | Dangling cite: ids fail the gate; empty retrieval refuses. |
| AC-5 | Every success payload repeats the not-legal-advice disclaimer. |
| AC-6 | No real client PII/privileged files in corpus, prompts, or logs. |
| AC-7 | README: not for real clients; lawyer HITL required if ever production. |
Eval + HITL / Safety
| Gate | What you measure | Hook |
|---|---|---|
| Attribution | Every cite exists in retrieval; quote spans match | Hallucination tests |
| Refuse canaries | UPL-style advice asks all refuse | Product + Vol. 20 AI safety |
| Jurisdiction | Missing pin = block; wrong-corpus answers fail | Vol. 21 Legal AI |
| No-PII / privilege | No real client files; stretch canary across synthetic matters | Privacy |
| Copyright | Corpus license recorded; no unlicensed dump | Copyright |
| HITL (stretch / production shape) | Attorney edit+sign before release; disclose AI use | Vol. 15 HITL; transparency |
Do not invent win-rate or “beats associates” benchmarks. Fake citations are release blockers, not retry-the-prompt nits.
Related Lectures
| Lecture | Role |
|---|---|
| Legal AI | Regulated pattern this demo implements |
| AI Medical Assistant (demo) | Sibling disclaimer + allowlist template |
| Research assistants / RAG | Citation + retrieval core |
| FastAPI | Demo API |
| Hallucination tests | Fake cases fail the build |
| Copyright / Privacy / Compliance | Corpus, PII, residual risk |
| AI Customer Support Bot | Next: tickets + tools + escalation |
“If the model cites a case name, it exists.” Attribution tests exist because models invent reporters. Second: a consumer “AI lawyer” is just marketing around this stack. Third: classmate contract PDFs are fine “practice PII.” Fourth: copyright is automatic if the PDF was on the web. Fifth: this lecture is legal advice or an ethics ruling. Sixth: a disclaimer footer makes unsupervised client send acceptable.
Knowledge Check
- Short Answer: Is this capstone legal advice or for real clients? Answer: No—educational engineering demo only; not the practice of law.
- True/False: Invented case citations should fail the product gate. Answer: True.
- Multiple Choice: Missing jurisdiction on a research query should: (a) block or require pin, (b) invent a circuit, (c) raise BLEU. Answer: (a).
- Short Answer: Which Vol. 21 lecture is the domain pattern for this build? Answer: Legal AI.
- True/False: Real client matter files belong in the classroom index. Answer: False—published educational sources only; no real PII.
- Multiple Choice: RAG for this demo should use: (a) published educational/legal-public sources, (b) privileged firm email, (c) scraped opposing-counsel drives. Answer: (a).
- Short Answer: If this pattern ever went to production, who must stay in the loop before client send? Answer: A licensed lawyer (attorney HITL).
- True/False: A public chatbot claiming to be your lawyer is an in-scope MVP claim here. Answer: False.
- Multiple Choice: Cross-matter canary leakage (stretch) is primarily a: (a) privacy/privilege eval failure, (b) Cosine bug only, (c) BLEU feature. Answer: (a).
- Short Answer: Name one Vol. 19 lecture used as a citation/faithfulness gate. Answer: Hallucination tests.
Key Takeaways
- This capstone is a demo—not legal advice, not a lawyer-in-a-box, not for real clients.
- MVP = disclaimer UI + jurisdiction pin + citation lock + refuse canaries; stretch adds attorney HITL/matter ACLs.
- No real PII/privilege; published educational sources only; fake citations fail the build.
- Production would require lawyer-in-the-loop + Vol. 20/21 review—this lecture does not authorize that launch.
- Next: AI Customer Support Bot — tickets, mock tools, escalation.
Lab: Toy corpus of 8–12 synthetic or openly licensed educational “opinions/statute excerpts” across two fake jurisdictions. Students implement disclaimer ack, jurisdiction pin, dangling-cite failure, and advice-oracle refuse. No real client files. No advice to classmates about real legal problems.
Whiteboard: Medical demo \(\to\) legal demo: clinician HITL becomes lawyer HITL; diagnosis markers become UPL markers. Then leave regulated verticals for support tickets.
Recap: The legal assistant capstone is educational RAG with citation lock and disclaimer UI—it does not practice law. Continue to AI Customer Support Bot.