toJson method
Converts to JSON.
Implementation
Map<String, dynamic> toJson() => {
if (messages != null) 'messages': messages!.map((m) => m.toJson()).toList(),
if (toolResources != null) 'tool_resources': toolResources!.toJson(),
if (metadata != null) 'metadata': metadata,
};