Added missing fillBlanks mc variant that was in UTAS to custom level
This commit is contained in:
@@ -1563,6 +1563,66 @@ def gen_multiple_choice_underlined_utas(quantity: int, start_id: int, all_exams=
|
||||
return response
|
||||
|
||||
|
||||
def gen_fill_blanks_mc_utas(quantity: int, start_id: int, size: int, topic=random.choice(mti_topics)):
|
||||
json_format = {
|
||||
"question": {
|
||||
"solutions": [
|
||||
{
|
||||
"id": "<question id>",
|
||||
"solution": "<the option that holds the solution>"
|
||||
}
|
||||
],
|
||||
"words": [
|
||||
{
|
||||
"id": "<question id>",
|
||||
"options": {
|
||||
"A": "<a option>",
|
||||
"B": "<b option>",
|
||||
"C": "<c option>",
|
||||
"D": "<d option>"
|
||||
}
|
||||
}
|
||||
],
|
||||
"text": "text"
|
||||
}
|
||||
}
|
||||
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": 'You are a helpful assistant designed to output JSON on this format: ' + str(json_format)
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": (
|
||||
f'Generate a text of at least {size} words about the topic {topic}. Make sure the text is structured '
|
||||
'in paragraphs formatted with newlines (\\n\\n) to delimit them.'
|
||||
)
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": (
|
||||
f'From the generated text choose {quantity} words (cannot be sequential words) to replace '
|
||||
'once with {{id}} where id starts on ' + str(start_id) + ' and is incremented for each word. '
|
||||
'For each word choose 4 options, 1 correct and the other ones false. Make sure that only 1 is the '
|
||||
'correct one amongst the 4 options and put the solution on the solutions array. '
|
||||
'The ids must be ordered throughout the text and the words must be replaced only once. Put the '
|
||||
'removed words and respective ids on the words array of the json in the correct order. You can\'t '
|
||||
'reference multiple times the same id across the text, if for example one of the chosen words is '
|
||||
'"word1" then word1 must be placed in the text with an id once, if word1 is referenced other '
|
||||
'times in the text then replace with the actual text of word.'
|
||||
)
|
||||
}
|
||||
]
|
||||
|
||||
token_count = count_total_tokens(messages)
|
||||
question = make_openai_call(GPT_4_O, messages, token_count,
|
||||
["question"],
|
||||
GEN_QUESTION_TEMPERATURE)
|
||||
|
||||
return question["question"]
|
||||
|
||||
|
||||
def gen_blank_space_text_utas(quantity: int, start_id: int, size: int, topic=random.choice(mti_topics)):
|
||||
json_format = {
|
||||
"question": {
|
||||
|
||||
Reference in New Issue
Block a user