hadi-bakhshi-portfolio-icon
Back to work

system.case

RAG FAQ System

A production retrieval system that answers routine call-center questions and routes unknowns to the right department.

~600 daily operators · ~1 day/week saved per person

n8npgvectorPostgreSQLOpenAI

My role: Designed and built end-to-end

Operator~600 dailyn8nOrchestratorEmbedOpenAISearchpgvectorLLMGrounded answerRouteDept fallbackDeptHR · Fin · QA

Problem

Call center operators handling thousands of daily interactions constantly interrupted HR, finance, and QA staff for routine policy questions. Answers lived in scattered documents with no single searchable source of truth, and wait times for simple questions added up across ~600 operators.

Constraints

Architecture

n8n orchestrates the workflow: operator query → embedding → pgvector similarity search over a curated document index → OpenAI generation grounded in retrieved chunks. When confidence is low or no match exists, the system categorizes the question and routes it to the relevant department for human follow-up. PostgreSQL with pgvector keeps vectors co-located with operational metadata.

Key decisions

pgvector over a dedicated vector DB

pgvector on existing PostgreSQL infrastructure avoided a new operational dependency. For document-scale retrieval serving ~600 daily users, co-located vectors simplified backups, monitoring, and deployment.

n8n for orchestration

Workflow changes (new departments, routing rules, prompt tweaks) can be adjusted by the team without redeploying application code — important for a system that evolves with policy updates.

Automatic fallback routing

Rather than hallucinating on unknown questions, unmatched queries are categorized and forwarded to HR, finance, or QA. This preserves trust with operators who rely on the system during live calls.

Grounded generation only

OpenAI responses are constrained to retrieved context chunks. Operators see answers tied to source documents, reducing fabricated policy guidance.

Trade-offs

Workflow tool vs custom service

n8n trades some type-safety and testability for faster iteration on routing logic. Acceptable because the core retrieval contract is stable and changes are mostly orchestration-level.

Embedding refresh cadence

Documents are re-indexed on a schedule rather than real-time. Simpler operations; policy updates may lag by hours — mitigated with a manual re-index trigger for urgent changes.

Impact