toJson method
Implementation
Map<String, dynamic> toJson() {
final Map<String, dynamic> jsonMap = {
'content': content,
'role': GroqMessageRoleParser.toId(role),
};
if (toolCalls.isNotEmpty) {
jsonMap['tool_calls'] =
toolCalls.map((toolCall) => toolCall.toJson()).toList();
}
if (username != null) {
jsonMap['username'] = username!;
}
return jsonMap;
}