← All projects

LegalRAG

A team-built retrieval-augmented generation application for asking questions about End User License Agreements, Terms of Service, and privacy policies, using Claude on AWS Bedrock, Sentence Transformers embeddings, and ChromaDB Cloud, behind a FastAPI service.

Stack
  • Python
  • FastAPI
  • AWS Bedrock
  • Claude
  • ChromaDB Cloud
  • Sentence Transformers
  • Amazon S3
Role
Member of a six-person team.
Links
Repository on GitHub

Scope note

This is a technical project on retrieval over legal text. It is not legal advice, and no claim is made here about the accuracy of its answers or its readiness for production use. Neither has been formally evaluated.

Problem

Terms of Service, EULAs, and privacy policies are long and hard to scan. The project lets a user upload such a document and ask questions about it, such as what it says about data retention or arbitration.

Team

A six-person group built the whole application: the ingestion pipeline, the retrieval and generation service, the REST API, and a web interface for uploading documents and asking questions.

Implementation

  • Ingestion. PDFs are uploaded through the UI or API, text is extracted and cleaned, and the document is tagged by type (EULA or Terms of Service).
  • Indexing. Text is split into section-aware chunks with sentence-level overlap, embedded with a Sentence Transformers model, and stored in ChromaDB Cloud. Uploaded files are kept in Amazon S3.
  • Retrieval and generation. A query is embedded, the top matching chunks are retrieved, and Claude (through AWS Bedrock) generates an answer from that context. The design intent is for answers to come only from the retrieved text.
  • Interface. A FastAPI REST API (upload, query, list, inspect, and delete documents, health check) and a web UI built with HTML, CSS, and vanilla JavaScript.

Source: the project README.

Architecture

The code is split into services so contributors could work in parallel: PDF processing, chunking, embeddings, the ChromaDB client, the Bedrock client, S3 storage, and a RAG orchestration layer, with the API and UI on top.

UploadPDF filesPDF processingChunkingEmbeddingsSentence TransformersChromaDB Cloudvector storeRetrievalRAG orchestrationAWS BedrockClaudeAPI + UI
The pipeline as described above, from upload to the API and UI.

Status

No evaluation results are reported for this project.