Fixed level issues
This commit is contained in:
@@ -11,11 +11,12 @@ class FillBlanks:
|
||||
|
||||
|
||||
async def gen_fill_blanks(
|
||||
self, quantity: int, start_id: int, size: int, topic=None
|
||||
self, start_id: int, quantity: int, size: int = 300, topic=None
|
||||
):
|
||||
if not topic:
|
||||
topic = random.choice(EducationalContent.MTI_TOPICS)
|
||||
|
||||
print(quantity)
|
||||
print(start_id)
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
@@ -28,19 +29,18 @@ class FillBlanks:
|
||||
{
|
||||
"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. '
|
||||
'The ids must be ordered throughout the text and the words must be replaced only once. '
|
||||
'For each removed word you will place it in the solutions array and assign a letter from A to D,'
|
||||
' then you will place that removed word and the chosen letter on the words array along with '
|
||||
' other 3 other words for the remaining letter. This is a fill blanks question for an english '
|
||||
'exam, so don\'t choose words completely at random.'
|
||||
f'From the generated text choose exactly {quantity} words (cannot be sequential words) replace '
|
||||
'each with {{id}} (starting from ' + str(start_id) + ' and incrementing), then generate a '
|
||||
'JSON object containing: the modified text, a solutions array with each word\'s correct '
|
||||
'letter (A-D), and a words array containing each id with four options where one is '
|
||||
'the original word (matching the solution) and three are plausible but incorrect '
|
||||
'alternatives that maintain grammatical consistency. '
|
||||
'You cannot use repeated words!' #TODO: Solve this after
|
||||
)
|
||||
}
|
||||
]
|
||||
|
||||
question = await self._llm.prediction(
|
||||
GPTModels.GPT_4_O, messages, ["question"], TemperatureSettings.GEN_QUESTION_TEMPERATURE
|
||||
GPTModels.GPT_4_O, messages, [], TemperatureSettings.GEN_QUESTION_TEMPERATURE
|
||||
)
|
||||
return {
|
||||
**question,
|
||||
@@ -56,7 +56,7 @@ class FillBlanks:
|
||||
"solutions": [
|
||||
{
|
||||
"id": "",
|
||||
"solution": ""
|
||||
"solution": "<A,B,C or D>"
|
||||
}
|
||||
],
|
||||
"words": [
|
||||
|
||||
@@ -13,15 +13,12 @@ class PassageUtas:
|
||||
self._mc_variants = mc_variants
|
||||
|
||||
async def gen_reading_passage_utas(
|
||||
self, start_id, mc_quantity: int, topic: Optional[str] # sa_quantity: int,
|
||||
self, start_id, mc_quantity: int, topic: Optional[str], word_size: Optional[int] # sa_quantity: int,
|
||||
):
|
||||
|
||||
passage = await self._reading_service.generate_reading_passage(1, topic)
|
||||
passage = await self._reading_service.generate_reading_passage(1, topic, word_size)
|
||||
mc_exercises = await self._gen_text_multiple_choice_utas(passage["text"], start_id, mc_quantity)
|
||||
|
||||
#short_answer = await self._gen_short_answer_utas(passage["text"], start_id, sa_quantity)
|
||||
# + sa_quantity, mc_quantity)
|
||||
|
||||
mc_exercises["type"] = "multipleChoice"
|
||||
"""
|
||||
exercises: {
|
||||
"shortAnswer": short_answer,
|
||||
@@ -29,11 +26,12 @@ class PassageUtas:
|
||||
},
|
||||
"""
|
||||
return {
|
||||
"exercises": mc_exercises,
|
||||
"text": {
|
||||
**mc_exercises,
|
||||
"passage": {
|
||||
"content": passage["text"],
|
||||
"title": passage["title"]
|
||||
}
|
||||
},
|
||||
"mcVariant": "passageUtas"
|
||||
}
|
||||
|
||||
async def _gen_short_answer_utas(self, text: str, start_id: int, sa_quantity: int):
|
||||
|
||||
Reference in New Issue
Block a user