pagepiper/app/services
pyr0ball 3765fbc0f9 fix: quote-first prompt structure + escape phrase post-processing to kill hallucinations
three-layer approach to stop 7B model from supplementing retrieved context
with training-data knowledge:

1. system prompt redesigned: 'no memory of books/stories/authors' eliminates
   the model's self-permission to draw on parametric knowledge

2. quote-first prompt structure: model must commit to a specific quoted passage
   before generating an answer — explicit NOT FOUND required when excerpts lack
   the answer, preventing the 'excerpt doesn't say X... however in the series...'
   escape pattern

3. _strip_escape() post-processor: catches any residual leakage by scanning for
   known escape phrases ('in the series', 'by terry goodkind', 'it can be assumed',
   etc.) and replacing the response with the canned no-answer message
2026-05-06 10:30:11 -07:00
..
__init__.py feat: add database schema and migration runner 2026-05-04 17:10:38 -07:00
bm25_index.py fix(services): add SQLite error handling and strengthen top_k test 2026-05-04 17:20:26 -07:00
retriever.py fix: reinforce no-hallucination constraint in user-turn prompt; cap per-doc retrieval 2026-05-06 10:26:51 -07:00
synthesizer.py fix: quote-first prompt structure + escape phrase post-processing to kill hallucinations 2026-05-06 10:30:11 -07:00