ENCOA-256: Some more changes to level prompt and added mc to reading
This commit is contained in:
@@ -35,7 +35,7 @@ class UploadLevelModule:
|
||||
#completion: Coroutine[Any, Any, Exam] = (
|
||||
# self._png_completion(path_id) if file_has_images else self._html_completion(path_id)
|
||||
#)
|
||||
response = await self._html_completion(path_id)
|
||||
response = await self._html_completion(path_id, solutions is not None)
|
||||
|
||||
FileHelper.remove_directory(f'./tmp/{path_id}')
|
||||
|
||||
@@ -69,16 +69,26 @@ class UploadLevelModule:
|
||||
]
|
||||
}
|
||||
|
||||
async def _html_completion(self, path_id: str) -> Exam:
|
||||
async def _html_completion(self, path_id: str, solutions_provided: bool) -> Exam:
|
||||
async with aiofiles.open(f'./tmp/{path_id}/exercises.html', 'r', encoding='utf-8') as f:
|
||||
html = await f.read()
|
||||
|
||||
solutions = []
|
||||
if solutions_provided:
|
||||
async with aiofiles.open(f'./tmp/{path_id}/solutions.html', 'r', encoding='utf-8') as f:
|
||||
solutions_html = await f.read()
|
||||
solutions.append({
|
||||
"role": "user",
|
||||
"content": f'The solutions to the question sheet are the following:\n\n{solutions_html}'
|
||||
})
|
||||
|
||||
return await self._llm.pydantic_prediction(
|
||||
[self._gpt_instructions_html(),
|
||||
{
|
||||
"role": "user",
|
||||
"content": html
|
||||
}
|
||||
},
|
||||
*solutions
|
||||
],
|
||||
LevelMapper.map_to_exam_model,
|
||||
str(self._level_json_schema())
|
||||
@@ -122,8 +132,10 @@ class UploadLevelModule:
|
||||
|
||||
'IMPORTANT: As stated earlier your job is to structure the questions into PARTS not SECTION, this means '
|
||||
'that if there is for example: Section 1, Part 1 and Part 2, Section 2, Part 1 and Part 2, you MUST '
|
||||
'place in the parts array 4 parts NOT 2 parts with the exercises of both parts! You must strictly '
|
||||
'adhere to this instruction, do not mistake sections for parts!\n'
|
||||
'place in the parts array 4 parts NOT 2 parts with the exercises of both parts! If there are no sections '
|
||||
'and only Parts then group them by parts, and when I say parts I mean it in the fucking literal sense of the'
|
||||
' word Part x which is in the html. '
|
||||
'You must strictly adhere to this instruction, do not mistake sections for parts!\n'
|
||||
|
||||
'The templates for the exercises are the following:\n'
|
||||
'- blank space multiple choice, underline multiple choice and reading passage multiple choice: '
|
||||
@@ -164,17 +176,17 @@ class UploadLevelModule:
|
||||
"prompt": "Click a blank to select the appropriate word for it.",
|
||||
"text": (
|
||||
"<The whole text for the exercise with replacements for blank spaces and their "
|
||||
"ids with {{<question id>}} with 2 newlines between paragraphs>"
|
||||
"ids with {{<question id/number>}} with 2 newlines between paragraphs>"
|
||||
),
|
||||
"solutions": [
|
||||
{
|
||||
"id": "<question id>",
|
||||
"id": "<question number>",
|
||||
"solution": "<the option that holds the solution>"
|
||||
}
|
||||
],
|
||||
"words": [
|
||||
{
|
||||
"id": "<question id>",
|
||||
"id": "<question number>",
|
||||
"options": {
|
||||
"A": "<a option>",
|
||||
"B": "<b option>",
|
||||
@@ -198,7 +210,7 @@ class UploadLevelModule:
|
||||
self._multiple_choice_png(),
|
||||
{"type": "blanksPassage", "text": (
|
||||
"<The whole text for the exercise with replacements for blank spaces and their "
|
||||
"ids with {{<question id>}} with 2 newlines between paragraphs>"
|
||||
"ids with {{<question number>}} with 2 newlines between paragraphs>"
|
||||
)},
|
||||
{"type": "passage", "context": (
|
||||
"<reading passages without paragraphs or line numbers, with 2 newlines between paragraphs>"
|
||||
|
||||
Reference in New Issue
Block a user