Class: SwarmSDK::Models::ModelInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/swarm_sdk/models.rb

Overview

Model information wrapper providing method access to model data

Wraps the raw Hash from models.json to provide RubyLLM::Model::Info-like interface for compatibility with code expecting method access.

Examples:

model = SwarmSDK::Models.find("claude-sonnet-4-5-20250929")
model.context_window  #=> 200000
model.id              #=> "claude-sonnet-4-5-20250929"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ModelInfo

Create a ModelInfo from a Hash

Parameters:

  • data (Hash)

    Model data from models.json



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/swarm_sdk/models.rb', line 46

def initialize(data)
  @id = data["id"] || data[:id]
  @name = data["name"] || data[:name]
  @provider = data["provider"] || data[:provider]
  @family = data["family"] || data[:family]
  @context_window = data["context_window"] || data[:context_window]
  @max_output_tokens = data["max_output_tokens"] || data[:max_output_tokens]
  @knowledge_cutoff = data["knowledge_cutoff"] || data[:knowledge_cutoff]
  @modalities = data["modalities"] || data[:modalities]
  @capabilities = data["capabilities"] || data[:capabilities]
  @pricing = data["pricing"] || data[:pricing]
   = data["metadata"] || data[:metadata]
end

Instance Attribute Details

#capabilitiesObject (readonly)

Returns the value of attribute capabilities.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def capabilities
  @capabilities
end

#context_windowObject (readonly)

Returns the value of attribute context_window.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def context_window
  @context_window
end

#familyObject (readonly)

Returns the value of attribute family.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def family
  @family
end

#idObject (readonly)

Returns the value of attribute id.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def id
  @id
end

#knowledge_cutoffObject (readonly)

Returns the value of attribute knowledge_cutoff.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def knowledge_cutoff
  @knowledge_cutoff
end

#max_output_tokensObject (readonly)

Returns the value of attribute max_output_tokens.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def max_output_tokens
  @max_output_tokens
end

#metadataObject (readonly)

Returns the value of attribute metadata.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def 
  
end

#modalitiesObject (readonly)

Returns the value of attribute modalities.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def modalities
  @modalities
end

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def name
  @name
end

#pricingObject (readonly)

Returns the value of attribute pricing.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def pricing
  @pricing
end

#providerObject (readonly)

Returns the value of attribute provider.



31
32
33
# File 'lib/swarm_sdk/models.rb', line 31

def provider
  @provider
end