From 98c8cc9624c9a796e1a22e428ee40101599259cc Mon Sep 17 00:00:00 2001 From: Nissa Seru <119150866+nissa-seru@users.noreply.github.com> Date: Wed, 5 Feb 2025 04:53:21 -0500 Subject: [PATCH] Updated sliding window logic to be inverse of trigger criteria --- src/core/sliding-window/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/sliding-window/index.ts b/src/core/sliding-window/index.ts index 9e98ba17d7..ee4a1543e7 100644 --- a/src/core/sliding-window/index.ts +++ b/src/core/sliding-window/index.ts @@ -89,9 +89,9 @@ function getMaxTokensForNonPromptCachingModels(modelInfo: ModelInfo): number { /** * Provides the fraction of messages to remove for models that do not support prompt caching. * - * @param {ModelInfo} modelInfo - The model information (unused in current implementation). + * @param {ModelInfo} modelInfo - The model information. * @returns {number} The truncation fraction for non-prompt caching models (fixed at 0.1). */ function getTruncFractionForNonPromptCachingModels(modelInfo: ModelInfo): number { - return 0.1 + return Math.min(40_000 / modelInfo.contextWindow, 0.2) }