FitResult

Result of fitting content into a context window budget.

Usage

Source

FitResult(
    messages,
    system_prompt,
    tokens_used,
    token_budget,
    messages_dropped=0,
    strategy_used=FitStrategy.TRUNCATE_OLDEST
)

Parameters

messages: list[dict[str, str]]

The messages that fit within the budget.

system_prompt: str

The system prompt (possibly truncated).

tokens_used: int

Estimated total tokens consumed.

token_budget: int

The total token budget that was targeted.

messages_dropped: int = 0

Number of messages that were dropped to fit.

strategy_used: FitStrategy = FitStrategy.TRUNCATE_OLDEST
The strategy that was applied.