πŸ”¬ Analyze legal contract risk with Google Gemini hybrid RAG and Supabase

⚑ 210 views Β· πŸ”¬ Document Extraction & Analysis

Description

πŸš€ What This Workflow Does

This workflow transforms any PDF legal contract into a detailed AI-powered risk report β€” in under 5 minutes. Upload a contract, and the system automatically splits it into clauses, analyses each one using Hybrid RAG (semantic + keyword search), scores risk as HIGH / MEDIUM / LOW, and delivers plain-English explanations with safer alternative wording.


πŸ”₯ Why Hybrid RAG?

Most dangerous clauses don’t use obvious legal keywords. β€œThe Client accepts full responsibility for all third-party claims” is an indemnification clause β€” but keyword search misses it. Hybrid RAG combines:


πŸ” What It Does


βš™οΈ Architecture (Two Pipelines)

Pipeline 1 β€” Ingestion: Builds the knowledge base of risky clause patterns in Supabase Pipeline 2 β€” Query: Analyses new contracts against the knowledge base

Both pipelines run in the same workflow β€” the branch splits at Extract Embedding.


🧠 Key Technical Decisions


πŸ“¦ Requirements


πŸ’‘ Example Use Cases


🎯 Output

πŸ”— Nodes Used

HTTP Request, Webhook, Supabase, AI Agent, Extract from File, Google Gemini Chat Model

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup