Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Enhance SkillTreeViewModel with Benchmark Runs Tracking and Leaderboard Submission

hunteraraujoe4d84dad0a33
diff --git a/frontend/lib/viewmodels/skill_tree_viewmodel.dart b/frontend/lib/viewmodels/skill_tree_viewmodel.dart
index f5b091d666..1b9b1efd8e 100644
--- a/frontend/lib/viewmodels/skill_tree_viewmodel.dart
+++ b/frontend/lib/viewmodels/skill_tree_viewmodel.dart
@@ -17,6 +17,7 @@ import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:graphview/GraphView.dart';
+import 'package:uuid/uuid.dart';
class SkillTreeViewModel extends ChangeNotifier {
// TODO: Potentially move to task queue view model when we create one
@@ -26,8 +27,11 @@ class SkillTreeViewModel extends ChangeNotifier {
// TODO: Potentially move to task queue view model when we create one
bool isBenchmarkRunning = false;
// TODO: Potentially move to task queue view model when we create one
+ // TODO: clear when clicking a new node
Map<SkillTreeNode, BenchmarkTaskStatus> benchmarkStatusMap = {};
+ List<BenchmarkRun> currentBenchmarkRuns = [];
+
List<SkillTreeNode> _skillTreeNodes = [];
List<SkillTreeEdge> _skillTreeEdges = [];
SkillTreeNode? _selectedNode;
@@ -156,6 +160,9 @@ class SkillTreeViewModel extends ChangeNotifier {
// Clear the benchmarkStatusList
benchmarkStatusMap.clear();
+ // Reset the current benchmark runs list to be empty at the start of a new benchmark
+ currentBenchmarkRuns = [];
+
// Create a new TestSuite object with the current timestamp
final testSuite =
TestSuite(timestamp: DateTime.now().toIso8601String(), tests: []);
@@ -215,11 +222,15 @@ class SkillTreeViewModel extends ChangeNotifier {
// Decode the evaluationResponse into a BenchmarkRun object
BenchmarkRun benchmarkRun = BenchmarkRun.fromJson(evaluationResponse);
+ // Add the benchmark run object to the list of current benchmark runs
+ currentBenchmarkRuns.add(benchmarkRun);
+
// Update the benchmarkStatusList based on the evaluation response
bool successStatus = benchmarkRun.metrics.success;
benchmarkStatusMap[node] = successStatus
? BenchmarkTaskStatus.success
: BenchmarkTaskStatus.failure;
+ // await Future.delayed(Duration(seconds: 2));
notifyListeners();
// If successStatus is false, break out of the loop
@@ -243,5 +254,21 @@ class SkillTreeViewModel extends ChangeNotifier {
}
// TODO: Move to task queue view model
- Future<void> submitToLeaderboard() async {}
+ Future<void> submitToLeaderboard(
+ String teamName, String repoUrl, String agentGitCommitSha) async {
+ // Create a UUID.v4 for our unique run ID
+ String uuid = const Uuid().v4();
+
+ for (var run in currentBenchmarkRuns) {
+ run.repositoryInfo.teamName = teamName;
+ run.repositoryInfo.repoUrl = repoUrl;
+ run.repositoryInfo.agentGitCommitSha = agentGitCommitSha;
+ run.runDetails.runId = uuid;
+
+ await leaderboardService.submitReport(run);
+ }
+
+ // Clear the currentBenchmarkRuns list after submitting to the leaderboard
+ currentBenchmarkRuns.clear();
+ }
}