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 | ContentLike | The retrieved passage's rendered content. | 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:139 |
Methods
estimateTokens()?
optional estimateTokens(encoding: string): number | Promise<number>;Defined in: src/batteries/context/thrift/contracts.ts:142
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>