Projects
May 1, 2024

Contracts - Conversational Assistant for Contract Management

RAG-based conversational assistant that lets a professional sports organization query and analyze player, staff and sponsor contracts in natural language.

RAGLLMsLegal TechContract AnalysisKnowledge ManagementConversational InterfacesNext.jsPayload CMSFastAPIshadcn-uiWorkflow AutomationInternal ToolsCross-Functional Collaboration

As part of the Pro Internacional (prointernacional.com) and Delfos (delfoslabs.com) teams, I contributed to the development of a RAG-based conversational assistant for a major sports organization in Uruguay. The goal was to give the club a way to query and analyze contracts in natural language, reducing ambiguity and preventing future legal and brand-usage issues.

The organization managed a large volume of contracts — for players, staff, sponsors and other stakeholders — and had recently faced problems with sponsor brand usage and uncertainties around squad contract clauses. The underlying issue was not a lack of documents, but a lack of a reliable, easy-to-use way to consult them: clauses were scattered across PDFs and versions, and answers often depended on someone “remembering” or manually re-reading each contract.

We designed and implemented a chat-style interface where authorized users can:

  • Ask natural language questions about contracts (e.g. player clauses, image rights, sponsor branding conditions, termination terms).
  • Receive grounded answers that reference the exact clauses and documents used to generate the response.
  • Use the assistant as a decision-support tool, ensuring that operational and legal decisions are made with up-to-date, contract-backed information.

Technically, the system was built using:

  • Payload CMS as the backbone for storing and managing contract documents and metadata.
  • Next.js for the frontend application, with shadcn/ui components to build a clean, responsive chat experience and admin views.
  • FastAPI as the backend interface to the LLMs (OpenAI) and the retrieval layer.

The architecture follows a Retrieval-Augmented Generation (RAG) pattern:

  • Contracts are ingested into Payload CMS, processed and indexed so they can be retrieved by relevant clauses and sections.
  • When a user asks a question, the backend uses retrieval logic to pull the most relevant contract fragments.
  • OpenAI LLMs generate an answer conditioned on those retrieved pieces, including citations or references back to the original contract text.

My contribution focused on the full-stack implementation of this flow: integrating Payload CMS with the Next.js + shadcn frontend, wiring FastAPI as the bridge to the LLM layer, and shaping the way context is retrieved and passed to the model so answers stay tied to real clauses instead of hallucinations. The result is a contract assistant that gives the organization a single, reliable entry point to its legal documentation, helping them make clearer, safer decisions from that point forward.

Crafted by Juan Felipe Arellano • © 2025