This commit is contained in:
Ayush Maniar 2025-03-23 14:23:14 -07:00
commit cc3c6d8677
3 changed files with 1970 additions and 11 deletions

View file

@ -56,8 +56,13 @@ def analyze_json_file(file_path):
if 'turns' in data and isinstance(data['turns'], list):
for turn in reversed(data['turns']): # Check turns from the end
if turn.get('role') == 'system' and isinstance(turn.get('content'), str):
if "Task successful ended with code : 2" in turn['content'] or "Task ended with score : 1" in turn["content"] or "Task ended in score: 1" in turn["content"]:
code = turn["content"].split(":")[-1].strip()
if code in ["2", "1"]: # Check for success codes
return True
elif 0 < float(code) < 1: # Check for other success indicators
return code
else:
return False
return False
except FileNotFoundError:
print(f"Error: File not found: {file_path}")
@ -105,7 +110,7 @@ def aggregate_results(local_folders):
result = extract_result(folder_path)
if result is not None:
total += 1
successful += int(result)
successful += float(result)
except Exception as e:
print(f"Error processing {folder_name}: {e}")
@ -554,9 +559,9 @@ def delete_server_files(dest_path):
print(f"Error deleting server files: {e}")
if not os.path.exists(dest_path):
print("Server files deleted successfully.")
else:
print("Error deleting server files.")
delete_server_files(dest_path)
# else:
# print("Error deleting server files.")
# delete_server_files(dest_path)
def launch_world(server_path="./server_data/", agent_names=["andy", "jill"], session_name="server", port=55916):

View file

@ -47,13 +47,19 @@ export function resetConstructionWorld(bot, blueprint) {
export function checkLevelBlueprint(agent, levelNum) {
const blueprint = agent.task.blueprint;
const bot = agent.bot;
const result = blueprint.checkLevel(bot, levelNum);
if (result.mismatches.length === 0) {
return `Level ${levelNum} is correct`;
} else {
let explanation = blueprint.explainLevelDifference(bot, levelNum);
return explanation;
try {
const result = blueprint.checkLevel(bot, levelNum);
if (result.mismatches.length === 0) {
return `Level ${levelNum} is correct`;
} else {
let explanation = blueprint.explainLevelDifference(bot, levelNum);
return explanation;
}
} catch (error) {
console.error('Error checking level blueprint:', error);
return `Error checking level ${levelNum}: ${error.message}`;
}
}
export function checkBlueprint(agent) {
@ -158,6 +164,9 @@ export class Blueprint {
}
checkLevel(bot, levelNum) {
const levelData = this.data.levels[levelNum];
if (!levelData) {
throw new Error(`Level ${levelNum} does not exist in the blueprint.`);
}
const startCoords = levelData.coordinates;
const placement = levelData.placement;
const mismatches = [];

File diff suppressed because it is too large Load diff