toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      if (maxOutputTokens != null) 'max_output_tokens': maxOutputTokens,
      if (temperature != null) 'temperature': temperature,
      if (stopSequences != null) 'stop_sequences': stopSequences,
      if (topP != null) 'top_p': topP,
      if (topK != null) 'top_k': topK,
      if (presencePenalty != null) 'presence_penalty': presencePenalty,
      if (frequencyPenalty != null) 'frequency_penalty': frequencyPenalty,
      if (responseFormat != null) 'response_format': responseFormat,
      if (seed != null) 'seed': seed,
      if (tools != null) 'tools': tools!.map((t) => t.toJson()).toList(),
      if (toolChoice != null) 'tool_choice': toolChoice!.toJson(),
      if (headers != null) 'headers': headers,
      if (providerOptions != null) 'provider_options': providerOptions,
      if (reasoning != null) 'reasoning': reasoning!.toJson(),
      if (instructions != null) 'instructions': instructions,
      if (bodyOverrides != null) 'body_overrides': bodyOverrides,
      if (maxRetries != null) 'max_retries': maxRetries,
      if (timeout != null) 'timeout': timeout!.toJson(),
      if (includeRawChunks != null) 'include_raw_chunks': includeRawChunks,
      if (sessionId != null) 'session_id': sessionId,
    };