fromJson static method

AgentDescription fromJson(
  1. Map<String, dynamic> a
)

Implementation

static AgentDescription fromJson(Map<String, dynamic> a) {
  final requires =
      a["requires"] == null
          ? <Requirement>[]
          : [...(a["requires"] as List).map((e) => e["toolkit"] != null ? RequiredToolkit.fromJson(e) : RequiredSchema.fromJson(e))];

  return AgentDescription(
    description: a["description"] ?? "",
    title: a["title"] ?? "",
    name: a["name"],
    inputSchema: a["input_schema"],
    outputSchema: a["output_schema"],
    requires: requires,
    supportsTools: a["supports_tools"] == true,
    labels: a["labels"]?.whereType<String>().toList() ?? [],
  );
}