Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: initialize default metadata with all required fields (#6583)

Xingyao Wang90bbd4edbeaa
diff --git a/evaluation/benchmarks/swe_bench/eval_infer.py b/evaluation/benchmarks/swe_bench/eval_infer.py
index cc9dca0694..be18a36e9a 100644
--- a/evaluation/benchmarks/swe_bench/eval_infer.py
+++ b/evaluation/benchmarks/swe_bench/eval_infer.py
@@ -412,6 +412,17 @@ if __name__ == '__main__':
with open(metadata_filepath, 'r') as metadata_file:
data = metadata_file.read()
metadata = EvalMetadata.model_validate_json(data)
+ else:
+ # Initialize with a dummy metadata when file doesn't exist
+ metadata = EvalMetadata(
+ agent_class="dummy_agent", # Placeholder agent class
+ llm_config=LLMConfig(model="dummy_model"), # Minimal LLM config
+ max_iterations=1, # Minimal iterations
+ eval_output_dir=os.path.dirname(args.input_file), # Use input file dir as output dir
+ start_time=time.strftime('%Y-%m-%d %H:%M:%S'), # Current time
+ git_commit=subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip(), # Current commit
+ dataset=args.dataset # Dataset name from args
+ )
# The evaluation harness constrains the signature of `process_instance_func` but we need to
# pass extra information. Build a new function object to avoid issues with multiprocessing.