LLMConfig.fromJson constructor

LLMConfig.fromJson(
  1. Map<String, dynamic> json
)

Create from JSON representation

Implementation

factory LLMConfig.fromJson(Map<String, dynamic> json) => LLMConfig(
      apiKey: json['apiKey'] as String?,
      baseUrl: json['baseUrl'] as String,
      model: json['model'] as String,
      maxTokens: json['maxTokens'] as int?,
      temperature: json['temperature'] as double?,
      systemPrompt: json['systemPrompt'] as String?,
      timeout: json['timeout'] != null
          ? Duration(milliseconds: json['timeout'] as int)
          : null,
      topP: json['topP'] as double?,
      topK: json['topK'] as int?,
      tools: json['tools'] != null
          ? (json['tools'] as List)
              .map((t) => Tool.fromJson(t as Map<String, dynamic>))
              .toList()
          : null,
      toolChoice: json['toolChoice'] != null
          ? _parseToolChoice(json['toolChoice'] as Map<String, dynamic>)
          : null,
      stopSequences: json['stopSequences'] != null
          ? List<String>.from(json['stopSequences'] as List)
          : null,
      user: json['user'] as String?,
      serviceTier: ServiceTier.fromString(json['serviceTier'] as String?),
      extensions: json['extensions'] as Map<String, dynamic>? ?? {},
    );