Attributes
- Companion
- trait
- Graph
-
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
PruningStrategy.type
Members list
Type members
Classlikes
Adaptive windowing strategy that automatically determines the best context window size based on the model's context size and pricing information.
Adaptive windowing strategy that automatically determines the best context window size based on the model's context size and pricing information.
This strategy optimizes for cost-quality balance:
- Uses tier-appropriate percentage of model's context window (reserves space for outputs)
- Adjusts ratio based on model size (larger models use larger windows)
- Preserves minimum recent turns for conversation coherence
- Can optionally use cost-sensitive tuning
Model tiers and window ratios:
- Small (≤32K): 60% window to reduce costs
- Medium (32K-100K): 70% balanced cost/quality
- Large (100K-200K): 75% for more complex context
- Extra large (>200K): 80% very generous window
Value parameters
- contextWindowSize
-
The model's actual context window in tokens
- costSensitivity
-
How aggressively to optimize for cost (0.0-1.0, default: 0.5) 0.0 = maximize quality, 1.0 = minimize cost
- inputCostPerToken
-
Optional cost per input token (enables cost optimization)
- outputCostPerToken
-
Optional cost per output token
- preserveMinTurns
-
Minimum number of recent turns to always preserve (default: 3)
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait PruningStrategyclass Objecttrait Matchableclass AnyShow all
Custom pruning function. Receives all messages and returns the subset to keep. The function should be pure (no side effects) and deterministic.
Custom pruning function. Receives all messages and returns the subset to keep. The function should be pure (no side effects) and deterministic.
Value parameters
- fn
-
Function that takes messages and returns pruned messages
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait PruningStrategyclass Objecttrait Matchableclass AnyShow all
Remove messages from the middle, keeping start and end. Useful for preserving both initial context and recent exchanges.
Remove messages from the middle, keeping start and end. Useful for preserving both initial context and recent exchanges.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait PruningStrategyclass Objecttrait Matchableclass AnyShow all
- Self type
-
MiddleOut.type
Remove oldest messages first (FIFO). Preserves system message (if configured) and most recent messages.
Remove oldest messages first (FIFO). Preserves system message (if configured) and most recent messages.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait PruningStrategyclass Objecttrait Matchableclass AnyShow all
- Self type
-
OldestFirst.type
Keep only the most recent N complete turns (user+assistant pairs). Drops everything older than the specified number of turns.
Keep only the most recent N complete turns (user+assistant pairs). Drops everything older than the specified number of turns.
Value parameters
- turns
-
Number of recent turns to keep
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait PruningStrategyclass Objecttrait Matchableclass AnyShow all
Inherited and Abstract types
The names of the product elements
The names of the product elements
Attributes
- Inherited from:
- Mirror
The name of the type
The name of the type
Attributes
- Inherited from:
- Mirror