logo
Browse Source

Fix bug

Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
Jael Gu 1 year ago
parent
commit
5b246ef89a
  1. 10
      qa_prompt.py

10
qa_prompt.py

@ -4,16 +4,14 @@ from typing import List, Tuple, Dict, Optional
class QAPrompt: class QAPrompt:
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self._template = """
'Use the following pieces of context to answer the question at the end.
If you don''t know the answer, just say that you don''t know, don''t try to make
up an answer.
self._template = """Use the following pieces of context to answer the question at the end.
If you don't know the answer, just say that you don't know, don't try to make up an answer.
{context} {context}
Question: {question} Question: {question}
Helpful Answer:'
Helpful Answer:
""" """
def __call__(self, question: str, docs: List[str], history=Optional[List[Tuple]]) -> List[Dict[str, str]]: def __call__(self, question: str, docs: List[str], history=Optional[List[Tuple]]) -> List[Dict[str, str]]:
@ -30,4 +28,4 @@ Helpful Answer:'
history_data = [] history_data = []
for item in history: for item in history:
history_data.append({'question': item[0], 'answer': item[1]}) history_data.append({'question': item[0], 'answer': item[1]})
return history + ret
return history_data + ret

Loading…
Cancel
Save