Class: Legion::LLM::Router::Resolution
- Inherits:
-
Object
- Object
- Legion::LLM::Router::Resolution
- Defined in:
- lib/legion/llm/router/resolution.rb
Instance Attribute Summary collapse
-
#compress_level ⇒ Object
readonly
Returns the value of attribute compress_level.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#offering_id ⇒ Object
readonly
Returns the value of attribute offering_id.
-
#offering_metadata ⇒ Object
readonly
Returns the value of attribute offering_metadata.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
-
#tier ⇒ Object
readonly
Returns the value of attribute tier.
Instance Method Summary collapse
- #cloud? ⇒ Boolean
- #external? ⇒ Boolean
- #fleet? ⇒ Boolean
- #frontier? ⇒ Boolean
-
#initialize(tier:, provider:, model:, rule: nil, metadata: {}, compress_level: 0, offering_id: nil, offering_metadata: nil) ⇒ Resolution
constructor
A new instance of Resolution.
- #local? ⇒ Boolean
- #openai_compat? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(tier:, provider:, model:, rule: nil, metadata: {}, compress_level: 0, offering_id: nil, offering_metadata: nil) ⇒ Resolution
Returns a new instance of Resolution.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/legion/llm/router/resolution.rb', line 10 def initialize(tier:, provider:, model:, rule: nil, metadata: {}, compress_level: 0, offering_id: nil, offering_metadata: nil) @tier = tier.to_sym @provider = provider.to_sym @model = model @rule = rule @metadata = @compress_level = compress_level.to_i @offering_id = offering_id&.to_s @offering_metadata = ( || [:offering] || ['offering']) end |
Instance Attribute Details
#compress_level ⇒ Object (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 |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/legion/llm/router/resolution.rb', line 7 def @metadata end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/legion/llm/router/resolution.rb', line 7 def model @model end |
#offering_id ⇒ Object (readonly)
Returns the value of attribute offering_id.
7 8 9 |
# File 'lib/legion/llm/router/resolution.rb', line 7 def offering_id @offering_id end |
#offering_metadata ⇒ Object (readonly)
Returns the value of attribute offering_metadata.
7 8 9 |
# File 'lib/legion/llm/router/resolution.rb', line 7 def @offering_metadata end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
7 8 9 |
# File 'lib/legion/llm/router/resolution.rb', line 7 def provider @provider end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
7 8 9 |
# File 'lib/legion/llm/router/resolution.rb', line 7 def rule @rule end |
#tier ⇒ Object (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
30 31 32 |
# File 'lib/legion/llm/router/resolution.rb', line 30 def cloud? @tier == :cloud end |
#external? ⇒ Boolean
42 43 44 |
# File 'lib/legion/llm/router/resolution.rb', line 42 def external? %i[cloud frontier openai_compat].include?(@tier) end |
#fleet? ⇒ Boolean
26 27 28 |
# File 'lib/legion/llm/router/resolution.rb', line 26 def fleet? @tier == :fleet end |
#frontier? ⇒ Boolean
34 35 36 |
# File 'lib/legion/llm/router/resolution.rb', line 34 def frontier? @tier == :frontier end |
#local? ⇒ Boolean
22 23 24 |
# File 'lib/legion/llm/router/resolution.rb', line 22 def local? @tier == :local end |
#openai_compat? ⇒ Boolean
38 39 40 |
# File 'lib/legion/llm/router/resolution.rb', line 38 def openai_compat? @tier == :openai_compat end |
#to_h ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/legion/llm/router/resolution.rb', line 46 def to_h hash = { tier: @tier, provider: @provider, model: @model, rule: @rule, metadata: @metadata, compress_level: @compress_level } hash[:offering_id] = @offering_id if @offering_id hash[:offering_metadata] = @offering_metadata unless @offering_metadata.empty? hash end |