Class: Llmclt::Config::GenerationConfig
- Inherits:
-
Object
- Object
- Llmclt::Config::GenerationConfig
- Defined in:
- lib/llmclt/config/generation_config.rb
Constant Summary collapse
- PARAMETERS =
Generation configuration parameters temperature: number topP: number topK: number candidateCount: integer maxOutputTokens: integer presencePenalty: float frequencyPenalty: float stopSequences: [
string] responseMimeType: string responseSchema: schema seed: integer responseLogprobs: boolean logprobs: integer audioTimestamp: boolean
%i[ temperature top_p top_k candidate_count max_output_tokens presence_penalty frequency_penalty stop_sequences response_mime_type response_schema seed response_logprobs logprobs audio_timestamp ].freeze
Instance Method Summary collapse
- #build_request_content ⇒ Object
-
#initialize(setting = {}) ⇒ GenerationConfig
constructor
A new instance of GenerationConfig.
Constructor Details
#initialize(setting = {}) ⇒ GenerationConfig
Returns a new instance of GenerationConfig.
41 42 43 |
# File 'lib/llmclt/config/generation_config.rb', line 41 def initialize(setting = {}) @setting = setting end |
Instance Method Details
#build_request_content ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/llmclt/config/generation_config.rb', line 45 def build_request_content return {} if @setting.nil? || @setting.empty? config = PARAMETERS.each_with_object({}) do |param, cfg| p = param.to_s.camelize(:lower).to_sym cfg[p] = @setting[param] unless @setting[param].nil? end { generationConfig: config } end |