Module: Legion::Extensions::Llm::Vllm::Provider::Capabilities

Defined in:
lib/legion/extensions/llm/vllm/provider.rb

Overview

Capability predicates for vLLM OpenAI-compatible model offerings. V7: per-model derivation — the same model-type split the discovery runner publishes: an embedding model does not serve chat or streaming, a chat model does not serve embeds. The static every-model-streaming claims are deleted.

Class Method Summary collapse

Class Method Details

.chat?(model) ⇒ Boolean

Returns:

  • (Boolean)


222
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 222

def chat?(model) = !embedding_model?(model)

.critical_capabilities_for(model) ⇒ Object



228
229
230
231
232
233
234
235
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 228

def critical_capabilities_for(model)
  [
    ('streaming' if streaming?(model)),
    ('function_calling' if functions?(model)),
    ('vision' if vision?(model)),
    ('embeddings' if embeddings?(model))
  ].compact
end

.embedding_model?(model) ⇒ Boolean

The one model-type predicate, shared with the discovery runner's build_offering_draft. The catalog path hands string-keyed wire hashes; the discovery path hands symbol-keyed JSON — both shapes resolve here.

Returns:

  • (Boolean)


214
215
216
217
218
219
220
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 214

def embedding_model?(model)
  data = model.is_a?(Hash) ? model : {}
  type = data[:type] || data['type']
  model_caps = data[:capabilities] || data['capabilities']
  type.to_s == 'embedding' ||
    (model_caps.is_a?(Array) && model_caps.include?('embedding'))
end

.embeddings?(model) ⇒ Boolean

Returns:

  • (Boolean)


226
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 226

def embeddings?(model) = embedding_model?(model)

.functions?(_model) ⇒ Boolean

Returns:

  • (Boolean)


225
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 225

def functions?(_model) = false

.streaming?(model) ⇒ Boolean

Returns:

  • (Boolean)


223
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 223

def streaming?(model) = !embedding_model?(model)

.vision?(_model) ⇒ Boolean

Returns:

  • (Boolean)


224
# File 'lib/legion/extensions/llm/vllm/provider.rb', line 224

def vision?(_model) = false