From ffaa22c49bc545c9438aee9e3bd5c605a28668d3 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 25 May 2023 16:40:11 +0100 Subject: [PATCH] reverse history order to use latest history firts Co-Authored-By: Pavel <32868631+pabik@users.noreply.github.com> --- application/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/application/app.py b/application/app.py index 7c12721f..55b6152d 100644 --- a/application/app.py +++ b/application/app.py @@ -176,6 +176,7 @@ def api_answer(): tokens_current_history = 0 tokens_max_history = 1000 #count tokens in history + history.reverse() for i in history: if "prompt" in i and "response" in i: tokens_batch = llm.get_num_tokens(i["prompt"]) + llm.get_num_tokens(i["response"])