Module: Legion::Extensions::Llm::Vllm::Runners::Discovery

Extended by:
Discovery
Includes:
Discovery::Pipeline
Included in:
Discovery
Defined in:
lib/legion/extensions/llm/vllm/runners/discovery.rb

Overview

vLLM discovery runner: ONLY the vLLM-specific work. The generic reconcile / claim / activate / probe (cadence + reactive) / replace / weight-publication / health-display pipeline is mixed in from the shared Discovery::Pipeline. Weight is NOT computed here — the shared WeightReconciler recomputes the write-time weight from live settings at publish.

Instance Method Summary collapse

Instance Method Details

#auth_token(instance_cfg:) ⇒ Object



32
33
34
35
# File 'lib/legion/extensions/llm/vllm/runners/discovery.rb', line 32

def auth_token(instance_cfg:)
  token = instance_cfg[:vllm_api_key]
  token if token.is_a?(String) && !token.strip.empty?
end

#build_callable(instance_cfg:) ⇒ Object



37
38
39
# File 'lib/legion/extensions/llm/vllm/runners/discovery.rb', line 37

def build_callable(instance_cfg:)
  Legion::Extensions::Llm::Vllm::Helpers::Callable.new(instance_cfg: instance_cfg, logger: log)
end

#build_offering_draft(instance_cfg:, instance_key:, model_id:, model_data:) ⇒ Object

Build the Inventory::OfferingDraft for one model (evidence + metadata). NO weight_inputs / base_weight — those are the identity default and the shared WeightReconciler recomputes them at publish.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/legion/extensions/llm/vllm/runners/discovery.rb', line 44

def build_offering_draft(instance_cfg:, instance_key:, model_id:, model_data:)
  embed_supported = Legion::Extensions::Llm::Vllm::Provider::Capabilities.embedding_model?(model_data)
  max_output = model_data[:max_output_tokens] || model_data[:max_completion_tokens]

  Legion::Extensions::Llm::Inventory::OfferingDraft.new(
    provider_native_key: model_id,
    model: model_id,
    tier: instance_cfg[:tier] || :direct,
    operation_evidence: build_operation_evidence(embed_supported: embed_supported),
    capability_evidence: build_capability_evidence(instance_cfg: instance_cfg, model_id: model_id,
                                                   embed_supported: embed_supported),
    context_evidence: build_value_evidence(model_data[:max_model_len]),
    max_output_evidence: build_value_evidence(max_output),
    embedding_dimensions_evidence: build_embedding_dims_evidence(model_data, embed_supported),
    model_revision_evidence: build_string_evidence(model_data[:revision] || model_data[:model_revision]),
    tokenizer_evidence: build_tokenizer_evidence(model_data[:tokenizer]),
    quota_domains: {},
    metadata: (model_id: model_id, instance_id: instance_key.instance_id,
                             model_data: model_data),
    publication_source: :provider_catalog
  )
end

#catalog_base_url(instance_cfg:) ⇒ Object

── vLLM instance-config keys ───────────────────────────────────── The normalized instance config (Vllm.discover_instances) carries the vLLM-specific vllm_api_base / vllm_api_key; the pipeline's catalog_base_url / auth_token read the standard keys, so override to the vLLM ones.



28
29
30
# File 'lib/legion/extensions/llm/vllm/runners/discovery.rb', line 28

def catalog_base_url(instance_cfg:)
  normalize_api_base(instance_cfg[:vllm_api_base] || instance_cfg[:endpoint])
end