From d4694e55bf3d9f4d1815dc9a8119581bbdd8e666 Mon Sep 17 00:00:00 2001 From: "cristiano.ferreira" Date: Fri, 9 Feb 2024 18:59:00 +0000 Subject: [PATCH] Add difficulty settings for generation --- app.py | 68 +++++++++++++++++++++++++++------------ helper/constants.py | 2 ++ helper/exercises.py | 78 ++++++++++++++++++++++----------------------- 3 files changed, 88 insertions(+), 60 deletions(-) diff --git a/app.py b/app.py index 14ae621..f78cccb 100644 --- a/app.py +++ b/app.py @@ -52,6 +52,7 @@ def get_listening_section_1_question(): # Extract parameters from the URL query string topic = request.args.get('topic', default=random.choice(two_people_scenarios)) req_exercises = request.args.getlist('exercises') + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) if (len(req_exercises) == 0): req_exercises = random.sample(LISTENING_EXERCISE_TYPES, 1) @@ -65,10 +66,11 @@ def get_listening_section_1_question(): start_id = 1 exercises = generate_listening_conversation_exercises(unprocessed_conversation, req_exercises, number_of_exercises_q, - start_id) + start_id, difficulty) return { "exercises": exercises, - "text": processed_conversation + "text": processed_conversation, + "difficulty": difficulty } except Exception as e: return str(e) @@ -82,6 +84,7 @@ def get_listening_section_2_question(): # Extract parameters from the URL query string topic = request.args.get('topic', default=random.choice(social_monologue_contexts)) req_exercises = request.args.getlist('exercises') + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) if (len(req_exercises) == 0): req_exercises = random.sample(LISTENING_EXERCISE_TYPES, 2) @@ -92,10 +95,11 @@ def get_listening_section_2_question(): app.logger.info("Generated monologue: " + str(monologue)) start_id = 11 - exercises = generate_listening_monologue_exercises(monologue, req_exercises, number_of_exercises_q, start_id) + exercises = generate_listening_monologue_exercises(monologue, req_exercises, number_of_exercises_q, start_id, difficulty) return { "exercises": exercises, - "text": monologue + "text": monologue, + "difficulty": difficulty } except Exception as e: return str(e) @@ -109,6 +113,7 @@ def get_listening_section_3_question(): # Extract parameters from the URL query string topic = request.args.get('topic', default=random.choice(four_people_scenarios)) req_exercises = request.args.getlist('exercises') + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) if (len(req_exercises) == 0): req_exercises = random.sample(LISTENING_EXERCISE_TYPES, 1) @@ -122,10 +127,11 @@ def get_listening_section_3_question(): start_id = 21 exercises = generate_listening_conversation_exercises(unprocessed_conversation, req_exercises, number_of_exercises_q, - start_id) + start_id, difficulty) return { "exercises": exercises, - "text": processed_conversation + "text": processed_conversation, + "difficulty": difficulty } except Exception as e: return str(e) @@ -139,6 +145,7 @@ def get_listening_section_4_question(): # Extract parameters from the URL query string topic = request.args.get('topic', default=random.choice(academic_subjects)) req_exercises = request.args.getlist('exercises') + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) if (len(req_exercises) == 0): req_exercises = random.sample(LISTENING_EXERCISE_TYPES, 2) @@ -149,10 +156,11 @@ def get_listening_section_4_question(): app.logger.info("Generated monologue: " + str(monologue)) start_id = 31 - exercises = generate_listening_monologue_exercises(monologue, req_exercises, number_of_exercises_q, start_id) + exercises = generate_listening_monologue_exercises(monologue, req_exercises, number_of_exercises_q, start_id, difficulty) return { "exercises": exercises, - "text": monologue + "text": monologue, + "difficulty": difficulty } except Exception as e: return str(e) @@ -165,7 +173,9 @@ def save_listening(): data = request.get_json() parts = data.get('parts') minTimer = data.get('minTimer', LISTENING_MIN_TIMER_DEFAULT) + difficulty = data.get('difficulty', random.choice(difficulties)) template = getListeningTemplate() + template['difficulty'] = difficulty id = str(uuid.uuid4()) for i, part in enumerate(parts, start=0): part_template = getListeningPartTemplate() @@ -240,16 +250,18 @@ def grade_writing_task_1(): @app.route('/writing_task1_general', methods=['GET']) @jwt_required() def get_writing_task_1_general_question(): + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) try: gen_wt1_question = "Craft a prompt for an IELTS Writing Task 1 General Training exercise that instructs the " \ "student to compose a letter. The prompt should present a specific scenario or situation, " \ "requiring the student to provide information, advice, or instructions within the letter. " \ - "Make sure that the generated prompt does not contain forbidden subjects in muslim countries." + "Make sure that the generated prompt is of " + difficulty + " difficulty and does not contain forbidden subjects in muslim countries." token_count = count_tokens(gen_wt1_question)["n_tokens"] response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_wt1_question, token_count, None, GEN_QUESTION_TEMPERATURE) return { - "question": response.strip() + "question": response.strip(), + "difficulty": difficulty } except Exception as e: return str(e) @@ -296,8 +308,9 @@ def grade_writing_task_2(): @app.route('/writing_task2_general', methods=['GET']) @jwt_required() def get_writing_task_2_general_question(): + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) try: - gen_wt2_question = "Craft a comprehensive question for IELTS Writing Task 2 General Training that directs the candidate " \ + gen_wt2_question = "Craft a comprehensive question of " + difficulty + " difficulty for IELTS Writing Task 2 General Training that directs the candidate " \ "to delve into an in-depth analysis of contrasting perspectives on a specific topic. The candidate " \ "should be asked to discuss the strengths and weaknesses of both viewpoints, provide evidence or " \ "examples, and present a well-rounded argument before concluding with their personal opinion on the " \ @@ -306,7 +319,8 @@ def get_writing_task_2_general_question(): response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_wt2_question, token_count, None, GEN_QUESTION_TEMPERATURE) return { - "question": response.strip() + "question": response.strip(), + "difficulty": difficulty } except Exception as e: return str(e) @@ -388,8 +402,9 @@ def grade_speaking_task_1(): @app.route('/speaking_task_1', methods=['GET']) @jwt_required() def get_speaking_task_1_question(): + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) try: - gen_sp1_question = "Craft a thought-provoking question for IELTS Speaking Part 1 that encourages candidates to delve deeply " \ + gen_sp1_question = "Craft a thought-provoking question of " + difficulty + " difficulty for IELTS Speaking Part 1 that encourages candidates to delve deeply " \ "into personal experiences, preferences, or insights on diverse topics. Instruct the candidate to offer " \ "not only detailed descriptions but also provide nuanced explanations, examples, or anecdotes to enrich " \ "their response. Make sure that the generated question does not contain forbidden subjects in muslim countries." \ @@ -398,6 +413,7 @@ def get_speaking_task_1_question(): response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_sp1_question, token_count, GEN_FIELDS, GEN_QUESTION_TEMPERATURE) response["type"] = 1 + response["difficulty"] = difficulty return response except Exception as e: return str(e) @@ -459,8 +475,9 @@ def grade_speaking_task_2(): @app.route('/speaking_task_2', methods=['GET']) @jwt_required() def get_speaking_task_2_question(): + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) try: - gen_sp2_question = "Create a question for IELTS Speaking Part 2 that encourages candidates to narrate a personal experience " \ + gen_sp2_question = "Create a question of " + difficulty + " difficulty for IELTS Speaking Part 2 that encourages candidates to narrate a personal experience " \ "or story related to a randomly selected topic. Include 3 prompts that guide the candidate to describe " \ "specific aspects of the experience, such as details about the situation, their actions, and the " \ "reasons it left a lasting impression. Make sure that the generated question does not contain forbidden subjects in muslim countries." \ @@ -470,6 +487,7 @@ def get_speaking_task_2_question(): response = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_sp2_question, token_count, GEN_FIELDS, GEN_QUESTION_TEMPERATURE) response["type"] = 2 + response["difficulty"] = difficulty return response except Exception as e: return str(e) @@ -478,8 +496,9 @@ def get_speaking_task_2_question(): @app.route('/speaking_task_3', methods=['GET']) @jwt_required() def get_speaking_task_3_question(): + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) try: - gen_sp3_question = "Formulate a set of 3 questions for IELTS Speaking Part 3 that encourage candidates to engage in a " \ + gen_sp3_question = "Formulate a set of 3 questions of " + difficulty + " difficulty for IELTS Speaking Part 3 that encourage candidates to engage in a " \ "meaningful discussion on a particular topic. Provide inquiries, ensuring " \ "they explore various aspects, perspectives, and implications related to the topic. " \ "Make sure that the generated question does not contain forbidden subjects in muslim countries." \ @@ -492,6 +511,7 @@ def get_speaking_task_3_question(): response["questions"] = [re.sub(r"^\d+\.\s*", "", question) if re.match(r"^\d+\.", question) else question for question in response["questions"]] response["type"] = 3 + response["difficulty"] = difficulty return response except Exception as e: return str(e) @@ -669,6 +689,7 @@ def get_reading_passage_1_question(): # Extract parameters from the URL query string topic = request.args.get('topic', default=random.choice(topics)) req_exercises = request.args.getlist('exercises') + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) if (len(req_exercises) == 0): req_exercises = random.sample(READING_EXERCISE_TYPES, 2) @@ -678,13 +699,14 @@ def get_reading_passage_1_question(): passage = generate_reading_passage(QuestionType.READING_PASSAGE_1, topic) app.logger.info("Generated passage: " + str(passage)) start_id = 1 - exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id) + exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) return { "exercises": exercises, "text": { "content": passage["text"], "title": passage["title"] - } + }, + "difficulty": difficulty } except Exception as e: return str(e) @@ -697,6 +719,7 @@ def get_reading_passage_2_question(): # Extract parameters from the URL query string topic = request.args.get('topic', default=random.choice(topics)) req_exercises = request.args.getlist('exercises') + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) if (len(req_exercises) == 0): req_exercises = random.sample(READING_EXERCISE_TYPES, 2) @@ -706,13 +729,14 @@ def get_reading_passage_2_question(): passage = generate_reading_passage(QuestionType.READING_PASSAGE_2, topic) app.logger.info("Generated passage: " + str(passage)) start_id = 14 - exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id) + exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) return { "exercises": exercises, "text": { "content": passage["text"], "title": passage["title"] - } + }, + "difficulty": difficulty } except Exception as e: return str(e) @@ -725,6 +749,7 @@ def get_reading_passage_3_question(): # Extract parameters from the URL query string topic = request.args.get('topic', default=random.choice(topics)) req_exercises = request.args.getlist('exercises') + difficulty = request.args.get("difficulty", default=random.choice(difficulties)) if (len(req_exercises) == 0): req_exercises = random.sample(READING_EXERCISE_TYPES, 2) @@ -734,13 +759,14 @@ def get_reading_passage_3_question(): passage = generate_reading_passage(QuestionType.READING_PASSAGE_3, topic) app.logger.info("Generated passage: " + str(passage)) start_id = 27 - exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id) + exercises = generate_reading_exercises(passage["text"], req_exercises, number_of_exercises_q, start_id, difficulty) return { "exercises": exercises, "text": { "content": passage["text"], "title": passage["title"] - } + }, + "difficulty": difficulty } except Exception as e: return str(e) diff --git a/helper/constants.py b/helper/constants.py index d743b56..455a882 100644 --- a/helper/constants.py +++ b/helper/constants.py @@ -106,6 +106,8 @@ FEMALE_VOICES = [item for item in ALL_VOICES if item.get('Gender') == 'Female'] MALE_NEURAL_VOICES = [item for item in ALL_NEURAL_VOICES if item.get('Gender') == 'Male'] FEMALE_NEURAL_VOICES = [item for item in ALL_NEURAL_VOICES if item.get('Gender') == 'Female'] +difficulties = ["easy", "medium", "hard"] + topics = [ "Art and Creativity", "History of Ancient Civilizations", diff --git a/helper/exercises.py b/helper/exercises.py index 8112950..7b58abc 100644 --- a/helper/exercises.py +++ b/helper/exercises.py @@ -292,25 +292,25 @@ def generate_listening_4_monologue(topic: str): return response -def generate_reading_exercises(passage: str, req_exercises: list, number_of_exercises_q, start_id): +def generate_reading_exercises(passage: str, req_exercises: list, number_of_exercises_q, start_id, difficulty): exercises = [] for req_exercise in req_exercises: number_of_exercises = number_of_exercises_q.get() if req_exercise == "multipleChoice": - question = gen_multiple_choice_exercise(passage, number_of_exercises, start_id) + question = gen_multiple_choice_exercise(passage, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added multiple choice: " + str(question)) elif req_exercise == "fillBlanks": - question = gen_summary_fill_blanks_exercise(passage, number_of_exercises, start_id) + question = gen_summary_fill_blanks_exercise(passage, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added fill blanks: " + str(question)) elif req_exercise == "trueFalse": - question = gen_true_false_not_given_exercise(passage, number_of_exercises, start_id) + question = gen_true_false_not_given_exercise(passage, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added trueFalse: " + str(question)) elif req_exercise == "writeBlanks": - question = gen_write_blanks_exercise(passage, number_of_exercises, start_id) + question = gen_write_blanks_exercise(passage, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added write blanks: " + str(question)) @@ -319,28 +319,28 @@ def generate_reading_exercises(passage: str, req_exercises: list, number_of_exer return exercises -def generate_listening_conversation_exercises(conversation: str, req_exercises: list, number_of_exercises_q, start_id): +def generate_listening_conversation_exercises(conversation: str, req_exercises: list, number_of_exercises_q, start_id, difficulty): exercises = [] for req_exercise in req_exercises: number_of_exercises = number_of_exercises_q.get() if req_exercise == "multipleChoice": - question = gen_multiple_choice_exercise_listening_conversation(conversation, number_of_exercises, start_id) + question = gen_multiple_choice_exercise_listening_conversation(conversation, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added multiple choice: " + str(question)) elif req_exercise == "writeBlanksQuestions": question = gen_write_blanks_questions_exercise_listening_conversation(conversation, number_of_exercises, - start_id) + start_id, difficulty) exercises.append(question) print("Added write blanks questions: " + str(question)) elif req_exercise == "writeBlanksFill": question = gen_write_blanks_notes_exercise_listening_conversation(conversation, number_of_exercises, - start_id) + start_id, difficulty) exercises.append(question) print("Added write blanks notes: " + str(question)) elif req_exercise == "writeBlanksForm": question = gen_write_blanks_form_exercise_listening_conversation(conversation, number_of_exercises, - start_id) + start_id, difficulty) exercises.append(question) print("Added write blanks form: " + str(question)) @@ -349,25 +349,25 @@ def generate_listening_conversation_exercises(conversation: str, req_exercises: return exercises -def generate_listening_monologue_exercises(monologue: str, req_exercises: list, number_of_exercises_q, start_id): +def generate_listening_monologue_exercises(monologue: str, req_exercises: list, number_of_exercises_q, start_id, difficulty): exercises = [] for req_exercise in req_exercises: number_of_exercises = number_of_exercises_q.get() if req_exercise == "multipleChoice": - question = gen_multiple_choice_exercise_listening_monologue(monologue, number_of_exercises, start_id) + question = gen_multiple_choice_exercise_listening_monologue(monologue, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added multiple choice: " + str(question)) elif req_exercise == "writeBlanksQuestions": - question = gen_write_blanks_questions_exercise_listening_monologue(monologue, number_of_exercises, start_id) + question = gen_write_blanks_questions_exercise_listening_monologue(monologue, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added write blanks questions: " + str(question)) elif req_exercise == "writeBlanksFill": - question = gen_write_blanks_notes_exercise_listening_monologue(monologue, number_of_exercises, start_id) + question = gen_write_blanks_notes_exercise_listening_monologue(monologue, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added write blanks notes: " + str(question)) elif req_exercise == "writeBlanksForm": - question = gen_write_blanks_form_exercise_listening_monologue(monologue, number_of_exercises, start_id) + question = gen_write_blanks_form_exercise_listening_monologue(monologue, number_of_exercises, start_id, difficulty) exercises.append(question) print("Added write blanks form: " + str(question)) @@ -376,8 +376,8 @@ def generate_listening_monologue_exercises(monologue: str, req_exercises: list, return exercises -def gen_multiple_choice_exercise(text: str, quantity: int, start_id): - gen_multiple_choice_for_text = "Generate " + str(quantity) + " multiple choice questions for this text: " \ +def gen_multiple_choice_exercise(text: str, quantity: int, start_id, difficulty): + gen_multiple_choice_for_text = "Generate " + str(quantity) + " " + difficulty + " difficulty multiple choice questions for this text: " \ "'" + text + "'\n" \ "Use this format: \"questions\": [{\"id\": \"9\", \"options\": [{\"id\": \"A\", \"text\": " \ "\"Economic benefits\"}, {\"id\": \"B\", \"text\": \"Government regulations\"}, {\"id\": \"C\", \"text\": " \ @@ -405,7 +405,7 @@ def gen_multiple_choice_exercise(text: str, quantity: int, start_id): } -def gen_summary_fill_blanks_exercise(text: str, quantity: int, start_id): +def gen_summary_fill_blanks_exercise(text: str, quantity: int, start_id, difficulty): gen_summary_for_text = "Summarize this text: " + text token_count = count_tokens(gen_summary_for_text)["n_tokens"] text_summary = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_summary_for_text, token_count, @@ -413,7 +413,7 @@ def gen_summary_fill_blanks_exercise(text: str, quantity: int, start_id): GEN_QUESTION_TEMPERATURE) gen_words_to_replace = "Select " + str( - quantity) + " words, it must be words and not expressions, from the summary and respond in this " \ + quantity) + " " + difficulty + " difficulty words, it must be words and not expressions, from the summary and respond in this " \ "JSON format: { \"words\": [\"word_1\", \"word_2\"] }. The summary is: " + text_summary token_count = count_tokens(gen_words_to_replace)["n_tokens"] words_to_replace = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_words_to_replace, token_count, @@ -437,9 +437,9 @@ def gen_summary_fill_blanks_exercise(text: str, quantity: int, start_id): } -def gen_true_false_not_given_exercise(text: str, quantity: int, start_id): +def gen_true_false_not_given_exercise(text: str, quantity: int, start_id, difficulty): gen_true_false_not_given = "Generate " + str( - quantity) + " statements in JSON format (True, False, or Not Given) " \ + quantity) + " " + difficulty + " difficulty statements in JSON format (True, False, or Not Given) " \ "based on the provided text. Ensure that your statements " \ "accurately represent information or inferences from the " \ "text, and provide a variety of responses, including, at least one of each True, " \ @@ -466,8 +466,8 @@ def gen_true_false_not_given_exercise(text: str, quantity: int, start_id): } -def gen_write_blanks_exercise(text: str, quantity: int, start_id): - gen_short_answer_questions = "Generate " + str(quantity) + " short answer questions, and the possible answers " \ +def gen_write_blanks_exercise(text: str, quantity: int, start_id, difficulty): + gen_short_answer_questions = "Generate " + str(quantity) + " " + difficulty + " difficulty short answer questions, and the possible answers " \ "(max 3 words per answer), about this text: '" + text + "'. " \ "Provide your answer in this JSON format: {\"questions\": [{\"question\": question, " \ "\"possible_answers\": [\"answer_1\", \"answer_2\"]}]}" @@ -487,9 +487,9 @@ def gen_write_blanks_exercise(text: str, quantity: int, start_id): } -def gen_multiple_choice_exercise_listening_conversation(text: str, quantity: int, start_id): +def gen_multiple_choice_exercise_listening_conversation(text: str, quantity: int, start_id, difficulty): gen_multiple_choice_for_text = "Generate " + str( - quantity) + " multiple choice questions of 4 options for this conversation: " \ + quantity) + " " + difficulty + " difficulty multiple choice questions of 4 options of for this conversation: " \ "'" + text + "'" token_count = count_tokens(gen_multiple_choice_for_text)["n_tokens"] mc_questions = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_multiple_choice_for_text, token_count, @@ -512,8 +512,8 @@ def gen_multiple_choice_exercise_listening_conversation(text: str, quantity: int } -def gen_multiple_choice_exercise_listening_monologue(text: str, quantity: int, start_id): - gen_multiple_choice_for_text = "Generate " + str(quantity) + " multiple choice questions for this monologue: " \ +def gen_multiple_choice_exercise_listening_monologue(text: str, quantity: int, start_id, difficulty): + gen_multiple_choice_for_text = "Generate " + str(quantity) + " " + difficulty + " difficulty multiple choice questions for this monologue: " \ "'" + text + "'" token_count = count_tokens(gen_multiple_choice_for_text)["n_tokens"] mc_questions = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_multiple_choice_for_text, token_count, @@ -536,8 +536,8 @@ def gen_multiple_choice_exercise_listening_monologue(text: str, quantity: int, s } -def gen_write_blanks_questions_exercise_listening_conversation(text: str, quantity: int, start_id): - gen_write_blanks_questions = "Generate " + str(quantity) + " short answer questions, and the possible answers " \ +def gen_write_blanks_questions_exercise_listening_conversation(text: str, quantity: int, start_id, difficulty): + gen_write_blanks_questions = "Generate " + str(quantity) + " " + difficulty + " difficulty short answer questions, and the possible answers " \ "(max 3 words per answer), about a monologue and" \ "respond in this JSON format: {\"questions\": [{\"question\": question, " \ "\"possible_answers\": [\"answer_1\", \"answer_2\"]}]}." \ @@ -558,8 +558,8 @@ def gen_write_blanks_questions_exercise_listening_conversation(text: str, quanti } -def gen_write_blanks_questions_exercise_listening_monologue(text: str, quantity: int, start_id): - gen_write_blanks_questions = "Generate " + str(quantity) + " short answer questions, and the possible answers " \ +def gen_write_blanks_questions_exercise_listening_monologue(text: str, quantity: int, start_id, difficulty): + gen_write_blanks_questions = "Generate " + str(quantity) + " " + difficulty + " difficulty short answer questions, and the possible answers " \ "(max 3 words per answer), about a monologue and" \ "respond in this JSON format: {\"questions\": [{\"question\": question, " \ "\"possible_answers\": [\"answer_1\", \"answer_2\"]}]}." \ @@ -580,8 +580,8 @@ def gen_write_blanks_questions_exercise_listening_monologue(text: str, quantity: } -def gen_write_blanks_notes_exercise_listening_conversation(text: str, quantity: int, start_id): - gen_write_blanks_notes = "Generate " + str(quantity) + " notes taken from the conversation and and respond in this " \ +def gen_write_blanks_notes_exercise_listening_conversation(text: str, quantity: int, start_id, difficulty): + gen_write_blanks_notes = "Generate " + str(quantity) + " " + difficulty + " difficulty notes taken from the conversation and and respond in this " \ "JSON format: { \"notes\": [\"note_1\", \"note_2\"] }. The monologue is this: '" + text + "'" token_count = count_tokens(gen_write_blanks_notes)["n_tokens"] @@ -605,8 +605,8 @@ def gen_write_blanks_notes_exercise_listening_conversation(text: str, quantity: } -def gen_write_blanks_notes_exercise_listening_monologue(text: str, quantity: int, start_id): - gen_write_blanks_notes = "Generate " + str(quantity) + " notes taken from the monologue and and respond in this " \ +def gen_write_blanks_notes_exercise_listening_monologue(text: str, quantity: int, start_id, difficulty): + gen_write_blanks_notes = "Generate " + str(quantity) + " " + difficulty + " difficulty notes taken from the monologue and respond in this " \ "JSON format: { \"notes\": [\"note_1\", \"note_2\"] }. The monologue is this: '" + text + "'" token_count = count_tokens(gen_write_blanks_notes)["n_tokens"] @@ -630,8 +630,8 @@ def gen_write_blanks_notes_exercise_listening_monologue(text: str, quantity: int } -def gen_write_blanks_form_exercise_listening_conversation(text: str, quantity: int, start_id): - gen_write_blanks_form = "Generate a form with " + str(quantity) + " key-value pairs about the conversation. " \ +def gen_write_blanks_form_exercise_listening_conversation(text: str, quantity: int, start_id, difficulty): + gen_write_blanks_form = "Generate a form with " + str(quantity) + " " + difficulty + " difficulty key-value pairs about the conversation. " \ "The conversation is this: '" + text + "'" token_count = count_tokens(gen_write_blanks_form)["n_tokens"] form = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_write_blanks_form, token_count, @@ -653,8 +653,8 @@ def gen_write_blanks_form_exercise_listening_conversation(text: str, quantity: i } -def gen_write_blanks_form_exercise_listening_monologue(text: str, quantity: int, start_id): - gen_write_blanks_form = "Generate a form with " + str(quantity) + " key-value pairs about the monologue. " \ +def gen_write_blanks_form_exercise_listening_monologue(text: str, quantity: int, start_id, difficulty): + gen_write_blanks_form = "Generate a form with " + str(quantity) + " " + difficulty + " difficulty key-value pairs about the monologue. " \ "The monologue is this: '" + text + "'" token_count = count_tokens(gen_write_blanks_form)["n_tokens"] form = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_write_blanks_form, token_count,