Interface: IContextAssembler
Defined in: internal/context-assembler/types.ts:82
Ten inputs in, one request out.
Implemented by ContextAssembler; the type of IAIGatewayDeps.contextAssembler, so a host may pass its own in overrides.
Methods
build()
build(
args):Promise<IAssembledContext>
Defined in: internal/context-assembler/types.ts:104
build -- the model request of one call
About
System prompt first, then the history that fits, then the trim.
Renders CHAT_MAIN (output format, addendum, skills, today, locale, timezone, instructions, context, memory,
knowledge-base chunks) and asks the working memory for the thread's window with the budget that is left
(contextTokens − reserveOutputTokens − system); its notes are rendered into {memory} after the user's facts. While
the request would still overflow the model's window, the oldest messages are left out first (turns_trimmed), then the
lowest-ranked chunks (kb_chunks_trimmed); the notes and the facts are never cut. The skills are listed by name and
description when dyna_aigw_load_skill is among the tools, written out otherwise; a stored CHAT_MAIN without {skills} drops
them with the WARNING skills_slot_missing. The files of the question go into its message when the model can read
their type (images, PDF); another file is left out with the WARNING file_dropped. Returns the request, the template
version, the chunk ids that are in it, the estimated input tokens and the warnings.
Who needs it
prepareCall, for every ask and run.
Parameters
args
input
Returns
Promise<IAssembledContext>