Interface: ContextStrategy
Defined in: types/llm.ts:259
Defines a strategy for managing the conversation context window and message history.
Methods
buildContext()
buildContext(
systemPrompt,history,maxContextLength,getTokenCount):Message[]
Defined in: types/llm.ts:268
Constructs the final array of messages to be sent to the model for the current inference step. *
Parameters
systemPrompt
string
The top-level instructions or persona assigned to the model.
history
Message[]
The complete conversation history up to the current point.
maxContextLength
number
The maximum number of tokens that the model can keep in the context.
getTokenCount
(messages) => number
A callback function provided by the LLM controller that calculates the exact number of tokens a specific array of messages will consume once formatted.
Returns
Message[]
The optimized array of messages, ready to be processed by the model.