mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user