buildCommonParams static method

Map<String, dynamic> buildCommonParams(
  1. LLMConfig config
)

Extract common request parameters from LLMConfig

Implementation

static Map<String, dynamic> buildCommonParams(LLMConfig config) {
  final params = <String, dynamic>{
    'model': config.model,
  };

  if (config.maxTokens != null) {
    params['max_tokens'] = config.maxTokens;
  }

  if (config.temperature != null) {
    params['temperature'] = config.temperature;
  }

  if (config.topP != null) {
    params['top_p'] = config.topP;
  }

  if (config.topK != null) {
    params['top_k'] = config.topK;
  }

  return params;
}