toJson method

Map<String, dynamic> toJson()

Converts the GroqChat object into a JSON-compatible Map<String, dynamic>.

This method serializes the GroqChat instance into a JSON object by converting its fields to key-value pairs that are compatible with JSON.

Implementation

Map<String, dynamic> toJson() {
  return {
    'model': _model,
    'apiKey': _apiKey,
    'settings': _settings.toJson(),
    'chatItems': _chatItems.map((e) => e.toJson()).toList(),
    'rateLimitInfo': _rateLimitInfo?.toJson(),
    'registeredTools': _registeredTools.map((e) => e.toChatJson()).toList(),
  };
}