toMap method

  1. @override
Map<String, Object?> toMap()
override

Implementation

@override
Map<String, Object?> toMap() {
  return {
    'messages': messages.map((e) => e.toMap()).toList(),
    if (modelPreferences != null)
      'modelPreferences': modelPreferences!.toMap(),
    if (systemPrompt != null) 'systemPrompt': systemPrompt,
    if (includeContext != null) 'includeContext': includeContext,
    if (temperature != null) 'temperature': temperature,
    'maxTokens': maxTokens,
    if (stopSequences != null) 'stopSequences': stopSequences,
    if (metadata != null) 'metadata': metadata,
    if (tools != null) 'tools': tools!.map((e) => e.toMap()).toList(),
    if (toolChoice != null) 'toolChoice': toolChoice!.toMap(),
  };
}