Make agbenchmark a proxy of the evaluated agent (#5279)

Make agbenchmark a Proxy of the evaluated agent

Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
This commit is contained in:
merwanehamadi
2023-09-20 16:06:00 -07:00
committed by GitHub
parent 1a471b73cd
commit ff4c76ba00
71 changed files with 2459 additions and 1297 deletions

View File

@@ -60,19 +60,23 @@ async def run_api_agent(
api_instance, artifacts_location, task_id, "artifacts_out"
)
artifacts = await api_instance.list_agent_task_artifacts(task_id=task_id)
for artifact in artifacts.artifacts:
# current absolute path of the directory of the file
directory_location = TEMP_FOLDER_ABS_PATH
if artifact.relative_path:
directory_location = directory_location / artifact.relative_path
await copy_agent_artifacts_into_temp_folder(api_instance, task_id)
with open(directory_location / artifact.file_name, "wb") as f:
content = await api_instance.download_agent_task_artifact(
task_id=task_id, artifact_id=artifact.artifact_id
)
f.write(content)
async def copy_agent_artifacts_into_temp_folder(api_instance, task_id):
artifacts = await api_instance.list_agent_task_artifacts(task_id=task_id)
for artifact in artifacts.artifacts:
# current absolute path of the directory of the file
directory_location = TEMP_FOLDER_ABS_PATH
if artifact.relative_path:
directory_location = directory_location / artifact.relative_path
with open(directory_location / artifact.file_name, "wb") as f:
content = await api_instance.download_agent_task_artifact(
task_id=task_id, artifact_id=artifact.artifact_id
)
f.write(content)
async def append_updates_file(step: Step):