fixed the response of the level test grading summary

This commit is contained in:
Pedro Fonseca
2024-01-12 16:44:34 +00:00
parent a40ce04ad2
commit 555d5e55b0

View File

@@ -192,23 +192,31 @@ def calculate_grading_summary(body):
def calculate_section_grade_summary(section): def calculate_section_grade_summary(section):
messages = [
{
"role": "user",
"content": "You are a IELTS test section grade evaluator. You will receive a IELTS test section name and the grade obtained in the section. You should offer a comment on this grade with also suggestions on how to possibly get a better grade.",
},
{
"role": "user",
"content": "Section: " + str(section['name']) + " Grade: " + str(section['grade']),
},
{"role": "user", "content": "Speak in third person."},
{"role": "user", "content": "Please save the evaluation and suggestions generated."}
]
if section['code'] == "level":
messages[2:2] = [{
"role": "user",
"content": "This section is comprised of multiple choice questions that measure the user's overall english level. These multiple choice questions are about knowledge on vocabulary, syntax, grammar rules, and contextual usage. The grade obtained measures the ability in these areas and english language overall."
}]
res = openai.ChatCompletion.create( res = openai.ChatCompletion.create(
model="gpt-3.5-turbo", model="gpt-3.5-turbo",
max_tokens=chat_config['max_tokens'], max_tokens=chat_config['max_tokens'],
temperature=chat_config['temperature'], temperature=chat_config['temperature'],
tools=tools, tools=tools,
messages=[ messages=messages)
{
"role": "user",
"content": "You are a IELTS test section grade evaluator. You will receive a IELTS test section name and the grade obtained in the section. You should offer a comment on this grade with also suggestions on how to possibly get a better grade.",
},
{
"role": "user",
"content": "Section: " + str(section['name']) + " Grade: " + str(section['grade']),
},
{"role": "user", "content": "Speak in third person."},
{"role": "user", "content": "Please save the evaluation and suggestions generated."}
])
return parse_openai_response(res) return parse_openai_response(res)