Contract Information Extractor

Uploads employment contracts, splits multi-document files and returns eight clause categories as structured JSON.

LLM / RAG2025All work

Fig. 01Contract extractor: PDF or Word upload, results as JSON.
Contract extractor: PDF or Word upload, results as JSON.

What it is

What it does

A focused extractor: give it a PDF or Word contract and it returns termination terms, obligations, deadlines, payment structures, parties, contract type, jurisdiction and confidentiality clauses as clean JSON, downloadable in one click. Files containing several agreements are split automatically and processed independently.

Why it exists

I spent an afternoon hunting for termination dates in a 20-page employment agreement. It's always the same eight fields. I automated exactly that, and made the prompt refuse to invent dates that aren't written.

8
Clause types
N
Contracts per file
JSON
Export

Repo Amit-kr26/Contract-Information-ExtractorDemo contract-information-extractor.vercel.app/Stack FastAPI · Azure OpenAI GPT-4o · PyMuPDF · Tailwind CSS

Build6decisions

How it is built

In-memory parsing

PDFs open with fitz.open("pdf", content) directly from uploaded bytes (no temp files); DOCX flows through python-docx paragraph joins.

Multi-contract splitting

A multiline regex on the EMPLOYMENT AGREEMENT heading segments compound uploads into Contract 1..N, each analysed separately.

Eight-clause Pydantic schema

ExtractedData declares Optional[str] fields for termination_and_amendment_terms, obligations_and_deliverables, key_dates_and_deadlines, payment_and_fee_structures, party_information, type_of_contract, jurisdiction_and_governing_laws, confidentiality_and_non_disclosure.

Conservative prompting

The prompt instructs GPT-4o to extract only explicitly stated information and mark everything else as not specified, in full sentences, no bold-heading fragments.

Downloadable results

POST /extract returns results plus a download_url; GET /download serves static/output.json as an attachment.

Vercel-native deploy

vercel.json routes @vercel/python at app.py with static assets served alongside, so the demo runs serverless.

How the pieces connect

Parse Extract and deliver Upload form PDF or Word FastAPI /extract bytes in memory PyMuPDF + python-docx no temp files Split on heading Contract 1..N Azure GPT-4o one call per contract Conservative prompt not specified if absent Heading → next line 8 clauses output.json 8 fields per contract Contract N cards one per contract Download JSON attachment the prompt asks for eight named clauses one line after each heading