Added endpoint for /fetch_tips

This commit is contained in:
Pedro Fonseca
2023-09-03 11:38:12 +01:00
parent a31489d850
commit fcd7483fd9
3 changed files with 106 additions and 3 deletions

View File

@@ -344,3 +344,37 @@ def get_question_gen_messages(question_type: QuestionType):
]
else:
raise Exception("Question type not implemented: " + question_type.value)
def get_question_tips(question: str, answer: str, correct_answer: str, context: str = None):
messages = [
{
"role": "system",
"content": "You are a IELTS exam program that analyzes incorrect answers to questions and gives tips to "
"help students understand why it was a wrong answer and explains how their thought process "
"should have been. The tip should refer to the context and question.",
}
]
if not (context is None or context == ""):
messages.append({
"role": "system",
"content": f"This is the context for the question: {context}",
})
messages.extend([
{
"role": "system",
"content": f"This is the question: {question}",
},
{
"role": "system",
"content": f"This is the answer: {answer}",
},
{
"role": "system",
"content": f"This is the correct answer: {correct_answer}",
}
])
return messages