ConversationHistoryConfig
Defined in: packages/middleware/src/conversation-history.ts:21
Configuration for conversation history middleware.
Properties
Section titled “Properties”initialHistory?
Section titled “initialHistory?”
optionalinitialHistory:IRMessage[]
Defined in: packages/middleware/src/conversation-history.ts:57
Initial conversation history. Useful for seeding with system messages or previous conversation.
Default
Section titled “Default”[]maxHistorySize?
Section titled “maxHistorySize?”
optionalmaxHistorySize:number
Defined in: packages/middleware/src/conversation-history.ts:29
Maximum number of message pairs to keep.
- 0: No history (stateless)
- -1: Unlimited history
- N > 0: Keep last N user/assistant pairs
Default
Section titled “Default”-1 (unlimited)messageFilter()?
Section titled “messageFilter()?”
optionalmessageFilter: (message) =>boolean
Defined in: packages/middleware/src/conversation-history.ts:64
Custom filter to determine which messages should be added to history. Return true to include message in history, false to exclude.
Parameters
Section titled “Parameters”message
Section titled “message”Returns
Section titled “Returns”boolean
Default
Section titled “Default”(msg) => true (include all messages)prependHistory?
Section titled “prependHistory?”
optionalprependHistory:boolean
Defined in: packages/middleware/src/conversation-history.ts:44
Whether to prepend history to each request. If false, history is maintained but not automatically added to requests.
Default
Section titled “Default”truestrategy?
Section titled “strategy?”
optionalstrategy:TrimStrategy
Defined in: packages/middleware/src/conversation-history.ts:37
Trimming strategy.
- ‘fifo’: First-in-first-out, remove oldest messages
- ‘smart’: Preserve system messages, trim user/assistant pairs
Default
Section titled “Default”'smart'trackResponses?
Section titled “trackResponses?”
optionaltrackResponses:boolean
Defined in: packages/middleware/src/conversation-history.ts:50
Whether to append responses to history after each request.
Default
Section titled “Default”true