For the complete documentation index, see llms.txt. This page is also available as Markdown.

Ground an LLM answer in real citations

Outcome: answers in your product where every claim links to a source the user can open and check.

Approach

Use SciSpace for retrieval and grounding rather than asking a general model to remember the literature. The Citation object is what your UI renders.

Walkthrough

  1. Create a chat scoped to the documents or papers in play

  2. Send the question with stream: true

  3. Render message.delta as it arrives; on citation.added, attach a marker

  4. Link each marker to the source, with the quote in a tooltip

Handling the hard parts

  • Unsourced claims. source.type: "model" means no retrieved evidence. Show it differently, or drop the sentence — do not present it as sourced.

  • Quote fidelity. Render quote verbatim. Never paraphrase inside a quotation mark.

  • Marker mapping. Match [n] in the text to citations[].index. Do not renumber.

  • Dead links. Papers without an accessible PDF have no locations. Fall back to the paper page.

citation · answer · chats · citation-highlights

Last updated