Add eval_id and sync Skill Tree with Frontend(#5287)

Add eval_id to skill tree

Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
This commit is contained in:
merwanehamadi
2023-09-21 13:36:17 -07:00
committed by GitHub
parent 295787c948
commit f4e7b1c61c
63 changed files with 2010 additions and 792 deletions

View File

@@ -1,4 +1,5 @@
# radio charts, logs, helper functions for tests, anything else relevant.
import json
import os
import re
from pathlib import Path
@@ -131,23 +132,20 @@ def agent_eligibible_for_optional_categories(
return True
def find_absolute_benchmark_path() -> Path:
# Find the absolute path to the current working directory
current_path = Path.cwd()
def write_pretty_json(data, json_file):
sorted_data = deep_sort(data)
json_graph = json.dumps(sorted_data, indent=4)
with open(json_file, "w") as f:
f.write(json_graph)
f.write("\n")
# Find the position of "Auto-GPT-Benchmarks" in the path
benchmark_path_index = (
current_path.parts.index("Auto-GPT-Benchmarks")
if "Auto-GPT-Benchmarks" in current_path.parts
else None
)
if benchmark_path_index is not None:
# Construct the absolute path starting from "Auto-GPT-Benchmarks"
benchmark_path = Path(*current_path.parts[: benchmark_path_index + 1])
return benchmark_path
else:
raise ValueError(
"The directory 'Auto-GPT-Benchmarks' is not found in the current path."
)
def deep_sort(obj):
"""
Recursively sort the keys in JSON object
"""
if isinstance(obj, dict):
return {k: deep_sort(v) for k, v in sorted(obj.items())}
if isinstance(obj, list):
return [deep_sort(elem) for elem in obj]
return obj