toJson method

Map<String, dynamic> toJson()

Convert to JSON representation

Implementation

Map<String, dynamic> toJson() => {
      if (apiKey != null) 'apiKey': apiKey,
      'baseUrl': baseUrl,
      'model': model,
      if (maxTokens != null) 'maxTokens': maxTokens,
      if (temperature != null) 'temperature': temperature,
      if (systemPrompt != null) 'systemPrompt': systemPrompt,
      if (timeout != null) 'timeout': timeout!.inMilliseconds,
      if (topP != null) 'topP': topP,
      if (topK != null) 'topK': topK,
      if (tools != null) 'tools': tools!.map((t) => t.toJson()).toList(),
      if (toolChoice != null) 'toolChoice': toolChoice!.toJson(),
      if (stopSequences != null) 'stopSequences': stopSequences,
      if (user != null) 'user': user,
      if (serviceTier != null) 'serviceTier': serviceTier!.value,
      'extensions': extensions,
    };