Architecture Overview
High-level flow
Client
-> rag-server (Gin HTTP API)
-> Postgres (pgvector + full-text)
-> Embedding Provider (OpenAI-compatible)
-> Chat Completion Provider (OpenAI-compatible)
-> Git repos (via go-git, optional)
Data flow (RAG query)
- Client POSTs a question to
/api/rag/query.
- Server embeds the question using the configured embedder.
- Server queries Postgres for vector + full-text candidates.
- Scores are blended and optionally reranked.
- Top documents are returned as
chunks.
Data flow (Ingestion)
rag-cli (or /api/rag/upsert) embeds content.
- The server ensures the schema exists.
- Chunks are upserted into Postgres.