erosolar-cli
Version:
Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning
42 lines • 1.54 kB
TypeScript
/**
* Model Context Window Management
*
* Maps models to their context window sizes and provides utilities
* for dynamic context limit configuration.
*/
export interface ModelContextInfo {
model: string;
contextWindow: number;
targetTokens: number;
isDefault: boolean;
}
/**
* Get context window information for a model.
*/
export declare function getModelContextInfo(model: string | null | undefined): ModelContextInfo;
/**
* Returns the approximate context window (in tokens) for the provided model id.
* Falls back to null when the model is unknown so callers can handle gracefully.
*/
export declare function getContextWindowTokens(model: string | null | undefined): number | null;
/**
* Get safe target token count for a model.
* This is the threshold at which context pruning should begin.
*/
export declare function getSafeTargetTokens(model: string | null | undefined): number;
/**
* Calculate all context management thresholds for a model.
*
* Thresholds are set conservatively to prevent context overflow errors:
* - targetTokens: Start proactive pruning at 60% to leave ample room
* - warningTokens: Show warning at 50% so user is aware
* - criticalTokens: Aggressive pruning at 75%
* - safetyBuffer: Reserve 5% for API overhead and response tokens
*/
export declare function calculateContextThresholds(model: string | null | undefined): {
maxTokens: number;
targetTokens: number;
warningTokens: number;
criticalTokens: number;
};
//# sourceMappingURL=contextWindow.d.ts.map