toGeminiSettings function
Implementation
@visibleForTesting
gcl.GenerationConfig toGeminiSettings(
GeminiOptions options,
Map<String, dynamic>? outputSchema,
bool isJsonMode,
) {
return gcl.GenerationConfig(
candidateCount: options.candidateCount,
stopSequences: options.stopSequences?.isEmpty ?? true
? null
: options.stopSequences,
maxOutputTokens: options.maxOutputTokens,
temperature: options.temperature,
topP: options.topP,
topK: options.topK,
responseMimeType: isJsonMode
? 'application/json'
: (options.responseMimeType ?? ''),
responseJsonSchema: outputSchema,
presencePenalty: options.presencePenalty,
frequencyPenalty: options.frequencyPenalty,
responseLogprobs: options.responseLogprobs,
logprobs: options.logprobs,
responseModalities: options.responseModalities?.isEmpty ?? true
? null
: options.responseModalities!.map((m) => m.toUpperCase()).toList(),
speechConfig: options.speechConfig != null
? gcl.SpeechConfig.fromJson(_toSpeechConfig(options.speechConfig)!)
: null,
thinkingConfig: options.thinkingConfig != null
? gcl.ThinkingConfig.fromJson(
_toThinkingConfig(options.thinkingConfig)!,
)
: null,
);
}