Module: Legion::Extensions::Llm::Mlx::Runners::Discovery
- Extended by:
- Discovery
- Includes:
- Discovery::Pipeline
- Included in:
- Discovery
- Defined in:
- lib/legion/extensions/llm/mlx/runners/discovery.rb
Overview
MLX discovery runner: ONLY the MLX-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 it from live settings at publish.
The catalog is OpenAI-shaped (GET /v1/models -> body) and readiness is GET /health, so the pipeline's default fetch_raw_models / model_id_from / check_health / health_path are reused. The overrides are the MLX config keys (mlx_api_base / mlx_api_key, defaulting to http://localhost:8000), the Helpers::Callable, and the offering-draft evidence.
Constant Summary collapse
- EMBEDDING_PATTERN =
/embed|bge|e5|nomic/i- UNKNOWN_EVIDENCE_SRC =
Protocol-required evidence source: the default_false taxonomy member.
:default_false
Instance Method Summary collapse
-
#auth_token(instance_cfg:) ⇒ Object
MLX is local: auth is an OPTIONAL bearer key (mlx_api_key, or credentials.api_key when no explicit key is set).
- #build_callable(instance_cfg:) ⇒ Object
-
#build_offering_draft(instance_cfg:, instance_key:, model_id:, model_data:) ⇒ Object
── Offering draft (evidence + metadata; NO weight) ───────────────.
-
#catalog_base_url(instance_cfg:) ⇒ Object
── MLX instance-config keys / connection ─────────────────────── Mlx.normalize_instance_config promotes endpoint/base_url/api_base aliases to :mlx_api_base; a missing base falls back to the extension's registered localhost default.
Instance Method Details
#auth_token(instance_cfg:) ⇒ Object
MLX is local: auth is an OPTIONAL bearer key (mlx_api_key, or credentials.api_key when no explicit key is set).
44 45 46 47 |
# File 'lib/legion/extensions/llm/mlx/runners/discovery.rb', line 44 def auth_token(instance_cfg:) token = instance_cfg[:mlx_api_key] || instance_cfg.dig(:credentials, :api_key) token if token.is_a?(String) && !token.strip.empty? end |
#build_callable(instance_cfg:) ⇒ Object
49 50 51 |
# File 'lib/legion/extensions/llm/mlx/runners/discovery.rb', line 49 def build_callable(instance_cfg:) Legion::Extensions::Llm::Mlx::Helpers::Callable.new(instance_cfg: instance_cfg, logger: log) end |
#build_offering_draft(instance_cfg:, instance_key:, model_id:, model_data:) ⇒ Object
── Offering draft (evidence + metadata; NO weight) ───────────────
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/legion/extensions/llm/mlx/runners/discovery.rb', line 54 def build_offering_draft(instance_cfg:, instance_key:, model_id:, model_data:) tier = instance_cfg[:tier] || :local = (model_id: model_id) Legion::Extensions::Llm::Inventory::OfferingDraft.new( provider_native_key: model_id, model: model_id, tier: tier, operation_evidence: build_operation_evidence(embed_supported: , model_id: model_id), capability_evidence: build_capability_evidence(model_id: model_id), context_evidence: build_context_evidence(model_data: model_data), max_output_evidence: build_max_output_evidence(model_data: model_data), embedding_dimensions_evidence: ( model_data: model_data, embed_supported: ), model_revision_evidence: absent_value_evidence, tokenizer_evidence: absent_value_evidence, quota_domains: {}, metadata: (model_data: model_data, instance_key: instance_key), publication_source: :provider_catalog ) end |
#catalog_base_url(instance_cfg:) ⇒ Object
── MLX instance-config keys / connection ─────────────────────── Mlx.normalize_instance_config promotes endpoint/base_url/api_base aliases to :mlx_api_base; a missing base falls back to the extension's registered localhost default.
38 39 40 |
# File 'lib/legion/extensions/llm/mlx/runners/discovery.rb', line 38 def catalog_base_url(instance_cfg:) normalize_api_base(instance_cfg[:mlx_api_base] || instance_cfg[:endpoint] || 'http://localhost:8000') end |