Home> Cases> AI Knowledge Assistant Reference Architecture

AI Knowledge Assistant Reference Architecture

Reference TypeApplication reference
Materials to ReviewGo · Python · PostgreSQL + pgvector · Redis · Claude / OpenAI API
AI Knowledge Assistant Reference Architecture

Application reference. This is an illustrative architecture and scope checklist, not a verified customer project or measured deployment. Technologies, integration scope and delivery items are agreed for the actual brief.

Scenario and Constraints

A business wanting AI answering over its own product documentation, policies or support history. The requirements that actually decide the architecture are: answers must cite their source, the system must say it does not know rather than invent an answer, cost per conversation must be bounded, and quality must be measurable before and after any prompt or model change.

Architecture

Layers and responsibilities

LayerTechnologyWhat it is responsible for
IngestionPython workersDocument parsing, chunking, embedding and metadata extraction. Runs as a pipeline so a re-index is a routine operation, not a rebuild.
Vector storePostgreSQL + pgvectorChunk embeddings alongside relational metadata. One database instead of a separate vector service keeps permissions and backups simple at this scale.
RetrievalGo serviceHybrid search: vector similarity plus keyword matching, then reranking. Keyword recall is what catches exact part numbers and codes that embeddings routinely miss.
AnsweringGo service calling the model APIPrompt assembly with retrieved context, citation enforcement, streaming response, token budget per request.
GuardrailsApplication layerScope check, refusal when retrieval confidence is low, PII filtering, escalation to a human queue.
AdminVue admin panelDocument management, re-index triggers, conversation review, evaluation set and cost dashboard.

Data Model

The tables below carry the rules that everything else depends on. Getting these wrong is what turns a working demo into a system that cannot be extended.

Core entities

EntityKey fields, relations and rules
document / versionSource document with version history and effective dates, so an answer can be traced to the document revision that produced it.
chunkText segment with embedding vector, heading path, token count and a pointer back to its document and position — the position is what makes a citation link to the right place rather than the whole file.
access_scopeWhich roles or tenants may retrieve a chunk. Filtering happens inside the retrieval query, never after generation, otherwise restricted content can leak into an answer before the check runs.
conversation / messageTurn history with retrieved chunk ids, model used, token counts and latency per message, which is what makes cost and quality attributable per conversation.
feedbackThumbs, corrections and escalation flags per answer, feeding the evaluation set instead of disappearing into a log file.
eval_caseQuestion, expected source and acceptance note. Run against every prompt or model change so regressions are caught before release rather than by customers.

Key Interfaces

Endpoints that carry the business rules

EndpointPurpose and concurrency notes
POST /api/v1/ingestQueues a document for parsing, chunking and embedding; idempotent per (document, version) so a re-submission replaces rather than duplicates.
POST /api/v1/chatStreams an answer. Applies the access scope to retrieval, caps context tokens, enforces citations, and returns a refusal when retrieval confidence is below the configured threshold.
POST /api/v1/chat/{id}/escalateHands the conversation with full context to a human queue — the release valve that keeps a bounded system honest instead of forcing it to answer everything.
POST /api/v1/eval/runRuns the evaluation set against the current configuration and reports pass rate and citation accuracy per case.
GET /api/v1/usageToken and cost accounting per tenant and per period, the basis for rate limits and budget alerts.

Technical Decisions

  • Hybrid retrieval, not vector-only. Vector-only retrieval may miss exact identifiers such as part numbers, error codes or article references. Compare retrieval approaches on the actual evaluation questions. Keyword matching covers that gap and reranking merges the two.
  • Citations enforced, not requested. Asking a model politely to cite sources is unreliable. Answers are validated against retrieved chunk ids and rejected when they cite nothing, which is the difference between a system you can trust and a plausible-sounding one.
  • Refusal threshold on retrieval confidence. A confident wrong answer costs more than no answer. Below the threshold the system says it does not know and offers escalation.
  • pgvector rather than a dedicated vector database. At document volumes typical for a single business, one PostgreSQL instance handles both vectors and metadata, keeping operations, permissions and backup to one system. A dedicated store earns its complexity only at much larger scale.
  • Evaluation set from the first week. Without it, every prompt change is a guess and regressions are discovered by users. It is the cheapest quality control in an AI project and the most commonly skipped.
  • Model access behind our backend. API keys never reach the client, and rate limiting, budget caps and model switching stay server-side configuration rather than an app release.

Hypothetical Design Targets

The figures below are hypothetical capacity-planning examples, not measured client results, a validated sizing recommendation or an SLA. Set project-specific acceptance targets after defining the workload, devices, data, hardware and third-party dependencies; verify them through a pilot and load tests before committing to a production target.

Capacity and performance targets

TargetValue and assumption
First token latencyDefine a hypothetical first-token budget, then benchmark it with the chosen provider, retrieval pipeline and evaluation set. Provider latency is outside the application's control; streaming can show progress without promising a response time.
RetrievalUnder 200 ms for hybrid search plus reranking on a corpus in the low hundreds of thousands of chunks, with an appropriate pgvector index.
Cost per conversationBounded by a context token cap and a per-tenant budget with alerting; the actual figure depends on model choice and conversation length and is measured during the pilot.
Answer qualityTracked as pass rate and citation accuracy on the evaluation set. The baseline is established during the pilot rather than promised in advance.

What Delivery Includes

  • Ingestion pipeline, retrieval and answering service source, and admin panel source in your repository
  • Database schema including chunk, scope and evaluation tables, plus index configuration
  • Prompt templates and the evaluation set, both version-controlled with the code
  • Cost and usage dashboard, rate limit and budget alert configuration
  • Deployment notes, key management procedure, and a documented model-switching path

Planning This for Your Business

The modules above are a starting point, not a fixed package. We normally cut the first release to one core workflow plus one admin workflow, then extend once real usage shows where the load and the edge cases actually are. Send a scoped brief and we will map it against this architecture and tell you which parts you do not need yet.

Request a Project Estimate

Tell us about the product goal, current workflow, target platform, constraints and decision timeline. We will review the scope and recommend a practical next step.

Add project requirements (optional — helps us assess scope and cost)
We use these details strictly to review and respond to your project inquiry. Read our privacy notice. Please do not submit passwords or sensitive API keys.

Demo Solutions

AI Knowledge Assistant (RAG) Reference Architecture | Manboo Studio