Class: Legion::LLM::Router::Resolution

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/llm/router/resolution.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tier:, provider:, model:, rule: nil, metadata: {}, compress_level: 0) ⇒ Resolution

Returns a new instance of Resolution.



9
10
11
12
13
14
15
16
# File 'lib/legion/llm/router/resolution.rb', line 9

def initialize(tier:, provider:, model:, rule: nil, metadata: {}, compress_level: 0)
  @tier           = tier.to_sym
  @provider       = provider.to_sym
  @model          = model
  @rule           = rule
  @metadata       = 
  @compress_level = compress_level.to_i
end

Instance Attribute Details

#compress_levelObject (readonly)

Returns the value of attribute compress_level.



7
8
9
# File 'lib/legion/llm/router/resolution.rb', line 7

def compress_level
  @compress_level
end

#metadataObject (readonly)

Returns the value of attribute metadata.



7
8
9
# File 'lib/legion/llm/router/resolution.rb', line 7

def 
  @metadata
end

#modelObject (readonly)

Returns the value of attribute model.



7
8
9
# File 'lib/legion/llm/router/resolution.rb', line 7

def model
  @model
end

#providerObject (readonly)

Returns the value of attribute provider.



7
8
9
# File 'lib/legion/llm/router/resolution.rb', line 7

def provider
  @provider
end

#ruleObject (readonly)

Returns the value of attribute rule.



7
8
9
# File 'lib/legion/llm/router/resolution.rb', line 7

def rule
  @rule
end

#tierObject (readonly)

Returns the value of attribute tier.



7
8
9
# File 'lib/legion/llm/router/resolution.rb', line 7

def tier
  @tier
end

Instance Method Details

#cloud?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/legion/llm/router/resolution.rb', line 26

def cloud?
  @tier == :cloud
end

#fleet?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/legion/llm/router/resolution.rb', line 22

def fleet?
  @tier == :fleet
end

#local?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/legion/llm/router/resolution.rb', line 18

def local?
  @tier == :local
end

#to_hObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/legion/llm/router/resolution.rb', line 30

def to_h
  {
    tier:           @tier,
    provider:       @provider,
    model:          @model,
    rule:           @rule,
    metadata:       @metadata,
    compress_level: @compress_level
  }
end