Legal Contract Analyzer
Automation, analysis, and summary of complex legal documents, acting as an AI assistant for lawyers, managers, and anyone who needs to quickly understand the key points of a contract.
graph TD
%%{init: {'theme': 'mc','layout': 'elk'}}%%
GDriveFilesComponent-om3qs[<div><img src="/_astro/google_drive.wKmDsV2c.svg" style="height: 20px !important;width: 20px !important"/></div>Google Drive]
style GDriveFilesComponent-om3qs stroke:#a170ff
ParseData-bpxzj[<div><img src="/_astro/braces.Djq0PW4_.svg" style="height: 20px !important;width: 20px !important"/></div>Parse Data]
style ParseData-bpxzj stroke:#a170ff
LanggraphReactAgent-r7y0s[Asistente Legal]
style LanggraphReactAgent-r7y0s stroke:#a170ff
ChatOutput-fu8q8[<div><img src="/_astro/messages-square.BaSDmT6g.svg" style="height: 20px !important;width: 20px !important"/></div>Chat Output]
style ChatOutput-fu8q8 stroke:#a170ff
OpenAIModel-mog55[<div><img src="/_astro/openAI.BhmuxEs3.svg" style="height: 20px !important;width: 20px !important"/></div>OpenAI]
style OpenAIModel-mog55 stroke:#a170ff
GDriveFilesComponent-om3qs -.- ParseData-bpxzj
linkStyle 0 stroke:#a170ff
ParseData-bpxzj -.- LanggraphReactAgent-r7y0s
linkStyle 1 stroke:#a170ff
OpenAIModel-mog55 -.- LanggraphReactAgent-r7y0s
linkStyle 2 stroke:#a170ff
LanggraphReactAgent-r7y0s -.- ChatOutput-fu8q8
linkStyle 3 stroke:#a170ff
Legal Contract Analyzer
The Legal Contract Analyzer automates the extraction, interpretation, and summarisation of legal documents. By integrating Google Drive for file ingestion, a text‑parsing routine, an advanced Langgraph agent powered by an OpenAI model, and a chat‑style output component, the workflow delivers concise, bullet‑point summaries that highlight key contractual elements. This streamlines legal review, enabling lawyers and managers to grasp essential points quickly and accurately.
⚙️ Main Features
- Automated File Retrieval – Pulls legal documents directly from Google Drive, supporting a variety of file types.
- Text Normalisation – Converts binary or structured document data into clean, plain‑text format ready for analysis.
- AI‑Driven Summarisation – Uses a Langgraph React Agent with an OpenAI model to read contracts and generate simple, bullet‑point summaries.
- Chat‑Friendly Presentation – Displays the AI‑generated summary in a conversational format, suitable for review or further discussion.
- Extensible Tooling – The agent can be extended with additional tools or memory management features for more complex workflows.
🔄 Workflow Steps
| Component Name | Role in the Workflow | Key Inputs | Key Outputs |
|---|---|---|---|
| Google Drive | Retrieves the selected legal document from a Google Drive folder or file ID. | File ID or Folder selection (via UI). | Raw file data (binary or structured). |
| Parse Data | Transforms raw file data into plain‑text suitable for natural‑language processing. | Raw file data from Google Drive. | Extracted text (Message). |
| OpenAI Model | Provides the language‑model backend that the agent uses to generate a summary. | Model name (gpt-4o-mini), API key, configuration settings (temperature, max tokens). |
Language‑model instance usable by the agent. |
| Legal Assistant (Langgraph React Agent) | Orchestrates the summarisation task: receives the document text, invokes the OpenAI model, and produces a concise summary. | Document text from Parse Data, Language‑model instance from OpenAI Model. | Summary message (Message). |
| Chat Output | Presents the summary to the user in a chat‑style interface. | Summary message from the Legal Assistant. | Displayed chat message in the playground. |
🧠 Notes
- The workflow assumes the presence of valid Google Drive API credentials and OpenAI API keys; missing credentials will halt execution.
- File size limits imposed by Google Drive and the OpenAI model (e.g., token limits) may constrain the length of contracts that can be processed in a single run.
- The OpenAI model is invoked in JSON mode by default; any required output format must be specified in the system prompt.
- The agent’s memory and summarisation features can be toggled via configuration flags, allowing for either stateless or stateful summarisation across multiple documents.
- The chat output component is purely visual; it does not alter the underlying data or trigger additional actions.
- If the input file contains complex formatting (e.g., tables, legal clauses with nested bullet points), the parsing step may need to be customised to preserve meaningful structure.