🔍 Automated document compliance validation with AI and vector database

⚡ 704 views · 🔍 AI RAG & Knowledge Retrieval

Description

Description

This workflow automates compliance validation between a policy/procedure and a corresponding uploaded document. It leverages an AI agent to determine whether the content of the document aligns with the expectations outlined in the provided procedure or policy.

How It Works

  1. Document Upload
  1. Procedure Submission
  1. AI-Based Validation

The AI agent receives:

It returns a structured compliance analysis including:

Setup Instructions

Pre-Conditions / Requirements

Workflow Setup

  1. HTTP Request Node 1: Document Upload

Accepts binary document files (PDF, DOCX, etc.).

Extracts text, generates embeddings, and stores them in Qdrant.

Returns a spDocumentId for reference.

  1. HTTP Request Node 2: Procedure Submission

Accepts a JSON payload with:

{ “procedure”: “Policy or procedure text”, “description”: “Brief context or objective”, “spDocumentId”: “ID of the uploaded document” }

Links the procedure to the previously uploaded document.

  1. Order of Operations

Step 1: Upload the document.

Step 2: Submit the procedure referencing the same spDocumentId.

Step 3: AI agent evaluates compliance and returns results.

Example Input & Output

Example Input: Document Upload (Webhook 1)

{ “spDocumentId”: “12345” }

Example Input: Procedure Submission (Webhook 2)

{ “procedure”: “All financial records must be retained for 7 years.”, “description”: “Retention policy compliance validation”, “spDocumentId”: “12345” }

Example Output: AI Compliance Validation

{ “compliance_summary”: “The document includes a 7-year retention requirement for invoices and payroll records.”, “non_compliance_summary”: “No reference to retention of vendor contracts.”, “citations”: [ { “text”: “Invoices will be stored for 7 years.”, “page”: 4 } ], “confidence”: 87 }

đź”— Nodes Used

HTTP Request, Webhook, AI Agent, LangChain Code, Ollama Chat Model, Structured Output Parser

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup