AttachmentTool.fromJson constructor
Creates an AttachmentTool from JSON.
Implementation
factory AttachmentTool.fromJson(Map<String, dynamic> json) {
final type = json['type'] as String;
return switch (type) {
'code_interpreter' => const CodeInterpreterAttachmentTool(),
'file_search' => const FileSearchAttachmentTool(),
_ => throw FormatException('Unknown tool type: $type'),
};
}