Class: InstLLM::Parameter::ClaudeParameters

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

Constant Summary collapse

DEFAULT_OPTIONS =
{
  anthropic_version: "bedrock-2023-05-31",
  max_tokens: 2000,
  stop_sequences: nil,
  temperature: nil,
  top_k: nil,
  top_p: nil,
  system: nil,
}.freeze

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ClaudeParameters.



16
17
18
19
20
# File 'lib/inst_llm/parameter/claude_parameters.rb', line 16

def initialize(model:, messages: [], **options)
  @messages = messages
  @model = model
  @options = DEFAULT_OPTIONS.merge(options.slice(*DEFAULT_OPTIONS.keys)).compact
end

Instance Method Details

#to_hashObject



22
23
24
# File 'lib/inst_llm/parameter/claude_parameters.rb', line 22

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