Skip to content

meta_consts

Domain enums, category descriptors, and runtime registries for model reference metadata.

IMAGE_GENERATION_BASELINE_NATIVE_RESOLUTION_LOOKUP module-attribute

IMAGE_GENERATION_BASELINE_NATIVE_RESOLUTION_LOOKUP: dict[
    KNOWN_IMAGE_GENERATION_BASELINE | str, int
] = {}

The single-side preferred resolution for each known stable diffusion baseline.

KNOWN_TAGS module-attribute

KNOWN_TAGS = mutable_values()

KNOWN_TEXT_BACKENDS module-attribute

KNOWN_TEXT_BACKENDS = mutable_values()

_MODEL_DOMAIN_REGISTRY module-attribute

_MODEL_DOMAIN_REGISTRY = EnumRegistry(
    (value) for item in MODEL_DOMAIN
)

_MODEL_PURPOSE_REGISTRY module-attribute

_MODEL_PURPOSE_REGISTRY = EnumRegistry(
    (value) for item in MODEL_PURPOSE
)

github_image_model_reference_categories module-attribute

github_image_model_reference_categories: list[
    MODEL_REFERENCE_CATEGORY | str
] = []

This distinguishes the original github repo locations and has no other meaning.

github_text_model_reference_categories module-attribute

github_text_model_reference_categories: list[
    MODEL_REFERENCE_CATEGORY | str
] = []

This distinguishes the original github repo locations and has no other meaning.

no_legacy_format_available_categories module-attribute

no_legacy_format_available_categories: list[
    MODEL_REFERENCE_CATEGORY | str
] = []

Categories for which no legacy-format JSON file exists..

categories_managed_elsewhere module-attribute

categories_managed_elsewhere: list[
    MODEL_REFERENCE_CATEGORY | str
] = []

Categories that are managed by an external system.

MODEL_CLASSIFICATION_LOOKUP module-attribute

MODEL_CLASSIFICATION_LOOKUP: dict[
    MODEL_REFERENCE_CATEGORY | str, ModelClassification
] = {}

_CATEGORY_REGISTRY module-attribute

_CATEGORY_REGISTRY = DescriptorRegistry[
    MODEL_REFERENCE_CATEGORY | str, CategoryDescriptor
](_rebuild_category_derived_data)

_unregistered_categories module-attribute

_unregistered_categories = {
    c for c in MODEL_REFERENCE_CATEGORY if not contains(c)
}

__all__ module-attribute

__all__ = [
    "CONTROLNET_STYLE",
    "IMAGE_GENERATION_BASELINE_NATIVE_RESOLUTION_LOOKUP",
    "KNOWN_IMAGE_GENERATION_BASELINE",
    "KNOWN_TAGS",
    "KNOWN_TEXT_BACKENDS",
    "MODEL_DOMAIN",
    "MODEL_PURPOSE",
    "MODEL_REFERENCE_CATEGORY",
    "MODEL_STYLE",
    "TEXT_BACKENDS",
    "BaselineDescriptor",
    "CategoryDescriptor",
    "ModelClassification",
    "get_all_registered_baselines",
    "get_all_registered_categories",
    "get_baseline_descriptor",
    "get_baseline_native_resolution",
    "get_baselines_by_resolution",
    "get_category_descriptor",
    "get_known_tags",
    "is_known_controlnet_style",
    "is_known_image_baseline",
    "is_known_model_domain",
    "is_known_model_purpose",
    "is_known_model_style",
    "is_known_tag",
    "is_known_text_backend",
    "register_category",
    "register_controlnet_style",
    "register_image_baseline",
    "register_model_domain",
    "register_model_purpose",
    "register_model_style",
    "register_tag",
    "register_text_backend",
]

CONTROLNET_STYLE

Bases: StrEnum

An enum of all the ControlNet 'styles' - the process that defines the model's behavior.

Examples include canny, depth, and openpose.

Source code in src/horde_model_reference/model_consts/image.py
class CONTROLNET_STYLE(StrEnum):
    """An enum of all the ControlNet 'styles' - the process that defines the model's behavior.

    Examples include canny, depth, and openpose.
    """

    control_seg = auto()
    control_scribble = auto()
    control_fakescribbles = auto()
    control_openpose = auto()
    control_normal = auto()
    control_mlsd = auto()
    control_hough = auto()
    control_hed = auto()
    control_canny = auto()
    control_depth = auto()
    control_qr = auto()
    control_qr_xl = auto()

control_seg class-attribute instance-attribute

control_seg = auto()

control_scribble class-attribute instance-attribute

control_scribble = auto()

control_fakescribbles class-attribute instance-attribute

control_fakescribbles = auto()

control_openpose class-attribute instance-attribute

control_openpose = auto()

control_normal class-attribute instance-attribute

control_normal = auto()

control_mlsd class-attribute instance-attribute

control_mlsd = auto()

control_hough class-attribute instance-attribute

control_hough = auto()

control_hed class-attribute instance-attribute

control_hed = auto()

control_canny class-attribute instance-attribute

control_canny = auto()

control_depth class-attribute instance-attribute

control_depth = auto()

control_qr class-attribute instance-attribute

control_qr = auto()

control_qr_xl class-attribute instance-attribute

control_qr_xl = auto()

KNOWN_IMAGE_GENERATION_BASELINE

Bases: StrEnum

An enum of all the image generation baselines.

Source code in src/horde_model_reference/model_consts/image.py
class KNOWN_IMAGE_GENERATION_BASELINE(StrEnum):
    """An enum of all the image generation baselines."""

    infer = auto()
    """The baseline is not known and should be inferred from the model name."""

    stable_diffusion_1 = auto()
    stable_diffusion_2_768 = auto()
    stable_diffusion_2_512 = auto()
    stable_diffusion_xl = auto()
    stable_cascade = auto()
    flux_1 = auto()  # TODO: Extract flux and create "IMAGE_GENERATION_BASELINE_CATEGORY" due to name inconsistency
    flux_schnell = auto()  # FIXME
    flux_dev = auto()  # FIXME
    qwen_image = auto()
    z_image_turbo = auto()

infer class-attribute instance-attribute

infer = auto()

The baseline is not known and should be inferred from the model name.

stable_diffusion_1 class-attribute instance-attribute

stable_diffusion_1 = auto()

stable_diffusion_2_768 class-attribute instance-attribute

stable_diffusion_2_768 = auto()

stable_diffusion_2_512 class-attribute instance-attribute

stable_diffusion_2_512 = auto()

stable_diffusion_xl class-attribute instance-attribute

stable_diffusion_xl = auto()

stable_cascade class-attribute instance-attribute

stable_cascade = auto()

flux_1 class-attribute instance-attribute

flux_1 = auto()

flux_schnell class-attribute instance-attribute

flux_schnell = auto()

flux_dev class-attribute instance-attribute

flux_dev = auto()

qwen_image class-attribute instance-attribute

qwen_image = auto()

z_image_turbo class-attribute instance-attribute

z_image_turbo = auto()

BaselineDescriptor dataclass

Describes a known image-generation baseline in a single place.

Attributes:

  • native_resolution (int | None) –

    Preferred single-side resolution, or None for baselines like infer that have no fixed resolution.

  • alternative_names (tuple[str, ...]) –

    Alternative human/API names that map to this baseline.

Source code in src/horde_model_reference/model_consts/image.py
@dataclass(frozen=True)
class BaselineDescriptor:
    """Describes a known image-generation baseline in a single place.

    Attributes:
        native_resolution: Preferred single-side resolution, or ``None`` for baselines
            like ``infer`` that have no fixed resolution.
        alternative_names: Alternative human/API names that map to this baseline.

    """

    native_resolution: int | None
    alternative_names: tuple[str, ...] = field(default_factory=tuple)

native_resolution instance-attribute

native_resolution: int | None

alternative_names class-attribute instance-attribute

alternative_names: tuple[str, ...] = field(
    default_factory=tuple
)

__init__

__init__(
    native_resolution: int | None,
    alternative_names: tuple[str, ...] = tuple(),
) -> None

MODEL_STYLE

Bases: StrEnum

An enum of all the model styles.

Source code in src/horde_model_reference/model_consts/shared.py
class MODEL_STYLE(StrEnum):
    """An enum of all the model styles."""

    generalist = auto()
    anime = auto()
    furry = auto()
    artistic = auto()
    other = auto()
    realistic = auto()

generalist class-attribute instance-attribute

generalist = auto()

anime class-attribute instance-attribute

anime = auto()

furry class-attribute instance-attribute

furry = auto()

artistic class-attribute instance-attribute

artistic = auto()

other class-attribute instance-attribute

other = auto()

realistic class-attribute instance-attribute

realistic = auto()

TEXT_BACKENDS

Bases: StrEnum

An enum of all the text backends.

Source code in src/horde_model_reference/model_consts/text.py
class TEXT_BACKENDS(StrEnum):
    """An enum of all the text backends."""

    aphrodite = auto()
    koboldcpp = auto()

aphrodite class-attribute instance-attribute

aphrodite = auto()

koboldcpp class-attribute instance-attribute

koboldcpp = auto()

MODEL_DOMAIN

Bases: StrEnum

The domain of a model, i.e., what it pertains to (image, text, video, etc.).

Source code in src/horde_model_reference/meta_consts.py
class MODEL_DOMAIN(StrEnum):
    """The domain of a model, i.e., what it pertains to (image, text, video, etc.)."""

    image = auto()
    text = auto()
    video = auto()
    audio = auto()
    rendered_3d = auto()

image class-attribute instance-attribute

image = auto()

text class-attribute instance-attribute

text = auto()

video class-attribute instance-attribute

video = auto()

audio class-attribute instance-attribute

audio = auto()

rendered_3d class-attribute instance-attribute

rendered_3d = auto()

MODEL_PURPOSE

Bases: StrEnum

The primary purpose of a model, for example, image generation or feature extraction.

Source code in src/horde_model_reference/meta_consts.py
class MODEL_PURPOSE(StrEnum):
    """The primary purpose of a model, for example, image generation or feature extraction."""

    generation = auto()
    """The model is the central part of a generative AI system."""

    post_processing = auto()
    """The model is used for post-processing user input or generation tasks."""

    auxiliary_or_patch = auto()
    """The model is an auxiliary or patch model, e.g. LoRA or ControlNet."""

    feature_extractor = auto()
    """The model is a feature extractor, e.g. CLIP or BLIP."""

    safety_checker = auto()
    """A special case of feature extraction."""

    miscellaneous = auto()
    """The model does not fit into any other category or is very specialized."""

generation class-attribute instance-attribute

generation = auto()

The model is the central part of a generative AI system.

post_processing class-attribute instance-attribute

post_processing = auto()

The model is used for post-processing user input or generation tasks.

auxiliary_or_patch class-attribute instance-attribute

auxiliary_or_patch = auto()

The model is an auxiliary or patch model, e.g. LoRA or ControlNet.

feature_extractor class-attribute instance-attribute

feature_extractor = auto()

The model is a feature extractor, e.g. CLIP or BLIP.

safety_checker class-attribute instance-attribute

safety_checker = auto()

A special case of feature extraction.

miscellaneous class-attribute instance-attribute

miscellaneous = auto()

The model does not fit into any other category or is very specialized.

ModelClassification

Bases: BaseModel

Contains specific information about how to categorize a model.

This includes the model's MODEL_DOMAIN and MODEL_PURPOSE.

Source code in src/horde_model_reference/meta_consts.py
class ModelClassification(BaseModel):
    """Contains specific information about how to categorize a model.

    This includes the model's `MODEL_DOMAIN` and `MODEL_PURPOSE`.
    """

    domain: MODEL_DOMAIN
    """The domain of the model, i.e., what it pertains to (image, text, video, etc.)"""

    purpose: MODEL_PURPOSE
    """The purpose of the model."""

    @model_validator(mode="after")
    def validator_known_purpose(self) -> ModelClassification:
        """Check if the purpose is known."""
        if not is_known_model_purpose(str(self.purpose)):
            logger.debug(f"Unknown purpose {self.purpose} for model classification {self}")
        if not is_known_model_domain(str(self.domain)):
            logger.debug(f"Unknown domain {self.domain} for model classification {self}")

        return self

domain instance-attribute

domain: MODEL_DOMAIN

The domain of the model, i.e., what it pertains to (image, text, video, etc.)

purpose instance-attribute

purpose: MODEL_PURPOSE

The purpose of the model.

validator_known_purpose

validator_known_purpose() -> ModelClassification

Check if the purpose is known.

Source code in src/horde_model_reference/meta_consts.py
@model_validator(mode="after")
def validator_known_purpose(self) -> ModelClassification:
    """Check if the purpose is known."""
    if not is_known_model_purpose(str(self.purpose)):
        logger.debug(f"Unknown purpose {self.purpose} for model classification {self}")
    if not is_known_model_domain(str(self.domain)):
        logger.debug(f"Unknown domain {self.domain} for model classification {self}")

    return self

MODEL_REFERENCE_CATEGORY

Bases: StrEnum

The categories of model reference entries.

Source code in src/horde_model_reference/meta_consts.py
class MODEL_REFERENCE_CATEGORY(StrEnum):
    """The categories of model reference entries."""

    blip = auto()
    clip = auto()
    codeformer = auto()
    controlnet = auto()
    esrgan = auto()
    gfpgan = auto()
    safety_checker = auto()
    image_generation = auto()
    text_generation = auto()
    video_generation = auto()
    audio_generation = auto()
    miscellaneous = auto()
    lora = auto()
    ti = auto()

blip class-attribute instance-attribute

blip = auto()

clip class-attribute instance-attribute

clip = auto()

codeformer class-attribute instance-attribute

codeformer = auto()

controlnet class-attribute instance-attribute

controlnet = auto()

esrgan class-attribute instance-attribute

esrgan = auto()

gfpgan class-attribute instance-attribute

gfpgan = auto()

safety_checker class-attribute instance-attribute

safety_checker = auto()

image_generation class-attribute instance-attribute

image_generation = auto()

text_generation class-attribute instance-attribute

text_generation = auto()

video_generation class-attribute instance-attribute

video_generation = auto()

audio_generation class-attribute instance-attribute

audio_generation = auto()

miscellaneous class-attribute instance-attribute

miscellaneous = auto()

lora class-attribute instance-attribute

lora = auto()

ti class-attribute instance-attribute

ti = auto()

CategoryDescriptor dataclass

Describes a model reference category's traits in a single place.

Source code in src/horde_model_reference/meta_consts.py
@dataclass(frozen=True)
class CategoryDescriptor:
    """Describes a model reference category's traits in a single place."""

    domain: MODEL_DOMAIN
    """The ``MODEL_DOMAIN`` this category belongs to, e.g. image, text, video, etc."""
    purpose: MODEL_PURPOSE
    """The ``MODEL_PURPOSE`` of models in this category, e.g. generation, feature extraction, etc."""
    github_source: Literal["image", "text"] | None = None
    """Whether a legacy-format JSON file exists for this category. (e.g., ``"image"`` or ``"text"``).
    ``None`` means the category has no legacy GitHub source.
    """
    has_legacy_format: bool = True
    """Whether a legacy-format JSON file exists for this category."""
    managed_elsewhere: bool = False
    """Whether this category is managed by an external system."""
    filename_override: str | None = None
    """Non-default v2 filename (default is ``{category}.json``)."""
    legacy_filename_override: str | None = None
    """Non-default legacy filename (default matches v2)."""

domain instance-attribute

domain: MODEL_DOMAIN

The MODEL_DOMAIN this category belongs to, e.g. image, text, video, etc.

purpose instance-attribute

purpose: MODEL_PURPOSE

The MODEL_PURPOSE of models in this category, e.g. generation, feature extraction, etc.

github_source class-attribute instance-attribute

github_source: Literal['image', 'text'] | None = None

Whether a legacy-format JSON file exists for this category. (e.g., "image" or "text"). None means the category has no legacy GitHub source.

has_legacy_format class-attribute instance-attribute

has_legacy_format: bool = True

Whether a legacy-format JSON file exists for this category.

managed_elsewhere class-attribute instance-attribute

managed_elsewhere: bool = False

Whether this category is managed by an external system.

filename_override class-attribute instance-attribute

filename_override: str | None = None

Non-default v2 filename (default is {category}.json).

legacy_filename_override class-attribute instance-attribute

legacy_filename_override: str | None = None

Non-default legacy filename (default matches v2).

__init__

__init__(
    domain: MODEL_DOMAIN,
    purpose: MODEL_PURPOSE,
    github_source: Literal["image", "text"] | None = None,
    has_legacy_format: bool = True,
    managed_elsewhere: bool = False,
    filename_override: str | None = None,
    legacy_filename_override: str | None = None,
) -> None

get_all_registered_baselines

get_all_registered_baselines() -> dict[
    KNOWN_IMAGE_GENERATION_BASELINE | str,
    BaselineDescriptor,
]

Return a shallow copy of the baseline registry.

This includes both built-in KNOWN_IMAGE_GENERATION_BASELINE members and any externally registered baselines.

Source code in src/horde_model_reference/model_consts/image.py
def get_all_registered_baselines() -> dict[KNOWN_IMAGE_GENERATION_BASELINE | str, BaselineDescriptor]:
    """Return a shallow copy of the baseline registry.

    This includes both built-in ``KNOWN_IMAGE_GENERATION_BASELINE`` members and
    any externally registered baselines.
    """
    return _IMAGE_BASELINE_REGISTRY.all()

get_baseline_descriptor

get_baseline_descriptor(
    baseline: KNOWN_IMAGE_GENERATION_BASELINE | str,
) -> BaselineDescriptor

Return the BaselineDescriptor for baseline.

Parameters:

Raises:

  • KeyError

    If the baseline is not registered.

Source code in src/horde_model_reference/model_consts/image.py
def get_baseline_descriptor(baseline: KNOWN_IMAGE_GENERATION_BASELINE | str) -> BaselineDescriptor:
    """Return the ``BaselineDescriptor`` for *baseline*.

    Args:
        baseline: The known image generation baseline (enum member or plain string).

    Raises:
        KeyError: If the baseline is not registered.

    """
    return _IMAGE_BASELINE_REGISTRY.get(baseline)

get_baseline_native_resolution

get_baseline_native_resolution(
    baseline: KNOWN_IMAGE_GENERATION_BASELINE | str,
) -> int

Get the native resolution of a stable diffusion baseline.

Parameters:

Returns:

  • int

    The native resolution of the baseline.

Source code in src/horde_model_reference/model_consts/image.py
def get_baseline_native_resolution(baseline: KNOWN_IMAGE_GENERATION_BASELINE | str) -> int:
    """Get the native resolution of a stable diffusion baseline.

    Args:
        baseline: The stable diffusion baseline (enum member or plain string).

    Returns:
        The native resolution of the baseline.

    """
    return IMAGE_GENERATION_BASELINE_NATIVE_RESOLUTION_LOOKUP[baseline]

get_baselines_by_resolution

get_baselines_by_resolution(
    resolution: int,
) -> list[KNOWN_IMAGE_GENERATION_BASELINE | str]

Get all baselines that have the given native resolution.

Parameters:

  • resolution (int) –

    The native resolution to look for.

Returns:

Source code in src/horde_model_reference/model_consts/image.py
def get_baselines_by_resolution(resolution: int) -> list[KNOWN_IMAGE_GENERATION_BASELINE | str]:
    """Get all baselines that have the given native resolution.

    Args:
        resolution: The native resolution to look for.

    Returns:
        A list of baselines that have the given native resolution.

    """
    return [
        baseline
        for baseline, native_resolution in IMAGE_GENERATION_BASELINE_NATIVE_RESOLUTION_LOOKUP.items()
        if native_resolution == resolution
    ]

is_known_controlnet_style

is_known_controlnet_style(
    style: CONTROLNET_STYLE | str,
) -> bool

Check if a ControlNet style is known.

Source code in src/horde_model_reference/model_consts/image.py
def is_known_controlnet_style(style: CONTROLNET_STYLE | str) -> bool:
    """Check if a ControlNet style is known."""
    return _CONTROLNET_STYLE_REGISTRY.is_known(style)

is_known_image_baseline

is_known_image_baseline(baseline: str) -> bool

Return True if baseline is a known baseline or alternative name.

Parameters:

  • baseline (str) –

    The baseline name to check.

Returns:

  • bool

    True if the baseline is known, False otherwise.

Source code in src/horde_model_reference/model_consts/image.py
def is_known_image_baseline(baseline: str) -> bool:
    """Return True if *baseline* is a known baseline or alternative name.

    Args:
        baseline: The baseline name to check.

    Returns:
        True if the baseline is known, False otherwise.

    """
    return _IMAGE_BASELINE_REGISTRY.contains(baseline) or baseline in _ALTERNATIVE_NAME_TO_BASELINE

register_controlnet_style

register_controlnet_style(
    style: CONTROLNET_STYLE | str,
) -> None

Register a new ControlNet style.

Source code in src/horde_model_reference/model_consts/image.py
def register_controlnet_style(style: CONTROLNET_STYLE | str) -> None:
    """Register a new ControlNet style."""
    _CONTROLNET_STYLE_REGISTRY.register(style)

register_image_baseline

register_image_baseline(
    name: KNOWN_IMAGE_GENERATION_BASELINE | str,
    descriptor: BaselineDescriptor,
) -> None

Register a new image-generation baseline.

Source code in src/horde_model_reference/model_consts/image.py
def register_image_baseline(name: KNOWN_IMAGE_GENERATION_BASELINE | str, descriptor: BaselineDescriptor) -> None:
    """Register a new image-generation baseline."""
    _IMAGE_BASELINE_REGISTRY.register(name, descriptor)

get_known_tags

get_known_tags() -> list[str]

Return a snapshot of all known tags as a list.

Source code in src/horde_model_reference/model_consts/shared.py
def get_known_tags() -> list[str]:
    """Return a snapshot of all known tags as a list."""
    return sorted(_TAG_REGISTRY.values())

is_known_model_style

is_known_model_style(style: MODEL_STYLE | str) -> bool

Check if a model style is known.

Source code in src/horde_model_reference/model_consts/shared.py
def is_known_model_style(style: MODEL_STYLE | str) -> bool:
    """Check if a model style is known."""
    return _MODEL_STYLE_REGISTRY.is_known(style)

is_known_tag

is_known_tag(tag: str | StrEnum) -> bool

Check if a tag is known.

Source code in src/horde_model_reference/model_consts/shared.py
def is_known_tag(tag: str | StrEnum) -> bool:
    """Check if a tag is known."""
    return _TAG_REGISTRY.is_known(tag)

register_model_style

register_model_style(style: MODEL_STYLE | str) -> None

Register a new model style.

Source code in src/horde_model_reference/model_consts/shared.py
def register_model_style(style: MODEL_STYLE | str) -> None:
    """Register a new model style."""
    _MODEL_STYLE_REGISTRY.register(style)

register_tag

register_tag(tag: str | StrEnum) -> None

Register a new known tag.

Source code in src/horde_model_reference/model_consts/shared.py
def register_tag(tag: str | StrEnum) -> None:
    """Register a new known tag."""
    _TAG_REGISTRY.register(tag)

is_known_text_backend

is_known_text_backend(backend: str) -> bool

Check if a text backend is known.

Parameters:

  • backend (str) –

    The text backend to check.

Returns:

  • bool

    True if the text backend is known, False otherwise.

Source code in src/horde_model_reference/model_consts/text.py
def is_known_text_backend(backend: str) -> bool:
    """Check if a text backend is known.

    Args:
        backend: The text backend to check.

    Returns:
        True if the text backend is known, False otherwise.

    """
    return _TEXT_BACKEND_REGISTRY.is_known(backend)

register_text_backend

register_text_backend(backend: str) -> None

Register a new text backend.

Parameters:

  • backend (str) –

    The text backend to register.

Source code in src/horde_model_reference/model_consts/text.py
def register_text_backend(backend: str) -> None:
    """Register a new text backend.

    Args:
        backend: The text backend to register.

    """
    _TEXT_BACKEND_REGISTRY.register(backend)

register_model_domain

register_model_domain(domain: MODEL_DOMAIN | str) -> None

Register a new model domain.

Source code in src/horde_model_reference/meta_consts.py
def register_model_domain(domain: MODEL_DOMAIN | str) -> None:
    """Register a new model domain."""
    _MODEL_DOMAIN_REGISTRY.register(domain)

is_known_model_domain

is_known_model_domain(domain: MODEL_DOMAIN | str) -> bool

Check if a model domain is known.

Source code in src/horde_model_reference/meta_consts.py
def is_known_model_domain(domain: MODEL_DOMAIN | str) -> bool:
    """Check if a model domain is known."""
    return _MODEL_DOMAIN_REGISTRY.is_known(domain)

register_model_purpose

register_model_purpose(
    purpose: MODEL_PURPOSE | str,
) -> None

Register a new model purpose.

Source code in src/horde_model_reference/meta_consts.py
def register_model_purpose(purpose: MODEL_PURPOSE | str) -> None:
    """Register a new model purpose."""
    _MODEL_PURPOSE_REGISTRY.register(purpose)

is_known_model_purpose

is_known_model_purpose(
    purpose: MODEL_PURPOSE | str,
) -> bool

Check if a model purpose is known.

Source code in src/horde_model_reference/meta_consts.py
def is_known_model_purpose(purpose: MODEL_PURPOSE | str) -> bool:
    """Check if a model purpose is known."""
    return _MODEL_PURPOSE_REGISTRY.is_known(purpose)

_rebuild_category_derived_data

_rebuild_category_derived_data(
    data: dict[
        MODEL_REFERENCE_CATEGORY | str, CategoryDescriptor
    ],
) -> None

Rebuild derived category data from the registry.

Source code in src/horde_model_reference/meta_consts.py
def _rebuild_category_derived_data(
    data: dict[MODEL_REFERENCE_CATEGORY | str, CategoryDescriptor],
) -> None:
    """Rebuild derived category data from the registry."""
    global github_image_model_reference_categories
    global github_text_model_reference_categories
    global no_legacy_format_available_categories
    global categories_managed_elsewhere

    github_image_model_reference_categories = [c for c, d in data.items() if d.github_source == "image"]
    github_text_model_reference_categories = [c for c, d in data.items() if d.github_source == "text"]
    no_legacy_format_available_categories = [c for c, d in data.items() if not d.has_legacy_format]
    categories_managed_elsewhere = [c for c, d in data.items() if d.managed_elsewhere]

    MODEL_CLASSIFICATION_LOOKUP.clear()
    MODEL_CLASSIFICATION_LOOKUP.update(
        {c: ModelClassification(domain=d.domain, purpose=d.purpose) for c, d in data.items()}
    )

register_category

register_category(
    name: MODEL_REFERENCE_CATEGORY | str,
    descriptor: CategoryDescriptor,
) -> None

Register a new model reference category.

Source code in src/horde_model_reference/meta_consts.py
def register_category(name: MODEL_REFERENCE_CATEGORY | str, descriptor: CategoryDescriptor) -> None:
    """Register a new model reference category."""
    _CATEGORY_REGISTRY.register(name, descriptor)

get_github_image_categories

get_github_image_categories() -> list[
    MODEL_REFERENCE_CATEGORY | str
]

Return categories whose legacy JSON lives in the image GitHub repo.

Source code in src/horde_model_reference/meta_consts.py
def get_github_image_categories() -> list[MODEL_REFERENCE_CATEGORY | str]:
    """Return categories whose legacy JSON lives in the image GitHub repo."""
    return list(github_image_model_reference_categories)

get_github_text_categories

get_github_text_categories() -> list[
    MODEL_REFERENCE_CATEGORY | str
]

Return categories whose legacy JSON lives in the text GitHub repo.

Source code in src/horde_model_reference/meta_consts.py
def get_github_text_categories() -> list[MODEL_REFERENCE_CATEGORY | str]:
    """Return categories whose legacy JSON lives in the text GitHub repo."""
    return list(github_text_model_reference_categories)

get_no_legacy_format_categories

get_no_legacy_format_categories() -> list[
    MODEL_REFERENCE_CATEGORY | str
]

Return categories that have no legacy-format JSON file.

Source code in src/horde_model_reference/meta_consts.py
def get_no_legacy_format_categories() -> list[MODEL_REFERENCE_CATEGORY | str]:
    """Return categories that have no legacy-format JSON file."""
    return list(no_legacy_format_available_categories)

get_model_classification

get_model_classification(
    category: MODEL_REFERENCE_CATEGORY | str,
) -> ModelClassification

Return the ModelClassification for category, or raise KeyError.

Source code in src/horde_model_reference/meta_consts.py
def get_model_classification(
    category: MODEL_REFERENCE_CATEGORY | str,
) -> ModelClassification:
    """Return the ModelClassification for *category*, or raise KeyError."""
    return MODEL_CLASSIFICATION_LOOKUP[category]

get_category_descriptor

get_category_descriptor(
    category: MODEL_REFERENCE_CATEGORY | str,
) -> CategoryDescriptor

Return the CategoryDescriptor for category.

Raises:

  • KeyError

    If the category is not registered.

Source code in src/horde_model_reference/meta_consts.py
def get_category_descriptor(category: MODEL_REFERENCE_CATEGORY | str) -> CategoryDescriptor:
    """Return the ``CategoryDescriptor`` for *category*.

    Raises:
        KeyError: If the category is not registered.

    """
    return _CATEGORY_REGISTRY.get(category)

get_all_registered_categories

get_all_registered_categories() -> dict[
    MODEL_REFERENCE_CATEGORY | str, CategoryDescriptor
]

Return a shallow copy of the category registry.

Source code in src/horde_model_reference/meta_consts.py
def get_all_registered_categories() -> dict[MODEL_REFERENCE_CATEGORY | str, CategoryDescriptor]:
    """Return a shallow copy of the category registry."""
    return _CATEGORY_REGISTRY.all()