diff --git a/application/retriever/brave_search.py b/application/retriever/brave_search.py index 29666a578..1fd844b26 100644 --- a/application/retriever/brave_search.py +++ b/application/retriever/brave_search.py @@ -75,7 +75,6 @@ def gen(self): if len(self.chat_history) > 1: tokens_current_history = 0 # count tokens in history - self.chat_history.reverse() for i in self.chat_history: if "prompt" in i and "response" in i: tokens_batch = num_tokens_from_string(i["prompt"]) + num_tokens_from_string( diff --git a/application/retriever/classic_rag.py b/application/retriever/classic_rag.py index b87b58524..6a67cb380 100644 --- a/application/retriever/classic_rag.py +++ b/application/retriever/classic_rag.py @@ -78,7 +78,6 @@ def gen(self): if len(self.chat_history) > 1: tokens_current_history = 0 # count tokens in history - self.chat_history.reverse() for i in self.chat_history: if "prompt" in i and "response" in i: tokens_batch = num_tokens_from_string(i["prompt"]) + num_tokens_from_string( @@ -97,7 +96,6 @@ def gen(self): llm = LLMCreator.create_llm( settings.LLM_NAME, api_key=settings.API_KEY, user_api_key=self.user_api_key ) - completion = llm.gen_stream(model=self.gpt_model, messages=messages_combine) for line in completion: yield {"answer": str(line)} diff --git a/application/retriever/duckduck_search.py b/application/retriever/duckduck_search.py index d746ecaa9..6ae562269 100644 --- a/application/retriever/duckduck_search.py +++ b/application/retriever/duckduck_search.py @@ -92,7 +92,6 @@ def gen(self): if len(self.chat_history) > 1: tokens_current_history = 0 # count tokens in history - self.chat_history.reverse() for i in self.chat_history: if "prompt" in i and "response" in i: tokens_batch = num_tokens_from_string(i["prompt"]) + num_tokens_from_string(