ENCOA-274 and patch to the Dockerfile, in some merge the firebase tools were left out
This commit is contained in:
@@ -55,10 +55,8 @@ class WritingService(IWritingService):
|
||||
*(await get_writing_args_academic(task, file))
|
||||
]
|
||||
|
||||
llm_model = GPTModels.GPT_3_5_TURBO if task == 1 else GPTModels.GPT_4_O
|
||||
|
||||
response = await self._llm.prediction(
|
||||
llm_model,
|
||||
GPTModels.GPT_4_O,
|
||||
messages,
|
||||
["prompt"],
|
||||
TemperatureSettings.GEN_QUESTION_TEMPERATURE
|
||||
|
||||
@@ -25,6 +25,9 @@ async def get_writing_args_academic(task: int, attachment: UploadFile) -> List[D
|
||||
if task == 2:
|
||||
raise NotImplemented("Task 2 academic isn't implemented yet, current implementation still uses General Task 2 prompts.")
|
||||
|
||||
attachment_bytes = await attachment.read()
|
||||
|
||||
|
||||
messages = [
|
||||
{
|
||||
"role": "user",
|
||||
@@ -32,17 +35,19 @@ async def get_writing_args_academic(task: int, attachment: UploadFile) -> List[D
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": writing_args[str(task)]["instructions"]
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": writing_args[str(task)]["instructions"],
|
||||
},
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": f"data:image/{attachment.filename.split('.')[-1]};base64,{b64encode(attachment_bytes).decode('utf-8')}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
if task == 1:
|
||||
attachment_bytes = await attachment.read()
|
||||
messages.append({
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": f"data:image/{attachment.filename.split('.')[-1]};base64,{b64encode(attachment_bytes).decode('utf-8')}"
|
||||
}
|
||||
})
|
||||
|
||||
return messages
|
||||
|
||||
@@ -57,14 +57,17 @@ class GradeWriting:
|
||||
name = attachment.split('/')[-1]
|
||||
out_path = f'./tmp/{uuid}/{name}'
|
||||
path = await self._file_storage.download_firebase_file(attachment, out_path)
|
||||
messages.append({
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": f"data:image/{name.split('.')[-1]};base64,{FileHelper.encode_image(path)}"
|
||||
messages.append(
|
||||
{
|
||||
"role": "user",
|
||||
"content": {
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": f"data:image/{name.split('.')[-1]};base64,{FileHelper.encode_image(path)}"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
llm_model = GPTModels.GPT_3_5_TURBO if task == 1 else GPTModels.GPT_4_O
|
||||
temperature = (
|
||||
TemperatureSettings.GRADING_TEMPERATURE
|
||||
if task == 1 else
|
||||
@@ -72,7 +75,7 @@ class GradeWriting:
|
||||
)
|
||||
|
||||
evaluation_promise = self._llm.prediction(
|
||||
llm_model,
|
||||
GPTModels.GPT_4_O,
|
||||
messages,
|
||||
["comment"],
|
||||
temperature
|
||||
|
||||
Reference in New Issue
Block a user