GitHub

Extract

Inspect a single LLM extraction — the model, token usage and duration up top, then the extracted fields with per-field confidence, the raw JSON, and the model's reasoning.

The extract block runs an LLM to pull structured data out of a document. The Extract component renders one result the way you'd review it: the model, token usage and duration along the top, then tabs for the extracted Fields (each with a confidence tablet), the raw JSON, and the model's Reasoning.

retab-large×3consensus4,210prompt388completion4,598tokens3credits
1.84sExtracted

Confidence is colored by level — green at or above 90%, amber at or above 70%, red below — so low-confidence values stand out at a glance. The JSON tab reuses the shared JSON inspector viewer.

Usage

Pass an output object and, optionally, a likelihoods map keyed by dotted path (e.g. vendor.vat_id, line_items[1].amount) to drive the per-field confidence. Everything is presentation only.

import { ExtractInspector } from "@/registry/new-york-v4/blocks/extract-block"
 
export function Example() {
  return (
    <div className="h-[480px] overflow-hidden rounded-xl border">
      <ExtractInspector
        run={{
          model: "retab-large",
          durationMs: 1842,
          usage: { promptTokens: 4210, completionTokens: 388, totalTokens: 4598, credits: 3 },
          output: {
            invoice_number: "INV-8842",
            vendor: { name: "Acme Corp", vat_id: "FR12345678901" },
            total_amount: 12480.5,
          },
          likelihoods: {
            invoice_number: 0.99,
            "vendor.name": 0.97,
            "vendor.vat_id": 0.62,
            total_amount: 0.98,
          },
        }}
      />
    </div>
  )
}

The ExtractBlock export wraps the inspector with a sample extraction so it renders on its own with no props.

API

ExtractRun

FieldTypeDescription
modelstringModel that produced the extraction — shown as a badge.
status"completed" | "running" | "error"Drives the status pill. Defaults to completed.
durationMsnumber | nullWall-clock time, shown next to the clock icon (auto ms/s).
usageTokenUsageToken counts and/or credits, shown as header chips.
nConsensusnumberNumber of consensus votes; shown as ×N when greater than 1.
reasoningstring | nullChain of thought; adds a Reasoning tab when present.
outputRecord<string, unknown>The structured extraction, shown in the Fields and JSON tabs.
likelihoodsRecord<string, number> | nullPer-field confidence in [0,1], keyed by dotted path.
errorstring | nullWhen set, shows an error banner and a red status pill.

TokenUsage

FieldTypeDescription
promptTokensnumber | nullInput tokens.
completionTokensnumber | nullOutput tokens.
totalTokensnumber | nullTotal tokens.
creditsnumber | nullRetab credits consumed.

Components

ExportPropsDescription
ExtractInspector{ run: ExtractRun }The full extraction inspector.
ExtractBlock{ run?: ExtractRun }The inspector preloaded with a sample extraction; pass run to override.