ContextWindowConfig

org.llm4s.agent.ContextWindowConfig
case class ContextWindowConfig(maxTokens: Option[Int], maxMessages: Option[Int], preserveSystemMessage: Boolean, minRecentTurns: Int, pruningStrategy: PruningStrategy)

Configuration for automatic context window management.

Provides flexible strategies for pruning conversation history to stay within token or message count limits.

Value parameters

maxMessages

Maximum number of messages to keep (simpler alternative to token-based)

maxTokens

Maximum number of tokens to keep (if specified, requires tokenCounter)

minRecentTurns

Minimum number of recent turns to preserve (even if limit exceeded)

preserveSystemMessage

Always keep the system message (recommended)

pruningStrategy

Strategy for pruning messages when limits are exceeded

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product