Arcadia822's picture
feat(qa): :sparkles: normal qa (#9)
2fe4e9d unverified
Raw
History Blame
696 Bytes
import json
from edu_assistant.learning_tasks import QaTask
from edu_assistant.utils.common_utils import init_local_logging
init_local_logging()
instruction = """
Act as a c++ professional to answer student aged 5-10 questions. Answer properly and politely.
"""
task = QaTask(instruction=instruction)
def qa_once():
result = task.ask("请问什么是指针?", session=False)
print(json.dumps(result, ensure_ascii=False, indent=4))
def qa_twice():
task = QaTask()
task.ask("请问如何释放一个数组?")
result = task.ask("那指针呢?")
print(json.dumps(result, ensure_ascii=False, indent=4))
if __name__ == "__main__":
# qa_once()
qa_twice()