dismissed wrong label triggers recorrection

This commit is contained in:
sebastien committed 2026-10-23 08:51:28 +02:00
1 parent 1959c5d3bb
commit f39868207d
5 files changed
+198 -14

No files matched your search

+27 -2
View File
@@ -227,7 +227,11 @@ def generate_request(input_dir, file, full_label, *, thinking_level=settings.THI
)
]
generate_content_config = types.GenerateContentConfig(
return (contents, grading_generation_config(thinking_level))
def grading_generation_config(thinking_level):
return types.GenerateContentConfig(
automatic_function_calling=types.AutomaticFunctionCallingConfig(disable=True),
thinking_config=thinking_config(thinking_level),
seed=fresh_seed(),
@@ -235,7 +239,28 @@ def generate_request(input_dir, file, full_label, *, thinking_level=settings.THI
response_mime_type= "application/json",
response_json_schema= TypeAdapter(List[EvaluationEntry]).json_schema()
)
return (contents, generate_content_config)
def request_for_confirmed_label(input_dir, pdf_path, label, student_id):
prompt = make_prompt(input_dir, label)
prompt += f"""
Cette image contient uniquement la réponse de l'élève d'identifiant `{student_id}`.
Il n'y a pas d'en-tête imprimé à rechercher : utilise cet identifiant exact.
Une vérification indépendante a confirmé que cette réponse appartient bien
à la question `{label}`. Reprends sa correction mathématique depuis le début,
avec une nouvelle note et des commentaires précis sur les erreurs ou les étapes
manquantes. Une preuve incorrecte ou incomplète n'est pas une erreur de label.
Ne renvoie pas `wrong-label` et ne rejette pas la réponse comme hors sujet.
Les autres cas `additional-answer` et `empty-answer` restent applicables.
Renvoie une liste JSON contenant exactement un résultat, pour `{student_id}`.
Les coordonnées éventuelles portent sur l'image fournie entière.
"""
contents = [types.Content(role="user", parts=[
types.Part.from_bytes(data=get_single_image_bytes(pdf_path), mime_type="image/jpeg"),
types.Part.from_text(text=prompt),
])]
return contents, grading_generation_config(settings.THINKING_LEVEL_FLASH)
from pdf2image import convert_from_path