Citing the Source Line
citing the source line
Part of: FAQ Support Bot
An answer without a citation asks the user to trust you. An answer with a citation lets them check you. This lesson adds the last core piece: every non-refused answer names the exact FAQ line it came from, and you verify that line number is real before showing it to anyone. What we're adding You'll change the prompt to require a citation in a fixed, parseable format, then write a Python check that confirms the cited line exists and is one of the lines the model was shown. A citation the model invents, a line number that doesn't exist, is as dangerous as an invented fact, so it gets the same treatment: verify, don't trust. Prompting for a structured citation Asking for a fixed literal format, "Source: line N", is what makes this checkable. Ask "cite your source" with no format and you get free-text citations in a dozen phrasings that you can't parse reliably. Parsing and verifying the citation verify citation returns a pass/fail plus either the verified line number or the reason it failed. Two failure modes matter here. The model ignores the format and gives no citation at all , or it cites a line that doesn't exist and hallucinates a number. Both are bugs worth catching before the
Challenge: Verify the Receipt