Skip to content
1 min read · 158 words

Function: storeRetrievables()

ts
function storeRetrievables(
  ctx: RetrievableStoreCtx,
  raws: RawRetrievable[],
  deps: {
    retrievable: Resolver<RetrievableCtor>;
  },
): Promise<Retrievable[]>;

Defined in: batteries/tools/web_retrieval/index.ts:347

Construct @nhtio/adk!Retrievables from RawRetrievables and store each via ctx.

Parameters

ParameterTypeDescription
ctxRetrievableStoreCtxAnything with a storeRetrievable method (a DispatchContext, or a stub).
rawsRawRetrievable[]The plain records from the converters.
deps{ retrievable: Resolver<RetrievableCtor>; }{ retrievable }: the Retrievable constructor or a resolver of it.
deps.retrievableResolver<RetrievableCtor>-

Returns

Promise<Retrievable[]>

The constructed Retrievable instances, in input order.

Remarks

This is the only function here that touches a core class, and it does so through an injected resolver (deps.retrievable) so the glue itself never value-imports Retrievable. Each record's RawRetrievable validation (including the required trustTier) fires at construction. For reader-backed content, the caller's spool hook will typically have used ctx.storeRetrievableBytes already; this helper just persists the records into the turn.