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.

Temporarily allow null values in benchmark data models

hunteraraujo18333fbc7c5d
diff --git a/frontend/lib/models/benchmark/benchmark_run.dart b/frontend/lib/models/benchmark/benchmark_run.dart
index 20ae8bd37f..e2af63b33e 100644
--- a/frontend/lib/models/benchmark/benchmark_run.dart
+++ b/frontend/lib/models/benchmark/benchmark_run.dart
@@ -4,6 +4,7 @@ import 'package:auto_gpt_flutter_client/models/benchmark/repository_info.dart';
import 'package:auto_gpt_flutter_client/models/benchmark/run_details.dart';
import 'package:auto_gpt_flutter_client/models/benchmark/task_info.dart';
+// TODO: Remove the ability to have null values when benchmark implementation is complete
/// `BenchmarkRun` represents a complete benchmark run and encapsulates all associated data.
///
/// This class is a comprehensive model that includes various sub-models, each corresponding to a different aspect of a benchmark run.
@@ -54,7 +55,7 @@ class BenchmarkRun {
runDetails: RunDetails.fromJson(json['run_details']),
taskInfo: TaskInfo.fromJson(json['task_info']),
metrics: Metrics.fromJson(json['metrics']),
- reachedCutoff: json['reached_cutoff'],
+ reachedCutoff: json['reached_cutoff'] ?? false,
config: Config.fromJson(json['config']),
);
diff --git a/frontend/lib/models/benchmark/config.dart b/frontend/lib/models/benchmark/config.dart
index 7b1e4bbfef..79a270d912 100644
--- a/frontend/lib/models/benchmark/config.dart
+++ b/frontend/lib/models/benchmark/config.dart
@@ -1,3 +1,4 @@
+// TODO: Remove the ability to have null values when benchmark implementation is complete
/// `Config` holds configuration settings related to the benchmark run.
///
/// It contains the path to the benchmark configuration for the agent and
@@ -27,8 +28,8 @@ class Config {
///
/// Returns a new `Config` populated with values from the map.
factory Config.fromJson(Map<String, dynamic> json) => Config(
- agentBenchmarkConfigPath: json['agent_benchmark_config_path'],
- host: json['host'],
+ agentBenchmarkConfigPath: json['agent_benchmark_config_path'] ?? "",
+ host: json['host'] ?? "",
);
/// Converts the `Config` instance to a map.
diff --git a/frontend/lib/models/benchmark/metrics.dart b/frontend/lib/models/benchmark/metrics.dart
index 3f3da440f7..b428415d35 100644
--- a/frontend/lib/models/benchmark/metrics.dart
+++ b/frontend/lib/models/benchmark/metrics.dart
@@ -1,3 +1,4 @@
+// TODO: Remove the ability to have null values when benchmark implementation is complete
/// `Metrics` holds key performance metrics related to a benchmark test run.
///
/// The class encapsulates various data points like difficulty, success rate,
@@ -45,12 +46,12 @@ class Metrics {
///
/// Returns a new `Metrics` populated with values from the map.
factory Metrics.fromJson(Map<String, dynamic> json) => Metrics(
- difficulty: json['difficulty'],
+ difficulty: json['difficulty'] ?? "",
success: json['success'],
attempted: json['attempted'],
- successPercentage: json['success_percentage'].toDouble(),
- cost: json['cost'],
- runTime: json['run_time'],
+ successPercentage: json['success_percentage'].toDouble() ?? 0.0,
+ cost: json['cost'] ?? "",
+ runTime: json['run_time'] ?? "",
);
/// Converts the `Metrics` instance to a map.
diff --git a/frontend/lib/models/benchmark/repository_info.dart b/frontend/lib/models/benchmark/repository_info.dart
index e8155a36e2..f2e607f0e1 100644
--- a/frontend/lib/models/benchmark/repository_info.dart
+++ b/frontend/lib/models/benchmark/repository_info.dart
@@ -1,3 +1,4 @@
+// TODO: Remove the ability to have null values when benchmark implementation is complete
/// `RepositoryInfo` encapsulates details about the repository and team associated with a benchmark run.
///
/// This class contains essential information like the repository URL, team name, and the Git commit SHA for both the benchmark and the agent.
@@ -33,10 +34,10 @@ class RepositoryInfo {
///
/// Returns a new `RepositoryInfo` populated with values from the map.
factory RepositoryInfo.fromJson(Map<String, dynamic> json) => RepositoryInfo(
- repoUrl: json['repo_url'],
- teamName: json['team_name'],
- benchmarkGitCommitSha: json['benchmark_git_commit_sha'],
- agentGitCommitSha: json['agent_git_commit_sha'],
+ repoUrl: json['repo_url'] ?? "",
+ teamName: json['team_name'] ?? "",
+ benchmarkGitCommitSha: json['benchmark_git_commit_sha'] ?? "",
+ agentGitCommitSha: json['agent_git_commit_sha'] ?? "",
);
/// Converts the `RepositoryInfo` instance to a map.
diff --git a/frontend/lib/models/benchmark/run_details.dart b/frontend/lib/models/benchmark/run_details.dart
index 4968653724..7b48c9391b 100644
--- a/frontend/lib/models/benchmark/run_details.dart
+++ b/frontend/lib/models/benchmark/run_details.dart
@@ -1,3 +1,4 @@
+// TODO: Remove the ability to have null values when benchmark implementation is complete
/// `RunDetails` encapsulates specific details about a benchmark run.
///
/// This class holds attributes such as the unique run identifier, the command used to initiate the run,
@@ -39,9 +40,11 @@ class RunDetails {
///
/// Returns a new `RunDetails` populated with values from the map.
factory RunDetails.fromJson(Map<String, dynamic> json) => RunDetails(
- runId: json['run_id'],
+ runId: json['run_id'] ?? "",
command: json['command'],
- completionTime: DateTime.parse(json['completion_time']),
+ completionTime: json['completion_time'] == null
+ ? DateTime.now()
+ : DateTime.parse(json['completion_time']),
benchmarkStartTime: DateTime.parse(json['benchmark_start_time']),
testName: json['test_name'],
);
diff --git a/frontend/lib/models/benchmark/task_info.dart b/frontend/lib/models/benchmark/task_info.dart
index 7e5a642e56..20c30b963d 100644
--- a/frontend/lib/models/benchmark/task_info.dart
+++ b/frontend/lib/models/benchmark/task_info.dart
@@ -1,3 +1,4 @@
+// TODO: Remove the ability to have null values when benchmark implementation is complete
/// TaskInfo holds information related to a specific benchmark task.
///
/// The class encapsulates various attributes of a task, such as the path to the data file,
@@ -47,7 +48,7 @@ class TaskInfo {
/// Returns a new TaskInfo populated with values from the map.
factory TaskInfo.fromJson(Map<String, dynamic> json) => TaskInfo(
dataPath: json['data_path'],
- isRegression: json['is_regression'],
+ isRegression: json['is_regression'] ?? false,
category: List<String>.from(json['category']),
task: json['task'],
answer: json['answer'],