Class: EmbeddingUtil::ServerModel
- Inherits:
-
Data
- Object
- Data
- EmbeddingUtil::ServerModel
- Defined in:
- lib/embedding_util/server_model.rb
Instance Attribute Summary collapse
-
#capability ⇒ Object
readonly
Returns the value of attribute capability.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#capability ⇒ Object (readonly)
Returns the value of attribute capability
10 11 12 |
# File 'lib/embedding_util/server_model.rb', line 10 def capability @capability end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile
10 11 12 |
# File 'lib/embedding_util/server_model.rb', line 10 def profile @profile end |
Class Method Details
.for(capability, profile) ⇒ Object
20 21 22 |
# File 'lib/embedding_util/server_model.rb', line 20 def self.for(capability, profile) new(capability: capability.to_sym, profile: profile) end |
.parse(value) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/embedding_util/server_model.rb', line 11 def self.parse(value) text = value.to_s prefix, profile_name = text.split("-", 2) capability = SERVER_MODEL_PREFIXES[prefix] raise ArgumentError, "unknown server model #{value.inspect}; expected embedding-PROFILE or reranker-PROFILE" unless capability && profile_name new(capability: capability, profile: Profiles.fetch(profile_name)) end |
Instance Method Details
#default_port(config) ⇒ Object
36 37 38 |
# File 'lib/embedding_util/server_model.rb', line 36 def default_port(config) capability == :embedding ? config. : config.reranker_port end |
#name ⇒ Object
24 25 26 |
# File 'lib/embedding_util/server_model.rb', line 24 def name "#{capability_name}-#{profile.name}" end |
#settings ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/embedding_util/server_model.rb', line 28 def settings case capability when :embedding then profile. when :reranker then profile.reranker else raise ArgumentError, "unknown server capability: #{capability.inspect}" end end |