Class: LLMSpecs::Model

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModelCompliance
Defined in:
lib/llm_specs/model.rb,
lib/llm_specs/active_model.rb

Defined Under Namespace

Modules: ActiveModelCompliance

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActiveModelCompliance

#errors, #persisted?, #to_key, #to_model, #to_param, #to_partial_path

Class Method Details

.to_procObject



44
45
46
# File 'lib/llm_specs/model.rb', line 44

def self.to_proc
  ->(hash) { new(**hash) }
end

Instance Method Details

#input_modalitiesObject



28
29
30
# File 'lib/llm_specs/model.rb', line 28

def input_modalities
  modalities[:input]
end

#input_pricing(type = :text_tokens, price_type = :standard) ⇒ Object



36
37
38
# File 'lib/llm_specs/model.rb', line 36

def input_pricing(type=:text_tokens, price_type=:standard)
  pricing.dig(type, price_type, :input_per_million)
end

#output_modalitiesObject



32
33
34
# File 'lib/llm_specs/model.rb', line 32

def output_modalities
  modalities[:output]
end

#output_pricing(type = :text_tokens, price_type = :standard) ⇒ Object



40
41
42
# File 'lib/llm_specs/model.rb', line 40

def output_pricing(type=:text_tokens, price_type=:standard)
  pricing.dig(type, price_type, :output_per_million)
end

#supports?(*args) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/llm_specs/model.rb', line 4

def supports?(*args)
  args.all? { capabilities.include? it.to_s }
end

#supports_input?(*args) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/llm_specs/model.rb', line 8

def supports_input?(*args)
  args.all? { input_modalities.include? it.to_s }
end

#supports_output?(*args) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/llm_specs/model.rb', line 12

def supports_output?(*args)
  args.all? { output_modalities.include? it.to_s }
end