feat(rag): lite-model document summaries — non-markdown docs summarized at import, summary chunk retrieves and resolves to the full source doc
This commit is contained in:
@@ -11,6 +11,10 @@ Implements just enough of the aipi surface:
|
||||
off markers in the system prompt:
|
||||
- user message containing ``write a long answer`` -> a ~900-word
|
||||
deterministic numbered answer (long-answers story, phase 11)
|
||||
- ``SUMMARY_MODE`` -> the deterministic summary digest: the first 24
|
||||
tokens of the user message (the summarizer puts the capped document
|
||||
content there) — byte-stable for a given fixture (document summaries,
|
||||
phase 30)
|
||||
- ``DEFLECT_MODE`` -> honest "I haven't done anything like that" answer
|
||||
- otherwise -> upbeat answer quoting the provided document context
|
||||
- user message containing ``pretend to think slowly`` -> 3s warm-up delay
|
||||
@@ -156,6 +160,18 @@ def compose_answer(body: dict[str, Any]) -> str:
|
||||
user = _user(body)
|
||||
if LONG_ANSWER_TRIGGER in user.lower():
|
||||
answer = long_answer()
|
||||
elif "SUMMARY_MODE" in system:
|
||||
# Document summaries (phase 30): the ``lite`` stand-in returns a
|
||||
# deterministic digest — the first 24 tokens of the user message
|
||||
# (the summarizer puts the capped document content there). Byte-
|
||||
# stable for a given fixture, so the summary chunk's retrieval
|
||||
# rank is a pure function of the fixture text. Checked BEFORE the
|
||||
# DEFLECT_MODE branch (task 06) so a deflection prompt that ever
|
||||
# carries the marker cannot shadow the summary call.
|
||||
answer = (
|
||||
f"This document covers "
|
||||
f"{' '.join(TOKEN_RE.findall(user.lower())[:24])}."
|
||||
)
|
||||
elif "DEFLECT_MODE" in system:
|
||||
answer = (
|
||||
"Ah — I haven't done anything like that, so I don't want to make stuff up! "
|
||||
|
||||
Reference in New Issue
Block a user