Improve prompts and add suffix to speaking 2.
This commit is contained in:
43
app.py
43
app.py
@@ -789,28 +789,43 @@ def grade_speaking_task_2():
|
|||||||
def get_speaking_task_2_question():
|
def get_speaking_task_2_question():
|
||||||
difficulty = request.args.get("difficulty", default=random.choice(difficulties))
|
difficulty = request.args.get("difficulty", default=random.choice(difficulties))
|
||||||
topic = request.args.get("topic", default=random.choice(mti_topics))
|
topic = request.args.get("topic", default=random.choice(mti_topics))
|
||||||
|
|
||||||
|
json_format = {
|
||||||
|
"topic": "topic",
|
||||||
|
"question": "question",
|
||||||
|
"prompts": [
|
||||||
|
"prompt_1",
|
||||||
|
"prompt_2",
|
||||||
|
"prompt_3"
|
||||||
|
],
|
||||||
|
"suffix": "And explain why..."
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
messages = [
|
messages = [
|
||||||
{
|
{
|
||||||
"role": "system",
|
"role": "system",
|
||||||
"content": (
|
"content": 'You are a helpful assistant designed to output JSON on this format: ' + str(json_format)
|
||||||
'You are a helpful assistant designed to output JSON on this format: '
|
|
||||||
'{"topic": "topic", "question": "question", "prompts": ["prompt_1", "prompt_2", "prompt_3"]}')
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": (
|
"content": (
|
||||||
'Create a question of ' + difficulty + ' difficulty for IELTS Speaking Part 2 '
|
'Create a question of medium difficulty for IELTS Speaking Part 2 '
|
||||||
'that encourages candidates to narrate a '
|
'that encourages candidates to narrate a '
|
||||||
'personal experience or story related to the topic '
|
'personal experience or story related to the topic '
|
||||||
'of "' + topic + '". Include 3 prompts that '
|
'of "' + random.choice(mti_topics) + '". Include 3 prompts that '
|
||||||
'guide the candidate to describe '
|
'guide the candidate to describe '
|
||||||
'specific aspects of the experience, '
|
'specific aspects of the experience, '
|
||||||
'such as details about the situation, '
|
'such as details about the situation, '
|
||||||
'their actions, and the reasons it left a '
|
'their actions, and the reasons it left a '
|
||||||
'lasting impression. Make sure that the '
|
'lasting impression. Make sure that the '
|
||||||
'generated question does not contain '
|
'generated question does not contain '
|
||||||
'forbidden subjects in muslim countries.')
|
'forbidden subjects in muslim countries.')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": 'The prompts must not be questions. Also include a suffix like the ones in the IELTS exams '
|
||||||
|
'that start with "And explain why".'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
token_count = count_total_tokens(messages)
|
token_count = count_total_tokens(messages)
|
||||||
|
|||||||
Reference in New Issue
Block a user