POST /statutes/search (retrieve), GET /statutes/section/{actId}/body (full text).
Vaquill provides the authoritative text and the source links. The LLM in your
stack does the reasoning. Vaquill does not replace a lawyer or a licensed
research service, and every answer should carry a link back to the official
government text so a reader can verify it.
The pattern in four steps
1
Retrieve candidate sections
Send the user question to
POST /statutes/search. Scope the search with
corpusType and state when you know them (for example USC for federal
statutes, or STATE with state: "ca" for California). Take the top few
results.2
Fetch the full text of each section
Search returns an
excerpt (up to 500 chars). That is enough to rank, not to
ground on. For each result you want to cite, call
GET /statutes/section/{actId}/body to get the complete plain text.3
Build a grounded prompt
Assemble a prompt that contains the retrieved sections, each labeled with its
citation and its official source URL. Instruct the model to answer only from
those sources, to cite each claim, and to say it cannot find the answer if the
sources do not support one.4
Answer with links back to the source
Return the model’s answer plus the list of cited sources, each linking to the
official government text (
htmlUrl, stateHtmlUrl, or govInfoHtmlUrl).Step 1 and 2: retrieve, then fetch full text
actId (used to fetch the
body), the citation, and the source URLs.
Step 3 and 4: build the grounded prompt and answer
The prompt is where grounding happens. Give the model the retrieved text, a stable label per source, and rules it cannot skip: answer only from the sources, cite by citation and link, and refuse when the text does not support an answer.Python
Why this holds up
The model cannot cite what it was not given
The model cannot cite what it was not given
Because the prompt forbids outside knowledge and every source carries a
citation plus a link, the model’s claims are traceable. A reader can click the
official government URL and confirm the text. If retrieval returns nothing
relevant, the model returns the refusal string instead of inventing law.
Scope narrows retrieval, and narrow retrieval grounds better
Scope narrows retrieval, and narrow retrieval grounds better
When you know the question is federal, pass
corpusType: "USC" or "CFR".
When it is about one state, pass corpusType: "STATE" with the two-letter
state code. Tighter scope means the top results are more likely to be the
governing sections, which makes the grounded answer more precise. Omit both to
search the whole corpus.Always link back to the official source
Always link back to the official source
Every result carries source URLs (
htmlUrl, stateHtmlUrl, govInfoHtmlUrl,
pdfUrl, and others; any may be null). Pick the first one present and surface
it in the answer. This is what lets your users verify the law themselves, and
it is what keeps your product honest.Related
Grounding LLMs
The concepts behind grounding and why it prevents hallucinated law.
Statute lookup chatbot
A simpler Q&A loop built on the same retrieve-then-ground pattern.
Resolve a citation
Turn a citation string into authoritative, verified text.
Vaquill MCP server
Give an AI agent these same tools over MCP.

