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.
Add TaskInfo class with serialization and documentation
hunteraraujoafe77bbc4f70
diff --git a/frontend/lib/models/benchmark/task_info.dart b/frontend/lib/models/benchmark/task_info.dartnew file mode 100644index 0000000000..7e5a642e56--- /dev/null+++ b/frontend/lib/models/benchmark/task_info.dart@@ -0,0 +1,68 @@+/// 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,+/// whether the task is a regression task, the categories it falls under, and specific task details+/// like the task description, expected answer, and so on.+class TaskInfo {+ /// The path to the data file associated with the task.+ /// This is typically a JSON file containing the dataset or resources needed for the task.+ final String dataPath;++ /// A boolean indicating whether the task is a regression task.+ final bool isRegression;++ /// A list of categories to which the task belongs.+ final List<String> category;++ /// The specific task that needs to be performed.+ final String task;++ /// The expected answer for the task.+ final String answer;++ /// A description providing details about the task.+ final String description;++ /// Constructs a new TaskInfo instance.+ ///+ /// [dataPath]: The path to the data file for the task.+ /// [isRegression]: A boolean indicating if the task is a regression task.+ /// [category]: A list of categories to which the task belongs.+ /// [task]: The specific task to be performed.+ /// [answer]: The expected answer for the task.+ /// [description]: A description of the task.+ TaskInfo({+ required this.dataPath,+ required this.isRegression,+ required this.category,+ required this.task,+ required this.answer,+ required this.description,+ });++ /// Creates a TaskInfo instance from a map.+ ///+ /// [json]: A map containing key-value pairs corresponding to TaskInfo fields.+ ///+ /// 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'],+ category: List<String>.from(json['category']),+ task: json['task'],+ answer: json['answer'],+ description: json['description'],+ );++ /// Converts the TaskInfo instance to a map.+ ///+ /// Returns a map containing key-value pairs corresponding to TaskInfo fields.+ Map<String, dynamic> toJson() => {+ 'data_path': dataPath,+ 'is_regression': isRegression,+ 'category': category,+ 'task': task,+ 'answer': answer,+ 'description': description,+ };+}