Back to architecture
live

Bring Your Own Database

Route answers to a customer's own database, safely isolated.

When a tenant connects their own database, a routing switch decides where each query is answered: read-only from the customer's isolated database, or from the default vector knowledge base. Either way, the retrieved context grounds the model's answer.

Data flow

How the pieces connect and where data moves.

Components: Visitor (asks a question), Chat API (FastAPI), Query router (routing switch), Customer database (isolated, read-only), Default knowledge (pgvector), Gemini (grounded answer). Connections: Visitor to Chat API; Chat API to Query router; Query router to Customer database for routing on; Query router to Default knowledge for routing off; Customer database to Gemini for rows as context; Default knowledge to Gemini for chunks as context; Gemini to Chat API for answer; Chat API to Visitor for reply.

Loading data-flow map

Behavior

How it behaves step by step over time.

Loading behavior diagram
A visitor's question reaches the query router. When routing is enabled it reads scoped rows from the customer's own isolated database; otherwise it retrieves ranked chunks from the default pgvector store. The chosen context is sent to Gemini, which returns a grounded answer.