Update to always use role user as role system is useless pos.

This commit is contained in:
Cristiano Ferreira
2023-06-26 22:50:40 +01:00
parent f0b85fa500
commit 55ae1b28c7
6 changed files with 23 additions and 23 deletions

View File

@@ -10,11 +10,11 @@ def get_grading_messages(question_type: QuestionType, question: str, answer: str
if QuestionType.WRITING_TASK_2 == question_type: if QuestionType.WRITING_TASK_2 == question_type:
return [ return [
{ {
"role": "system", "role": "user",
"content": "You are a IELTS examiner.", "content": "You are a IELTS examiner.",
}, },
{ {
"role": "system", "role": "user",
"content": f"The question you have to grade is of type Writing Task 2 and is the following: {question}", "content": f"The question you have to grade is of type Writing Task 2 and is the following: {question}",
}, },
{ {
@@ -89,11 +89,11 @@ def get_question_gen_messages(question_type: QuestionType):
if QuestionType.WRITING_TASK_2 == question_type: if QuestionType.WRITING_TASK_2 == question_type:
return [ return [
{ {
"role": "system", "role": "user",
"content": "You are a IELTS program that generates questions for the exams.", "content": "You are a IELTS program that generates questions for the exams.",
}, },
{ {
"role": "system", "role": "user",
"content": "The question you have to generate is of type Writing Task 2.", "content": "The question you have to generate is of type Writing Task 2.",
}, },
{ {
@@ -116,11 +116,11 @@ def get_question_gen_messages(question_type: QuestionType):
elif QuestionType.SPEAKING == question_type: elif QuestionType.SPEAKING == question_type:
return [ return [
{ {
"role": "system", "role": "user",
"content": "You are a IELTS program that generates questions for the exams.", "content": "You are a IELTS program that generates questions for the exams.",
}, },
{ {
"role": "system", "role": "user",
"content": "The question you have to generate is of type Speaking Task.", "content": "The question you have to generate is of type Speaking Task.",
}, },
{ {

View File

@@ -30,11 +30,11 @@ def correct_answer(
messages= messages=
[ [
{ {
"role": "system", "role": "user",
"content": "You are a IELTS examiner.", "content": "You are a IELTS examiner.",
}, },
{ {
"role": "system", "role": "user",
"content": f"The question you have to grade is of type {question_type} and is the following: {question}", "content": f"The question you have to grade is of type {question_type} and is the following: {question}",
}, },
{ {

View File

@@ -24,22 +24,22 @@ def generate_summarizer(
messages= messages=
[ [
{ {
"role": "system", "role": "user",
"content": "You are a IELTS examiner.", "content": "You are a IELTS examiner.",
}, },
{ {
"role": "system", "role": "user",
"content": f"The question you have to grade is of type {question_type} and is the following: {question}", "content": f"The question you have to grade is of type {question_type} and is the following: {question}",
}, },
{ {
"role": "system", "role": "user",
"content": "Please provide a JSON object response with the overall grade and breakdown grades, " "content": "Please provide a JSON object response with the overall grade and breakdown grades, "
"formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, " "formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, "
"'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': " "'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': "
"6.0}}", "6.0}}",
}, },
{ {
"role": "system", "role": "user",
"content": "Don't give explanations for the grades, just provide the json with the grades.", "content": "Don't give explanations for the grades, just provide the json with the grades.",
}, },
{ {

View File

@@ -12,15 +12,15 @@ from helper.token_counter import count_tokens
messages = [ messages = [
{ {
"role": "system", "role": "user",
"content": "You are a IELTS examiner.", "content": "You are a IELTS examiner.",
}, },
{ {
"role": "system", "role": "user",
"content": f"The question you have to grade is of type and is the following: ", "content": f"The question you have to grade is of type and is the following: ",
}, },
{ {
"role": "system", "role": "user",
"content": "Please provide a JSON object response with the overall grade and breakdown grades, " "content": "Please provide a JSON object response with the overall grade and breakdown grades, "
"formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, " "formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, "
"'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': " "'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': "

View File

@@ -24,22 +24,22 @@ def generate_summarizer(
messages= messages=
[ [
{ {
"role": "system", "role": "user",
"content": "You are a IELTS examiner.", "content": "You are a IELTS examiner.",
}, },
{ {
"role": "system", "role": "user",
"content": f"The question you have to grade is of type {question_type} and is the following: {question}", "content": f"The question you have to grade is of type {question_type} and is the following: {question}",
}, },
{ {
"role": "system", "role": "user",
"content": "Please provide a JSON object response with the overall grade and breakdown grades, " "content": "Please provide a JSON object response with the overall grade and breakdown grades, "
"formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, " "formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, "
"'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': " "'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': "
"6.0}}", "6.0}}",
}, },
{ {
"role": "system", "role": "user",
"content": "Don't give explanations for the grades, just provide the json with the grades.", "content": "Don't give explanations for the grades, just provide the json with the grades.",
}, },
{ {

View File

@@ -24,22 +24,22 @@ def generate_summarizer(
frequency_penalty=float(frequency_penalty), frequency_penalty=float(frequency_penalty),
messages=[ messages=[
{ {
"role": "system", "role": "user",
"content": "You are a IELTS examiner.", "content": "You are a IELTS examiner.",
}, },
{ {
"role": "system", "role": "user",
"content": f"The question you have to grade is of type {question_type} and is the following: {question}", "content": f"The question you have to grade is of type {question_type} and is the following: {question}",
}, },
{ {
"role": "system", "role": "user",
"content": "Please provide a JSON object response with the overall grade and breakdown grades, " "content": "Please provide a JSON object response with the overall grade and breakdown grades, "
"formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, " "formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, "
"'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': " "'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': "
"6.0}}", "6.0}}",
}, },
{ {
"role": "system", "role": "user",
"content": "Don't give explanations for the grades, just provide the json with the grades.", "content": "Don't give explanations for the grades, just provide the json with the grades.",
}, },
{ {