How Sourced answers a question

A question goes through four steps on the server: hybrid search, reranking, generation with citations, and citation checking. The documents were prepared once, offline.

  1. Question
  2. Embed
  3. Vector search (top 40)Keyword search (top 40)
  4. Reciprocal Rank Fusion (top 20)
  5. Rerank (top 6)
  6. Generate with [P#] citations
  7. Verify quotes
  8. Answer
  1. 35 doc pages
  2. Parse
  3. Chunk (500–800 tokens)
  4. Embed
  5. Postgres + pgvector
Request path above, offline ingestion below.

1. Preparing the documents

The 35 PostgreSQL 17 documentation pages are parsed offline into sections, then split into chunks of 500–800 tokens with 80 tokens of overlap when a section needs splitting. Short sections can form smaller chunks. Each chunk keeps its heading and source URL. Its text and embedding are stored in Postgres with pgvector.

2. Hybrid search

The server embeds your question. Vector search finds the top 40 passages by similarity, while keyword search finds the top 40 text matches. Reciprocal Rank Fusion combines their ranks with k = 60 and keeps the top 20 candidates.

3. Reranking

The chat model orders those 20 candidates by relevance to the question. The top 6 passages go to the answer model. If reranking fails or times out, the server uses the fusion order.

4. Writing the answer

The model is instructed to answer only from the supplied passages, in no more than 250 words, with [P#] citations and supporting quotes. The answer streams as it is written; citations remain provisional until checking finishes.

5. Checking every citation

The server checks that each cited passage exists and that its supporting quote appears in the passage after normalization. Invalid citations are removed. If none remain, the answer is replaced with “I couldn't find this in the PostgreSQL docs.”

6. Measuring quality

An evaluation set checks retrieval and answer quality, including questions the documents cannot answer and prompt injection attempts. A faithfulness judge measures whether the passages support the answer. CI checks quality floors and regressions; the Evaluation page shows the recorded results.

7. Limits

  • Prompt-only defences against injection are not complete.
  • A quote match proves the words exist in the passage, not that the passage fully supports the sentence. That is what the faithfulness judge measures.
  • The corpus is 35 pages, not the full PostgreSQL documentation.
  • The first request after a quiet period can be slow because the database scales to zero.

8. Cost controls

Daily quotas limit live questions per visitor and across all visitors, resetting at midnight UTC. Suggested answers are prepared in advance and served without model calls or quota use. Read-only mode allows only these cached answers; off mode disables asking. Token counts and configured prices give an estimated cost for each request. If the provider fails before the first token is streamed, the request’s quota increments are refunded.

Privacy

Sourced does not store your questions. For each request it keeps a salted hash of the question, its length, timings, token counts, an estimated cost and how many citations passed or failed. Your IP address is turned into a salted hash that changes every day and is used only to count your daily questions; the IP itself is never stored or logged. There are no cookies, no analytics and no third-party scripts. The question is sent to OpenAI to produce the answer; see OpenAI’s API data usage policy.