AI SystemsStatus: Working SystemTimeline: 2024

Enterprise Document RAG Knowledge Assistant

Semantic search and grounded question-answering system over private technical documentation

Source Code Repository✓ Reliable citation extraction with verified source references for all synthesized answers.
TECHNOLOGY STACK
PythonFastAPIPostgreSQL (pgvector)LangChainOpenAI EmbeddingsDocker
SYSTEM DESIGN & RUNTIME SIMULATION

Interactive Architecture & Pipeline Inspector

INTERACTIVE SYSTEM ARCHITECTURE STUDIO

Hybrid RAG Architecture & Vector Retrieval

Enterprise documentation search uniting PostgreSQL pgvector HNSW indexing and grounded citations

PATTERN: Hybrid Reciprocal Rank Fusion (BM25 + Dense Vectors)
Sub-350ms semantic search over 2,000+ technical docs with verified source citation
SYSTEM EXECUTION PIPELINE (TAP ANY NODE TO INSPECT)
STEP 0135ms

Document Ingestion & Chunking

Recursive Syntax Parser
Python / Markdown AST
STEP 02120ms

Vector Embedding Core

Dense Representation
OpenAI Embeddings API
STEP 0314ms

pgvector HNSW Index

Approximate Nearest Neighbor
PostgreSQL 16 / pgvector
STEP 048ms

Reciprocal Rank Reranker

Hybrid Scoring Engine
In-Memory Fusion Algorithm
STEP 05310ms

Grounded Synthesis LLM

Cited Answer Generation
Server-Sent Events (SSE)
STEP 01 OF 05Python / Markdown AST

Document Ingestion & Chunking

Role: Recursive Syntax Parser
ARCHITECTURAL ROLE & BEHAVIOR

Splits engineering documentation into 512-token chunks with 10% overlap preserving code blocks and header hierarchy.

ESTIMATED LATENCY: 35msTRANSPORT: Python / Markdown AST
THE CORE PROBLEM

Engineers and support teams struggle to locate precise answers within hundreds of pages of API specifications, architecture decision records, and operational runbooks.

WHAT I BUILT & DELIVERED

Built a retrieval-augmented generation (RAG) assistant that indexes internal Markdown and PDF documentation into pgvector, applies hybrid keyword-vector retrieval, and provides cited, verifiable answers.

MY SPECIFIC ROLE & CONTRIBUTION

Implemented document chunking strategies with contextual metadata, built the hybrid retrieval pipeline in pgvector, and engineered prompt templates that mandate document citations.

Architectural Breakdown

  • 1Document ingestion pipeline with semantic chunking and sliding window token overlaps
  • 2Vector database utilizing PostgreSQL with pgvector extension for unified relational & vector queries
  • 3Hybrid search combining BM25 keyword matching with cosine similarity embeddings
  • 4Context-grounded prompt engineering with explicit citation requirements and confidence scoring

Key Engineering Decisions & Rationale

pgvector over standalone vector DBs

Keeping relational data (user permissions, document versions) and embeddings in the same PostgreSQL database reduced infrastructure complexity and backup overhead.

Semantic chunking over fixed token cuts

Chunking along Markdown headers and paragraphs preserved context boundaries, cutting query hallucination rates dramatically.

Challenges & Trade-offs

  • •Higher ingestion time during semantic chunking in exchange for substantially more accurate retrieval precision during user queries.

What I Learned

  • ✓Chunk size and overlap tuning has a far greater impact on response accuracy than switching LLM model versions.
  • ✓Always include an 'I do not have enough context to answer' prompt instruction to stop speculative completions.

Interested in similar architecture for your team?

Let's evaluate your current requirements and engineering constraints.

Discuss This System on WhatsApp