Verify exact production traces and record rollout

This commit is contained in:
2026-08-11 11:29:59 +07:00
parent 6b8f7584ed
commit 59e6ad2d0d
46 changed files with 2795 additions and 290 deletions
+18
View File
@@ -99,12 +99,30 @@ class AnswerPlan:
needs_warning: bool = False
# A fixed, non-LLM string. `docs/architecture.md`'s guardrail section
# specifies the disclaimer at several layers, and the web banner
# (`packages/ui/src/DisclaimerBanner.tsx`) was the only one in place: the
# `disclaimer` field declared in `packages/shared-types/src/dto/chat.ts` was
# never populated, so any consumer other than this one web UI received medical
# content with nothing attached. Keeping it out of the prompt is deliberate —
# a disclaimer the model writes is one the model can also reword, shorten or
# omit, and it would then have to be verified like any other generated claim.
DISCLAIMER = (
"Nội dung được trích từ Dược thư Quốc gia Việt Nam 2018, phục vụ tra cứu "
"chuyên môn và không thay thế chỉ định của bác sĩ hoặc dược sĩ lâm sàng."
)
@dataclass(frozen=True)
class GroundedAnswer:
result: RetrievalResult
answer: str | None
citations: tuple[Citation, ...] = ()
generated: bool = False
# Carried on the payload rather than added by the caller, so no response
# path can be built that omits it — including abstains and clarifications,
# which are also medical content in the sense that matters here.
disclaimer: str = DISCLAIMER
# Set when the model decided the turn is under-specified and asked back
# (e.g. a dose question with no age/weight). The answer field carries the
# question; the caller renders it as a clarification, not a final answer.