mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-10 07:18:10 -05:00
eval: improve swebench infer error handling and retry (#4205)
This commit is contained in:
@@ -86,6 +86,10 @@ class EvalOutput(BaseModel):
|
||||
return json.dumps(dumped_dict)
|
||||
|
||||
|
||||
class EvalException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def codeact_user_response(
|
||||
state: State,
|
||||
encapsulate_solution: bool = False,
|
||||
@@ -252,6 +256,15 @@ def update_progress(
|
||||
output_fp.flush()
|
||||
|
||||
|
||||
def assert_and_raise(condition: bool, msg: str):
|
||||
"""Raise an EvalException if the condition is not met.
|
||||
|
||||
This will be used in conjunction with _process_instance_wrapper to handle retries. An EvalException should trigger a retry.
|
||||
"""
|
||||
if not condition:
|
||||
raise EvalException(msg)
|
||||
|
||||
|
||||
def _process_instance_wrapper(
|
||||
process_instance_func: Callable[[pd.Series, EvalMetadata, bool], EvalOutput],
|
||||
instance: pd.Series,
|
||||
|
||||
Reference in New Issue
Block a user