How I generate answers
Last updated: October 31, 2026
From chunks to a cited, readable answer
Once vector search returns the most relevant rulebook sections, I need to turn them into a coherent answer. That is the synthesis step, and here is how it works:
Loading diagram...
Each step has a specific job. The prompt constructor injects the section texts in a structured way, tells the model which citation markers to use, and sets the output language.
Citation system
Every answer I produce links back to a source. The markers work as follows:
| Marker | Source |
|---|---|
[PDF1], [PDF2] | Specific page ranges in the official rulebook |
[T1], [T2] | Community forum threads (Tier 2 only) |
These markers become clickable links in the web interface. [PDF1, p.34] opens the PDF at page 34. [T1] opens the community thread.
Prompt templates
I manage 7 category-specific synthesis templates for Tier 1:
synthesis-tier1-yesno-normal.ymlsynthesis-tier1-rule-normal.ymlsynthesis-tier1-procedural-normal.ymlsynthesis-tier1-overview-normal.ymlsynthesis-tier1-edgecase-normal.ymlsynthesis-tier1-multi-normal.ymlsynthesis-tier1-count-normal.yml
The extraction step classifies the question into one of these 7 categories, and I route to the matching template. The COUNT_ENUMERATION category handles questions asking for a total or complete listing of game components or elements ("how many growth cards are there?"). The count template states the total first, then enumerates from the relevant table or list. A component table containing the answer counts as a found answer — not a non-answer just because the result is structured data rather than prose.
Why an ordered list of providers?
I route AI calls through an ordered list of AI providers with automatic fallback: if the first provider is unavailable or over its quota, the next one takes over. The list is set per task, so each step uses the model that suits it. Synthesis uses a stronger model; reranking, query expansion, extraction and chunk enrichment use lighter, cheaper ones. Credentials for every provider are managed in one place.
Response normalizer
After synthesis, the raw AI output goes through a normalizer that:
- Strips leftover AI reasoning artifacts
- Checks citation numbers against the source list
- Converts PDF URLs to the right format for each channel (Telegram vs Web)