diff options
Diffstat (limited to 'benchmark/agbenchmark/agent_interface.py')
-rw-r--r-- | benchmark/agbenchmark/agent_interface.py | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/benchmark/agbenchmark/agent_interface.py b/benchmark/agbenchmark/agent_interface.py index 269e8f8ff..52bd2093c 100644 --- a/benchmark/agbenchmark/agent_interface.py +++ b/benchmark/agbenchmark/agent_interface.py @@ -1,45 +1,27 @@ import os import shutil -import sys -from typing import List +from pathlib import Path from dotenv import load_dotenv -from agbenchmark.execute_sub_process import execute_subprocess - load_dotenv() -helicone_graphql_logs = os.getenv("HELICONE_GRAPHQL_LOGS") -HELICONE_GRAPHQL_LOGS = ( - helicone_graphql_logs.lower() == "true" if helicone_graphql_logs else False -) - - -def run_agent(task: str, timeout: int) -> None: - print(f"Running agbenchmark/benchmarks.py with timeout {timeout}") - - command = [sys.executable, "-m", "agbenchmark_config.benchmarks", str(task)] - - execute_subprocess(command, timeout) +HELICONE_GRAPHQL_LOGS = os.getenv("HELICONE_GRAPHQL_LOGS", "").lower() == "true" def get_list_of_file_paths( - challenge_dir_path: str, artifact_folder_name: str -) -> List[str]: - # this file is at agbenchmark\agent_interface.py - source_dir = os.path.join( - challenge_dir_path, - artifact_folder_name, - ) - if not os.path.exists(source_dir): + challenge_dir_path: str | Path, artifact_folder_name: str +) -> list[Path]: + source_dir = Path(challenge_dir_path) / artifact_folder_name + if not source_dir.exists(): return [] - return [os.path.join(source_dir, file_name) for file_name in os.listdir(source_dir)] + return list(source_dir.iterdir()) -def copy_artifacts_into_temp_folder( - workspace: str | dict[str, str], artifact_folder_name: str, challenge_dir_path: str +def copy_challenge_artifacts_into_workspace( + challenge_dir_path: str | Path, artifact_folder_name: str, workspace: str | Path ) -> None: file_paths = get_list_of_file_paths(challenge_dir_path, artifact_folder_name) for file_path in file_paths: - if os.path.isfile(file_path): + if file_path.is_file(): shutil.copy(file_path, workspace) |