Skip to content

Commit

Permalink
fix: history bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dartpain committed Oct 31, 2024
1 parent 365537f commit 78c819f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 4 deletions.
1 change: 0 additions & 1 deletion application/retriever/brave_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 0 additions & 2 deletions application/retriever/classic_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)}
Expand Down
1 change: 0 additions & 1 deletion application/retriever/duckduck_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 78c819f

Please sign in to comment.