From 3610e1e5b4ef39201e04fbeb7e146b3b13a6b0f0 Mon Sep 17 00:00:00 2001
From: KevinHuSh <kevinhu.sh@gmail.com>
Date: Mon, 22 Apr 2024 15:13:01 +0800
Subject: [PATCH] fix ollama issuet push (#486)

### What problem does this PR solve?

#477

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
---
 rag/llm/chat_model.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index 7452931..d4a45f0 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -153,7 +153,7 @@ class OllamaChat(Base):
                 options=options
             )
             ans = response["message"]["content"].strip()
-            return ans, response["eval_count"] + response["prompt_eval_count"]
+            return ans, response["eval_count"] + response.get("prompt_eval_count", 0)
         except Exception as e:
             return "**ERROR**: " + str(e), 0
 
-- 
GitLab