Documentation
¶
Index ¶
Constants ¶
View Source
const ( // MinRecommendedRatio is the lowest ratio we recommend in production. MinRecommendedRatio = 0.1 // MaxRecommendedRatio is the highest ratio we recommend in production. MaxRecommendedRatio = 0.9 // DefaultRatio is the default compaction ratio used by the model-router. DefaultRatio = 0.5 // DefaultContextWindow is used when no provider context window is specified. DefaultContextWindow = 200000 // MinCompactionTarget is the floor for the compaction target (2k tokens). MinCompactionTarget = 2000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompactionValidation ¶
type CompactionValidation struct {
// Ratio is the configured compaction ratio.
Ratio float64 `json:"ratio"`
// ContextWindow is the provider's context window in tokens.
ContextWindow int `json:"contextWindow"`
// EffectiveTarget is the computed compaction target in tokens.
EffectiveTarget int `json:"effectiveTarget"`
// CheckpointBudget is the 80% safety ceiling in tokens.
CheckpointBudget int `json:"checkpointBudget"`
// Warnings are human-readable warnings about the configuration.
Warnings []string `json:"warnings,omitempty"`
// Recommendations are actionable suggestions for the operator.
Recommendations []string `json:"recommendations,omitempty"`
// Strategy is a human-readable label for the assessed compaction strategy.
Strategy string `json:"strategy"`
}
CompactionValidation holds the result of validating a ContextCompactionRatio configuration against an expected session profile.
func ValidateContextCompaction ¶
func ValidateContextCompaction(ratio float64, contextWindow, expectedSessionLength int) *CompactionValidation
ValidateContextCompaction validates a ContextCompactionRatio configuration and returns recommendations for the operator.
Parameters:
- ratio: the configured ContextCompactionRatio (0 = use default 0.5)
- contextWindow: the provider's context window in tokens (0 = use default 200000)
- expectedSessionLength: estimated number of turns in a typical session (0 = unknown)
func (*CompactionValidation) FormatReport ¶
func (v *CompactionValidation) FormatReport() string
FormatReport renders a CompactionValidation as a human-readable report.
Click to show internal directories.
Click to hide internal directories.