Class: RubyLLM::ModelInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/model_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ModelInfo

Returns a new instance of ModelInfo.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby_llm/model_info.rb', line 11

def initialize(data)
  @id = data[:id]
  @created_at = data[:created_at].is_a?(String) ? Time.parse(data[:created_at]) : data[:created_at]
  @display_name = data[:display_name]
  @provider = data[:provider]
  @context_window = data[:context_window]
  @max_tokens = data[:max_tokens]
  @supports_vision = data[:supports_vision]
  @supports_functions = data[:supports_functions]
  @supports_json_mode = data[:supports_json_mode]
  @input_price_per_million = data[:input_price_per_million]
  @output_price_per_million = data[:output_price_per_million]
  @metadata = data[:metadata] || {}
end

Instance Attribute Details

#context_windowObject (readonly)

Returns the value of attribute context_window.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def context_window
  @context_window
end

#created_atObject (readonly)

Returns the value of attribute created_at.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def created_at
  @created_at
end

#display_nameObject (readonly)

Returns the value of attribute display_name.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def display_name
  @display_name
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def id
  @id
end

#input_price_per_millionObject (readonly)

Returns the value of attribute input_price_per_million.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def input_price_per_million
  @input_price_per_million
end

#max_tokensObject (readonly)

Returns the value of attribute max_tokens.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def max_tokens
  @max_tokens
end

#metadataObject (readonly)

Returns the value of attribute metadata.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def 
  @metadata
end

#output_price_per_millionObject (readonly)

Returns the value of attribute output_price_per_million.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def output_price_per_million
  @output_price_per_million
end

#providerObject (readonly)

Returns the value of attribute provider.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def provider
  @provider
end

#supports_functionsObject (readonly)

Returns the value of attribute supports_functions.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def supports_functions
  @supports_functions
end

#supports_json_modeObject (readonly)

Returns the value of attribute supports_json_mode.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def supports_json_mode
  @supports_json_mode
end

#supports_visionObject (readonly)

Returns the value of attribute supports_vision.



7
8
9
# File 'lib/ruby_llm/model_info.rb', line 7

def supports_vision
  @supports_vision
end

Instance Method Details

#familyObject



47
48
49
# File 'lib/ruby_llm/model_info.rb', line 47

def family
  ['family']
end

#to_hObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ruby_llm/model_info.rb', line 26

def to_h
  {
    id: id,
    created_at: created_at.iso8601,
    display_name: display_name,
    provider: provider,
    context_window: context_window,
    max_tokens: max_tokens,
    supports_vision: supports_vision,
    supports_functions: supports_functions,
    supports_json_mode: supports_json_mode,
    input_price_per_million: input_price_per_million,
    output_price_per_million: output_price_per_million,
    metadata: 
  }
end

#typeObject



43
44
45
# File 'lib/ruby_llm/model_info.rb', line 43

def type
  ['type']
end