Inspiration

Small nonprofits, gig workers, and student groups often lack affordable legal support. They either use generic templates that don’t fit their needs or pay steep fees for basic agreements. We built ContractGen to bridge that gap by giving everyone instant access to tailored, legally-informed contracts.

What we built

  1. Generate – Choose from NDA, service, employment, and rental templates. Input parties, jurisdiction, tone, and custom clauses.
  2. Analyze – Upload any PDF or DOCX contract to get a concise summary, risk assessment, and suggestions for improvement.
  3. Iterate – Chat-style edits (“Add arbitration under Indian law… shorten confidentiality clause”), with optional Google Custom Search API context snippets for extra accuracy.
  4. Export – Clean HTML-to-DOCX conversion for signature-ready documents.

How we built it

  • Backend: Python & Flask
  • GenAI: Google Gemini 2.0 Flash for drafting & analysis
  • Context enrichment: Google Custom Search API injected when deeper jurisdictional info is needed
  • File parsing: PyPDF2, python-docx, html2docx
  • **Frontend: CSS

Challenges faced

  • Accuracy vs. hallucination: Chained prompts + real-world snippets reduced drift
  • Memory constraints: Chunked PDF processing kept footprint under 512 MB
  • Syncing edits: Ensuring chat edits match canvas view and final export

What we learned

  • Precision in prompt engineering is critical for legal language
  • Injecting live search context drastically cuts hallucinations
  • Users value plain-language explanations alongside formal clauses

Next steps

  • Integrate electronic signatures (DocuSign API)
  • Fine-tune a clause-risk classifier on public legal data
  • Add multilingual support (e.g., Hindi, Spanish, French)

Built With

Share this project:

Updates