Retrieval Results

The chunks a retrieval step pulled, with relevance. Near-misses are dimmed rather than dropped — when an answer is wrong, "what did it nearly retrieve" is the useful question.

src/components/ui/retrieval-results.tsx

About

From the component's own source, where it was written.

The chunks a retrieval step pulled, with their relevance.

Chunks below threshold are still listed, dimmed, rather than dropped. When an answer is wrong the useful question is usually "what did it nearly retrieve" — a list that silently hides the near-misses cannot answer it.

Scores use ConfidenceMeter's banding rather than a raw number, for the same reason: a cosine similarity of 0.82 is not a calibrated probability and printing two decimals implies a precision it does not have.

Install

npx astralyx-ui add retrieval-results

Usage

import { RetrievalResults } from '@/components/ui/retrieval-results'

<RetrievalResults chunks={chunks} query={question} threshold={0.5} />

Composer

Change the props and the source below follows.

Retrieved context3 of 4 above thresholdfor “how does tailwind v4 handle config”
  • Configuration now lives in CSS. The @theme directive replaces tailwind.config.js for token definitions, and utilities are generated from the tokens you declare.

    section
    Configuration
    updated
    2026-03-14
Props
tsx
<RetrievalResults
  chunks={chunks}
  query={question}
  threshold={0.5}
/>

Examples

Chunks

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

RetrievalResults

Extends Omit<ComponentProps<'div'>, 'children'>.

PropTypeDefaultDescription
titlestring'Retrieved context'—
chunksRetrievedChunk[]required{ id, score, content, source, page?, metadata? } with score 0–1.
queryReactNode——
thresholdnumber0.5Below it a chunk is dimmed, never hidden.
defaultExpandedstring[]——

Types

RetrievedChunk

The chunks a retrieval step pulled, with their relevance.

FieldTypeDescription
idstring—
scorenumber0–1.
contentReactNode—
sourcestring—
page?number—
metadata?Record<string, string>—

Behaviour

TopicDetailDescription
scoresbandedRendered through ConfidenceMeter rather than as a number — a cosine similarity of 0.82 is not a calibrated probability.