From ef514575eb8c04ae8d5148c7afdf3a0dea0bac9d Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Mon, 14 Apr 2025 11:45:02 -0400 Subject: [PATCH] Provide model name for tokens counting Although Continue now uses the Llama tokenizer for most models, it's still important to provide the model name to the countTokens function. This ensures flexibility in case we introduce more specialized tokenizers for different models in the future. --- core/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/core.ts b/core/core.ts index 68aa605ac..c331e7273 100644 --- a/core/core.ts +++ b/core/core.ts @@ -709,7 +709,7 @@ export class Core { throw new Error("No chat model selected"); } - const tokens = countTokens(item.content); + const tokens = countTokens(item.content, llm.model); if (tokens > llm.contextLength - llm.completionOptions!.maxTokens!) { return true;