ContextWindowCompactionStrategy(Int32, Int32, Double, Double) Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the ContextWindowCompactionStrategy class.
public ContextWindowCompactionStrategy(int maxContextWindowTokens, int maxOutputTokens, double toolEvictionThreshold = 0.5, double truncationThreshold = 0.8);
new Microsoft.Agents.AI.Compaction.ContextWindowCompactionStrategy : int * int * double * double -> Microsoft.Agents.AI.Compaction.ContextWindowCompactionStrategy
Public Sub New (maxContextWindowTokens As Integer, maxOutputTokens As Integer, Optional toolEvictionThreshold As Double = 0.5, Optional truncationThreshold As Double = 0.8)
Parameters
- maxContextWindowTokens
- Int32
The maximum number of tokens the model's context window supports (e.g., 1,050,000 for gpt-5.4).
- maxOutputTokens
- Int32
The maximum number of output tokens the model can generate per response (e.g., 128,000 for gpt-5.4).
- toolEvictionThreshold
- Double
The fraction of the input budget (0.0, 1.0] at which tool result eviction triggers. Defaults to DefaultToolEvictionThreshold (0.5).
- truncationThreshold
- Double
The fraction of the input budget (0.0, 1.0] at which truncation triggers.
Defaults to DefaultTruncationThreshold (0.8).
Must be greater than or equal to toolEvictionThreshold.
Exceptions
maxContextWindowTokens is not positive, or
maxOutputTokens is negative or greater than or equal to maxContextWindowTokens, or
toolEvictionThreshold or truncationThreshold is not in (0.0, 1.0], or
truncationThreshold is less than toolEvictionThreshold.