Back to architecture
live

AI Chatbot + RAG

pgvector retrieval grounds every answer in your knowledge.

Every question is embedded and matched against the tenant knowledge base in pgvector. The top-ranked chunks are handed to Gemini as context, so answers stay grounded in the customer’s own content rather than invented by the model.

Data flow

How the pieces connect and where data moves.

Components: Visitor (asks a question), Chat widget (embedded on site), Chat API (FastAPI), RAG retrieval (embed + rank), Knowledge store (pgvector), Gemini (grounded answer). Connections: Visitor to Chat widget; Chat widget to Chat API for question; Chat API to RAG retrieval; RAG retrieval to Knowledge store for similarity search; Knowledge store to RAG retrieval for top chunks; RAG retrieval to Gemini for context + question; Gemini to Chat API for answer; Chat API to Chat widget for streamed reply.

Loading data-flow map

Behavior

How it behaves step by step over time.

Loading behavior diagram
A visitor asks a question in the widget. The chat API embeds the query, runs a similarity search over the pgvector knowledge store, and sends the top-ranked chunks plus the question to Gemini. Gemini returns a grounded answer that is streamed back to the visitor.