Interface: WorkingRetrievable
Defined in: src/batteries/context/thrift/contracts.ts:134
The structural shape of a retrieved passage (RAG chunk) the working set carries. estimateTokens mirrors a core Retrievable's own method, which MAY resolve asynchronously (a reader-backed artifact's estimate can be a Promise) — the battery treats a non-number return as "measure the rendered string instead" (see @nhtio/adk/batteries/context/thrift/subtractive_pass!subtractToFit's rTok helper), since this pass is synchronous end-to-end and never awaits.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
content | | string | { estimateTokens?: number | Promise<number>; toString: string; } | The retrieved passage's rendered content. Core artifacts may expose an asynchronous estimate; thrift only accepts the synchronous result and otherwise uses its defensive fallback. | src/batteries/context/thrift/contracts.ts:139 |
id? | string | Stable identifier, when available, for diagnostics and trace attribution. | src/batteries/context/thrift/contracts.ts:136 |
score? | number | Relevance/rerank score, [0, 1]-ish; retrievables sort by this (descending) before the shed, so the tail of the ranking (lowest score) sheds first. Missing/absent sorts as 0 (shed first). | src/batteries/context/thrift/contracts.ts:147 |
sizeUnknown? | boolean | Whether this retrievable's content cannot be synchronously measured safely by thrift. A real core Retrievable structurally supplies this field automatically through its sizeUnknown getter; no adapter or conversion object is needed. Any other, non-core duck-typed caller supplying this shape MUST set sizeUnknown: true for content whose size it cannot verify to receive the same never-retain safety guarantee. This field is optional only to preserve the structural API's compatibility; the obligation for such callers is not enforced by TypeScript. | src/batteries/context/thrift/contracts.ts:161 |
Methods
estimateTokens()?
optional estimateTokens(encoding: string): number | Promise<number>;Defined in: src/batteries/context/thrift/contracts.ts:150
Optional self-measurement; may resolve synchronously OR as a Promise (a reader-backed artifact). A non-number result falls back to measuring content.toString().
Parameters
| Parameter | Type |
|---|---|
encoding | string |
Returns
number | Promise<number>