How deepsheekha/clare-contract-clause-risk-assistant works
Clare is a browser-based contract clause risk assistant. A user uploads a PDF and may add a concern; the backend extracts text, detects clauses, filters candidates, asks an LLM for a customer-focused risk report, and returns it for the browser to render and copy. The graph also shows the documented upload-only and chat endpoints. Experimental services are omitted because the README says they are not wired into the main pipeline; unsampled backend code is represented only where documented.
Main entry points: main.py FastAPI endpoints · App.jsx Clare interface · model.py OpenRouter client · main.jsx React entry
Components 14
Browser experience
- Clare interface
frontend/src/App.jsx - React entry
frontend/src/main.jsx - Report rendering
frontend/src/App.jsx - Copy analysis
frontend/src/App.jsx
Backend API
- FastAPI endpoints
backend/main.py - Risk report
backend/main.py
Contract analysis
- PDF text extraction
backend/main.py - Clause detection
backend/chunking.py - Risk filtering
backend/main.py
LLM analysis
- Prompt preparation
backend/main.py - Review instructions
backend/prompts.py - OpenRouter client
backend/model.py
Other components
- Contract reviewer
- OpenRouter
Connections 15
- Contract reviewer → Clare interface: uploads PDF
README.md - React entry → Clare interface: renders
frontend/src/main.jsx - Clare interface → FastAPI endpoints: submits analysis
frontend/src/App.jsx - FastAPI endpoints → PDF text extraction: extracts text
backend/main.py - FastAPI endpoints → Clause detection: segments clauses
backend/main.py - FastAPI endpoints → Risk filtering: filters candidates
backend/main.py - FastAPI endpoints → Prompt preparation: prepares prompt
backend/main.py - Prompt preparation → Review instructions: formats review
backend/main.py - FastAPI endpoints → OpenRouter client: requests analysis
backend/main.py - OpenRouter client → OpenRouter: sends prompt
backend/model.py - OpenRouter → OpenRouter client: returns completion
backend/model.py - FastAPI endpoints → Risk report: returns report
README.md - Risk report → Clare interface: delivers response
README.md - Clare interface → Report rendering: parses markdown
frontend/src/App.jsx - Report rendering → Copy analysis: copies analysis
frontend/src/App.jsx