44
55import json
66from dataclasses import dataclass , field
7- from typing import Dict , Union
7+ from typing import Dict , Optional , Union
88
99
1010class EvaluatorRepairRequest (Exception ):
@@ -18,17 +18,23 @@ class EvaluatorRepairRequest(Exception):
1818 original.
1919
2020 Args:
21- message: Human-readable error description (shown in repair history
22- and logged).
23- broken_code: The full source that failed. Must be the complete file,
24- not just the error region, so the repair LLM has full
25- context.
26- repair_context: Optional extra information for the repair prompt (e.g.
27- full compiler stderr, runtime traceback). Defaults to
28- the same text as *message*.
29- language: Source-language identifier used in the prompt code fence
30- (e.g. ``"cpp"``, ``"python"``). Defaults to
31- ``"python"``.
21+ message: Human-readable error description (shown in repair history
22+ and logged).
23+ broken_code: The full source that failed. Must be the complete file,
24+ not just the error region, so the repair LLM has full
25+ context.
26+ repair_context: Optional extra information for the repair prompt (e.g.
27+ full compiler stderr, runtime traceback). Defaults to
28+ the same text as *message*.
29+ language: Source-language identifier used in the prompt code fence
30+ (e.g. ``"cpp"``, ``"python"``). Defaults to
31+ ``"python"``.
32+ fallback_metrics: Metrics dict to use if repair is disabled or all repair
33+ attempts are exhausted. Should include all feature
34+ dimensions required by the MAP-Elites database set to
35+ appropriate penalty values, plus ``combined_score: 0.0``.
36+ When ``None``, a minimal ``{"combined_score": 0.0}`` is
37+ used.
3238 """
3339
3440 def __init__ (
@@ -37,11 +43,13 @@ def __init__(
3743 broken_code : str ,
3844 repair_context : str = "" ,
3945 language : str = "python" ,
46+ fallback_metrics : Optional [Dict [str , float ]] = None ,
4047 ) -> None :
4148 super ().__init__ (message )
4249 self .broken_code = broken_code
4350 self .repair_context = repair_context or message
4451 self .language = language
52+ self .fallback_metrics : Dict [str , float ] = fallback_metrics or {"combined_score" : 0.0 }
4553
4654
4755@dataclass
0 commit comments