Update utils.py
Browse files
utils.py
CHANGED
@@ -31,6 +31,7 @@ def get_answer(query):
|
|
31 |
# Prepare input and decoder input
|
32 |
similar_docs = get_similar_docs(query, 10, documents, embeddings)
|
33 |
chat_history.append(Document(page_content=query))
|
|
|
34 |
combined_docs = chat_history + similar_docs
|
35 |
|
36 |
input_text = ""
|
@@ -46,5 +47,5 @@ def get_answer(query):
|
|
46 |
|
47 |
# Decode the generated text
|
48 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
49 |
-
chat_history.append(Document(page_content=generated_text))
|
50 |
return generated_text.split(query)[1].capitalize()
|
|
|
31 |
# Prepare input and decoder input
|
32 |
similar_docs = get_similar_docs(query, 10, documents, embeddings)
|
33 |
chat_history.append(Document(page_content=query))
|
34 |
+
|
35 |
combined_docs = chat_history + similar_docs
|
36 |
|
37 |
input_text = ""
|
|
|
47 |
|
48 |
# Decode the generated text
|
49 |
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
50 |
+
chat_history.append(Document(page_content=generated_text.split(query)[1].capitalize()))
|
51 |
return generated_text.split(query)[1].capitalize()
|