From dce7c138ea13378b2f4bf65cf1cf0a5a59e07875 Mon Sep 17 00:00:00 2001 From: Jan Pohlmeyer Date: Fri, 24 Jan 2025 13:50:48 +0100 Subject: [PATCH] Fix switched input/output token usage in ollama streaming --- .../langchain4j/ollama/OllamaStreamingChatLanguageModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model-providers/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/OllamaStreamingChatLanguageModel.java b/model-providers/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/OllamaStreamingChatLanguageModel.java index e256a462c..21872de10 100644 --- a/model-providers/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/OllamaStreamingChatLanguageModel.java +++ b/model-providers/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/OllamaStreamingChatLanguageModel.java @@ -124,8 +124,8 @@ public void accept(ChatResponse response) { if (response.evalCount() != null && response.promptEvalCount() != null) { TokenUsage tokenUsage = new TokenUsage( - response.evalCount(), response.promptEvalCount(), + response.evalCount(), response.evalCount() + response.promptEvalCount()); context.put(TOKEN_USAGE_CONTEXT, tokenUsage); }