04GraphRAG Assistant with Azure PostgreSQL & Agents
Role: Solution Engineer / AI Architect
Executive summary
Delivered a secure GraphRAG assistant over contracts and knowledge bases using Postgres/pgvector retrieval, GPT-4, Fabric Data Agent and Foundry—answering complex questions with clause-level citations in under five seconds.
- Azure Database for PostgreSQL
- pgvector
- Azure OpenAI (GPT-4)
- LangChain
- Fabric Data Agent
- Microsoft Foundry
- Azure Monitor
- Databricks
An insurance enterprise wanted an AI assistant that answers complex questions by combining structured data with unstructured contract documents. The design was a Graph RAG approach using Azure PostgreSQL with pgvector as the vector store, integrated with Microsoft Fabric Data Agent and Microsoft Foundry, with strong monitoring and enterprise security.
- Stand up Azure Database for PostgreSQL with pgvector to store embeddings of contract text and knowledge-graph entities.
- Build a pipeline to index contracts (PDF/DOCX) by chunking text and computing embeddings via Azure OpenAI.
- Design a GraphRAG agent pipeline: retrieve relevant sections, then have GPT-4 compose grounded answers.
- Integrate Fabric Data Agent for secure live-data queries and Foundry for secure deployment.
- Implement monitoring on Foundry and Azure Monitor and ensure compliance (no sensitive data leakage).
I configured Postgres with pgvector and an ETL (Databricks notebooks triggered by Fabric pipelines) to load and update contract vectors. The agent (Azure OpenAI orchestrated by LangChain) first runs vector similarity search to fetch top passages and graph relationships (parties, dates), then prompts GPT-4 with that context. Fabric Data Agent enabled real-time queries when needed, and we deployed on Foundry for secure authentication. Foundry logging and Azure Monitor tracked Postgres and OpenAI usage.
The assistant transformed how analysts retrieve contract knowledge—answering questions like “which contracts allow early termination and under what conditions?” with quoted clauses and section references. Vector search delivered accurate retrieval across tens of thousands of pages, and monitoring kept average response under five seconds while verifying no unauthorized data left the system. It became a blueprint for secure enterprise QA over private data.
Combining structured and unstructured data in GraphRAG demands careful schema design; representing domain relationships alongside embeddings boosted relevance. Monitoring and guardrails are essential for enterprise-wide assistants. Vector search plus agent orchestration is a powerful pattern for knowledge management.