From 4a85d9e65f6b3fba42e767bf345de45bfc8efddf Mon Sep 17 00:00:00 2001 From: extio-de Date: Sun, 12 Jul 2026 17:08:56 +0200 Subject: [PATCH] fix: logging for prompt length warnings in ChatCompletionClient --- .../lmlib/client/oai/completion/chat/ChatCompletionClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/extio/lmlib/client/oai/completion/chat/ChatCompletionClient.java b/src/main/java/de/extio/lmlib/client/oai/completion/chat/ChatCompletionClient.java index 2372190..9b5ce5a 100755 --- a/src/main/java/de/extio/lmlib/client/oai/completion/chat/ChatCompletionClient.java +++ b/src/main/java/de/extio/lmlib/client/oai/completion/chat/ChatCompletionClient.java @@ -338,7 +338,7 @@ public class ChatCompletionClient extends AbstractCompletionClient { final int maxLength = modelProfile.maxContextLength() - modelProfile.maxTokens() - 15; // 15 is a margin for EOT and other special tokens if (tokens.addAndGet(textTokens) > maxLength) { var tokenized = this.tokenizerResolver.tokenize(prompt, modelProfile); - LOGGER.warn("Prompt too long: {} tokens / {} max. Prompt will be cut!", tokenized.size(), maxLength); + LOGGER.warn("Prompt too long: {} tokens / {} max. Prompt will be cut!", tokens.get(), maxLength); tokenized = tokenized.subList(0, tokenized.size() - (tokens.get() - maxLength)); prompt = this.tokenizerResolver.detokenize(tokenized, modelProfile); trimmed = true;