Skip to main content

mellea.backends.adapters.catalog

Catalog of available intrinsics.

Catalog of intrinsics currently known to Mellea,including metadata about where to find LoRA and aLoRA adapters that implement said intrinsics.

Functions

FUNC validate_revision

validate_revision(revision: str) -> str

Validate a HuggingFace revision value.

Accepts any non-empty string. HuggingFace'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 HuggingFace as a revision (branch name, tag, or commit SHA).

Returns:

  • The validated revision unchanged.

Raises:

  • ValueError: If revision is empty or whitespace-only.

FUNC known_intrinsic_names

known_intrinsic_names() -> list[str]

Return all known user-visible names for intrinsics.

Returns:

  • List of all known user-visible intrinsic names.

FUNC fetch_intrinsic_metadata

fetch_intrinsic_metadata(intrinsic_name: str) -> IntriniscsCatalogEntry

Retrieve information about the adapter that backs an intrinsic.

Args:

  • intrinsic_name: User-visible name of the intrinsic.

Returns:

  • Metadata about the adapter(s) that implement the intrinsic.

Raises:

  • ValueError: If intrinsic_name is not a known intrinsic name.

Classes

CLASS AdapterType

Possible types of adapters for a backend.

Attributes:

  • LORA: Standard LoRA adapter; value "lora".
  • ALORA: Activated LoRA adapter; value "alora".

CLASS IntriniscsCatalogEntry

A single row in the main intrinsics catalog table.

We use Pydantic for this dataclass because the rest of Mellea also uses Pydantic.

Attributes:

  • name: User-visible name of the intrinsic.
  • internal_name: Internal name used for adapter loading, or None if the same as name.
  • repo_id: HuggingFace repository where adapters for the intrinsic are located.
  • revision: HuggingFace 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 HuggingFace 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 intrinsic; defaults to (AdapterType.LORA, AdapterType.ALORA).