Cite the exact PDF page, with the passage highlighted
A footnote that says which document was consulted is not a citation. A citation is a claim, a page and a highlighted sentence that a reader can check in two seconds.
Last updated · SDK v1.1.0 · changelog
Short answer: use @uthereal-sdk/cortex. Each answer returns claims mapped to references, each reference carries the document, page and span, and PdfEvidence from @uthereal-sdk/cortex/react opens that page with the passage highlighted through a short-lived token.
01
The citation model
- Claim - one verifiable statement inside the answer
- Reference - the passage that supports it, with document, page and span
- Token - a short-lived credential that resolves the reference to a page render
- Refusal - no supporting passage means no claim, rather than a confident guess
Because the mapping is per claim, a single answer can cite five pages across three documents and a reader can check any one of them independently.
02
The endpoints behind it
POST /external/v1/assistants/{assistant}/sessions/{session}/ask
-> NDJSON: answer snapshots, claims, references
GET /chat/reference/pdf/{token}?page={page}
-> the cited page
POST /chat/reference/pdf/refresh
-> a fresh token when the previous one expires03
Rendering it in React
import { CitedAnswer, PdfEvidence } from "@uthereal-sdk/cortex/react";
<CitedAnswer
answer={saved.answer}
messageId={saved.id}
authScope={`${backendId}:${tenantId}:${accountId}`}
loadPdf={cortex.pdf}
/>;Use a backend, tenant and account specific authScope and the same value as the component key, so cached evidence can never leak across accounts.
04
Why this decides adoption
In publishing, medicine, law, finance and government, an answer nobody can check is a liability. Page-level evidence turns the assistant from a demo into something an editor, an auditor or a regulator will sign off on, and it makes errors fixable at the source instead of in prompt patches.
Frequently asked questions
- How do I show PDF page numbers in AI chatbot answers?
- The retrieval layer has to keep page coordinates with every passage, and the answer has to map each claim to the passage that supports it. Cortex returns both: each reference carries the document, the page and the span, so the UI can open page 42 and highlight the sentence.
- Why do most RAG chatbots only list documents?
- Because they cite the retrieved chunk set, not the claims. Without claim-to-source mapping and page coordinates, the best a UI can do is show the documents it looked at, which is not verifiable.
- How is the cited PDF served securely?
- Citations resolve through a short-lived token. GET /chat/reference/pdf/{token}?page={page} returns the page, and POST /chat/reference/pdf/refresh re-issues the token, so source files are never exposed by permanent public URLs.
- Which React component renders the evidence?
- PdfEvidence from @uthereal-sdk/cortex/react renders the cited page with the passage highlighted, and CitedAnswer renders the answer with claim-level citation markers that open it.
- Does this work for tables, footnotes and scanned documents?
- Layout-aware parsing keeps headings, tables and footnotes intact so citations land on the right region. Scanned documents need a text layer; without one, no retrieval system can cite a page accurately.
Related
Ship a knowledge agent your users can trust
Create an agent, point the SDK at it, and let your AI coding tool do the wiring.
Questions? sdk@uthereal.ai