Interface: IKbRetriever
Defined in: internal/kb-retriever/types.ts:53
Prompt → grounded chunks.
Implemented by KbRetriever; the type of IAIGatewayDeps.kbRetriever, so a host may pass its own in overrides.
Methods
retrieve()
retrieve(
__namedParameters):Promise<IRetrievalResult>
Defined in: internal/kb-retriever/types.ts:75
retrieve -- the chunks for one prompt
About
Rewrite, embed, search, cut.
Rewrites the prompt into a query (when switched on), embeds it, searches the libraries and books of filters for
the tenant and keeps the hits of at least minScore, best first, at most k. With an empty filters.libraryIds
the knowledge base is not used: no model call, searched is false, noMatch is true. k and minScore override
the config for this call (the caller's IGatewayAskInput.kbRetrieval).
Who needs it
prepareCall, once per call, after the input check and before the request is assembled.
Pitfalls
Two model calls per search (rewrite, embed), each one usage-guard check and one trace. The search takes no abort
signal: prepareCall checks the signal before it, not during.
Parameters
__namedParameters
cheapModelId
string
facts
Record<string, string>
filters
The libraries and books to search. With an empty libraryIds nothing is searched: the result is noMatch, without a model call.
k?
number
Override config.k for this call.
meta
Omit<ILLMClientCallMeta, "kind">
Who asks, for the usage adapter and the trace; the kind is set here: QUERY_REWRITE for the rewrite, EMBED for the embedding.
minScore?
number
Override config.minScore for this call.
prompt
string
summary
string
tenantId
string
Returns
Promise<IRetrievalResult>