Skip to content

Commit 98c8cc9

Browse files
committed
Updated sliding window logic to be inverse of trigger criteria
1 parent 5e49421 commit 98c8cc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/sliding-window/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ function getMaxTokensForNonPromptCachingModels(modelInfo: ModelInfo): number {
8989
/**
9090
* Provides the fraction of messages to remove for models that do not support prompt caching.
9191
*
92-
* @param {ModelInfo} modelInfo - The model information (unused in current implementation).
92+
* @param {ModelInfo} modelInfo - The model information.
9393
* @returns {number} The truncation fraction for non-prompt caching models (fixed at 0.1).
9494
*/
9595
function getTruncFractionForNonPromptCachingModels(modelInfo: ModelInfo): number {
96-
return 0.1
96+
return Math.min(40_000 / modelInfo.contextWindow, 0.2)
9797
}

0 commit comments

Comments
 (0)