Class: InstLLM::Parameter::Llama3Parameters

Inherits:
Object
  • Object
show all
Defined in:
lib/inst_llm/parameter/llama3_parameters.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  max_gen_len: nil,
  temperature: nil,
  top_p: nil,
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(model:, messages: [], **options) ⇒ Llama3Parameters

Returns a new instance of Llama3Parameters.



14
15
16
17
18
# File 'lib/inst_llm/parameter/llama3_parameters.rb', line 14

def initialize(model:, messages: [], **options)
  @model = model
  @messages = messages.map { |message| format_message(message) }
  @options = DEFAULT_OPTIONS.merge(options.slice(*DEFAULT_OPTIONS.keys)).compact
end

Instance Method Details

#to_hashObject



20
21
22
# File 'lib/inst_llm/parameter/llama3_parameters.rb', line 20

def to_hash
  { model_id: @model, body: { prompt: prompt(@messages) }.merge(@options).to_json }
end