mellea.backends.adapters.catalog
Catalog of available adapter functions.
Catalog of adapter functions currently known to Mellea, including metadata about where to find LoRA and aLoRA adapters that implement them.
Functions
FUNC validate_revision
validate_revision(revision: str) -> str
Validate a Hugging Face revision value.
Accepts any non-empty string. Hugging Face's revision parameter takes a
branch name, tag, or commit SHA; this validator mirrors that contract.
Catalogue entries pin to commit SHAs by convention; that is enforced by
review and (optionally) build-time drift checks rather than by this
validator.
Args:
revision: Any non-empty string accepted by Hugging Face as a revision (branch name, tag, or commit SHA).
Returns:
- The validated revision unchanged.
Raises:
ValueError: Ifrevisionis empty, whitespace-only, or has leading or trailing whitespace.
FUNC known_intrinsic_names
known_intrinsic_names() -> list[str]
Return all known user-visible names for adapter functions.
Returns:
- List of all known user-visible adapter function names.
FUNC fetch_intrinsic_metadata
fetch_intrinsic_metadata(intrinsic_name: str) -> IntrinsicsCatalogEntry
Retrieve catalog metadata for the adapter that implements an adapter function.
Args:
intrinsic_name: User-visible name of the adapter function.
Returns:
- Metadata about the adapter(s) that implement the adapter function.
Raises:
ValueError: Ifintrinsic_nameis not a known adapter function name.
Classes
CLASS AdapterType
Possible types of adapters for a backend.
Attributes:
LORA: Standard LoRA adapter; value"lora".ALORA: aLoRA adapter (shares model KV cache across adapter functions); value"alora".
CLASS IntrinsicsCatalogEntry
A single row in the main adapter function catalog table.
We use Pydantic for this dataclass because the rest of Mellea also uses Pydantic.
Attributes:
name: User-visible name of the adapter function. May contain hyphens when that matches the upstream adapter name; prefereffective_capabilityto form the stable capability token. Must be non-empty with no leading or trailing whitespace.capability: Stable Mellea-level capability token, independent of the upstream adapter name. Uses underscores. WhenNone, :attr:effective_capabilityfalls back toname. When set, must be non-empty with no leading or trailing whitespace.internal_name: Internal name used for adapter loading, orNoneif the same asname.repo_id: Hugging Face repository where adapters for the adapter function are located.revision: Hugging Face revision — branch name, tag, or commit SHA. Catalogue entries pin to commit SHAs by convention so loads are reproducible; the validator itself only requires a non-empty string. Note: this field is stored in the catalogue but not yet forwarded to the Hugging Face download call; wiring it through is deferred to a subsequent phase of the adapter-lifecycle epic (#929).adapter_types: Adapter types known to be available for this adapter function; defaults to(AdapterType.LORA, AdapterType.ALORA).
Methods:
FUNC effective_capability
effective_capability(self) -> str
Return the stable capability token for this adapter function.
Returns capability when explicitly set; falls back to name
otherwise. Use this property — not name — whenever building the
capability vocabulary or resolving an
:class:~mellea.backends.adapters.Identity capability.
Returns:
- Capability token, guaranteed non-empty.