Retrieval inspector
ProThe passages behind an answer, in the order the retriever ranked them. Each says whether the answer actually cites it — retrieved-but-unused is shown, not hidden — with its score (or that it wasn't scored), its source and how fresh it is. Expand a passage for the excerpt and why it ranked there.
Preview
Install
With the Candor CLI
First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/retrieval-inspector
Brings in: collapsible, freshness-stamp, know, knowledge-sources, locale, utils · npm: lucide-react@^1.67.0
Usage
"use client"
import type { KnowSource, RetrievedPassage } from "@/lib/know"
import { RetrievalInspector } from "@/components/retrieval-inspector"
const ago = (h: number) => new Date(Date.now() - h * 3_600_000).toISOString()
const sources: KnowSource[] = [
{ id: "k1", door: "config", label: "Staging: code and schema", readAt: ago(5), everyHours: 24, status: "succeeded" },
{ id: "k2", door: "data", label: "customers, sampled", readAt: ago(5), everyHours: 168, status: "succeeded" },
{ id: "k3", door: "file", label: "Data model notes v3.pdf", addedBy: "Priya", readAt: ago(24 * 12), status: "succeeded" },
{ id: "k4", door: "answer", label: "Answer from Priya", addedBy: "Priya", readAt: ago(24 * 9), status: "succeeded" },
]
const passages: RetrievedPassage[] = [
{ id: "p1", sourceId: "k3", title: "§3.2 Data regions", excerpt: "Customers are routed to a data region by region (us, eu, apac). Partner tier is no longer used for routing.", score: 0.91, cited: true, why: "Matches “data region” and “partner tier”", readAt: ago(24 * 12) },
{ id: "p2", sourceId: "k1", title: "Job: assign_region", excerpt: "assign_region reads customers.region; the partner-tier fallback sits behind a flag that is off.", score: 0.84, cited: true, why: "The job named in the answer", readAt: ago(5) },
{ id: "p3", sourceId: "k4", title: "Answer from Priya", excerpt: "Partner tier is being replaced by region. Keep it on the two partner dashboards until Q1.", score: null, cited: true, why: "Pinned: a person's answer to this exact question", readAt: ago(24 * 9) },
{ id: "p4", sourceId: "k2", title: "Fill rates on customers", excerpt: "region is filled on almost every sampled row; partner_tier_old has no recent writes.", score: 0.71, cited: false, why: "Relevant, but the answer didn't need it", readAt: ago(5) },
]
export default function Example() {
return <RetrievalInspector className="max-w-2xl" passages={passages} sources={sources} />
}<RetrievalInspector>
| Prop | Type | Default | Description |
|---|---|---|---|
| passagesrequired | RetrievedPassage[] | — | The retrieved passages, in rank order, each marked cited or not. |
| sourcesrequired | KnowSource[] | — | The sources the passages come from, looked up by id for name and freshness. |
| verb | string | undefined | — | The word before each passage's date, for what `readAt` records: "Reviewed", "Published", "Synced". Defaults to FreshnessStamp's "Read". |
| className | string | undefined | — | Extra classes for the outer element. |
Strings
The fixed words, in English by default. Change any of them under retrievalInspector in <LocaleProvider strings={{ … }}>; the table is exported as retrievalInspectorStrings.
| Key | English |
|---|---|
| label | Retrieved passages |
| heading | What was retrieved |
| passages | { one: "{count} passage", other: "{count} passages" } |
| cited | {count} cited |
| citedOnly | Cited only |
| citedBadge | Cited |
| notUsed | Not used |
| notScored | Not scored |
| why | Why here: {why} |