Updated it to use GPT-4
This commit is contained in:
@@ -10,6 +10,7 @@ GEN_QUESTION_TEMPERATURE = 0.7
|
|||||||
GPT_3_5_TURBO = "gpt-3.5-turbo"
|
GPT_3_5_TURBO = "gpt-3.5-turbo"
|
||||||
GPT_3_5_TURBO_16K = "gpt-3.5-turbo-16k"
|
GPT_3_5_TURBO_16K = "gpt-3.5-turbo-16k"
|
||||||
GPT_3_5_TURBO_INSTRUCT = "gpt-3.5-turbo-instruct"
|
GPT_3_5_TURBO_INSTRUCT = "gpt-3.5-turbo-instruct"
|
||||||
|
GPT_4 = "gpt-4"
|
||||||
|
|
||||||
GRADING_FIELDS = ['comment', 'overall', 'task_response']
|
GRADING_FIELDS = ['comment', 'overall', 'task_response']
|
||||||
GEN_FIELDS = ['topic']
|
GEN_FIELDS = ['topic']
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ def gen_multiple_choice_level(quantity: int, start_id=1):
|
|||||||
"questions and some advanced questions. Ensure that the questions cover a range of topics such as " \
|
"questions and some advanced questions. Ensure that the questions cover a range of topics such as " \
|
||||||
"verb tense, subject-verb agreement, pronoun usage, sentence structure, and punctuation."
|
"verb tense, subject-verb agreement, pronoun usage, sentence structure, and punctuation."
|
||||||
token_count = count_tokens(gen_multiple_choice_for_text)["n_tokens"] - 300
|
token_count = count_tokens(gen_multiple_choice_for_text)["n_tokens"] - 300
|
||||||
mc_questions = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_multiple_choice_for_text, token_count,
|
mc_questions = make_openai_instruct_call(GPT_4, gen_multiple_choice_for_text, token_count,
|
||||||
None,
|
None,
|
||||||
GEN_QUESTION_TEMPERATURE)
|
GEN_QUESTION_TEMPERATURE)
|
||||||
split_mc_questions = mc_questions.split('13')
|
split_mc_questions = mc_questions.split('13')
|
||||||
@@ -687,8 +687,8 @@ def gen_multiple_choice_level(quantity: int, start_id=1):
|
|||||||
'"prompt": "Which of the following is a conjunction?", '
|
'"prompt": "Which of the following is a conjunction?", '
|
||||||
'"solution": "A", "variant": "text"}]}. '
|
'"solution": "A", "variant": "text"}]}. '
|
||||||
'\nThe questions: "' + split_mc_questions[0] + '"')
|
'\nThe questions: "' + split_mc_questions[0] + '"')
|
||||||
token_count = count_tokens(parse_mc_questions, model_name=GPT_3_5_TURBO_INSTRUCT)["n_tokens"]
|
token_count = count_tokens(parse_mc_questions, model_name=GPT_4)["n_tokens"]
|
||||||
question = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, parse_mc_questions, token_count,
|
question = make_openai_instruct_call(GPT_4, parse_mc_questions, token_count,
|
||||||
["questions"],
|
["questions"],
|
||||||
GEN_QUESTION_TEMPERATURE)
|
GEN_QUESTION_TEMPERATURE)
|
||||||
parse_mc_questions = ('Parse the questions into this json format: {"questions": [{"id": "9", "options": '
|
parse_mc_questions = ('Parse the questions into this json format: {"questions": [{"id": "9", "options": '
|
||||||
@@ -698,8 +698,8 @@ def gen_multiple_choice_level(quantity: int, start_id=1):
|
|||||||
'"prompt": "Which of the following is a conjunction?", '
|
'"prompt": "Which of the following is a conjunction?", '
|
||||||
'"solution": "A", "variant": "text"}]}. '
|
'"solution": "A", "variant": "text"}]}. '
|
||||||
'\nThe questions: "' + '13' + split_mc_questions[1] + '"')
|
'\nThe questions: "' + '13' + split_mc_questions[1] + '"')
|
||||||
token_count = count_tokens(parse_mc_questions, model_name=GPT_3_5_TURBO_INSTRUCT)["n_tokens"]
|
token_count = count_tokens(parse_mc_questions, model_name=GPT_4)["n_tokens"]
|
||||||
question_2 = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, parse_mc_questions, token_count,
|
question_2 = make_openai_instruct_call(GPT_4, parse_mc_questions, token_count,
|
||||||
["questions"],
|
["questions"],
|
||||||
GEN_QUESTION_TEMPERATURE)
|
GEN_QUESTION_TEMPERATURE)
|
||||||
question["questions"].extend(question_2["questions"])
|
question["questions"].extend(question_2["questions"])
|
||||||
@@ -730,7 +730,7 @@ def generate_single_mc_level_question():
|
|||||||
gen_multiple_choice_for_text = "Generate 1 multiple choice question of 4 options for an english level exam, it can " \
|
gen_multiple_choice_for_text = "Generate 1 multiple choice question of 4 options for an english level exam, it can " \
|
||||||
"be easy, intermediate or advanced."
|
"be easy, intermediate or advanced."
|
||||||
token_count = count_tokens(gen_multiple_choice_for_text)["n_tokens"] - 300
|
token_count = count_tokens(gen_multiple_choice_for_text)["n_tokens"] - 300
|
||||||
mc_question = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, gen_multiple_choice_for_text, token_count,
|
mc_question = make_openai_instruct_call(GPT_4, gen_multiple_choice_for_text, token_count,
|
||||||
None,
|
None,
|
||||||
GEN_QUESTION_TEMPERATURE)
|
GEN_QUESTION_TEMPERATURE)
|
||||||
|
|
||||||
@@ -742,8 +742,8 @@ def generate_single_mc_level_question():
|
|||||||
'"solution": "A", "variant": "text"}. '
|
'"solution": "A", "variant": "text"}. '
|
||||||
'\nThe questions: "' + mc_question + '"')
|
'\nThe questions: "' + mc_question + '"')
|
||||||
|
|
||||||
token_count = count_tokens(parse_mc_question, model_name=GPT_3_5_TURBO_INSTRUCT)["n_tokens"]
|
token_count = count_tokens(parse_mc_question, model_name=GPT_4)["n_tokens"]
|
||||||
question = make_openai_instruct_call(GPT_3_5_TURBO_INSTRUCT, parse_mc_question, token_count,
|
question = make_openai_instruct_call(GPT_4, parse_mc_question, token_count,
|
||||||
["options"],
|
["options"],
|
||||||
GEN_QUESTION_TEMPERATURE)
|
GEN_QUESTION_TEMPERATURE)
|
||||||
return question
|
return question
|
||||||
|
|||||||
Reference in New Issue
Block a user