text_backend_names
Text backend name manipulation utilities.
Functions for detecting, stripping, and generating text-backend-prefixed model name variants used in the legacy Horde API format.
TEXT_LEGACY_BACKEND_PREFIXES
module-attribute
TEXT_LEGACY_BACKEND_PREFIXES: dict[TEXT_BACKENDS, str] = {
aphrodite: "aphrodite/",
koboldcpp: "koboldcpp/",
}
Backend prefixes on duplicate entries for backwards compatibility in the legacy format.
has_legacy_text_backend_prefix
Check if a model name has a legacy text backend prefix.
Parameters:
-
model_name(str) –The model name to check.
Returns:
-
bool–True if the model name has a legacy text backend prefix, False otherwise.
Source code in src/horde_model_reference/text_backend_names.py
strip_backend_prefix
Strip backend prefix from a model name if present.
Parameters:
-
model_name(str) –The model name to strip.
Returns:
-
str–The model name without the backend prefix.
Example
strip_backend_prefix("koboldcpp/Broken-Tutu-24B") 'Broken-Tutu-24B' strip_backend_prefix("aphrodite/ReadyArt/Broken-Tutu-24B") 'ReadyArt/Broken-Tutu-24B' strip_backend_prefix("ReadyArt/Broken-Tutu-24B") 'ReadyArt/Broken-Tutu-24B'
Source code in src/horde_model_reference/text_backend_names.py
validate_not_backend_prefixed
Reject model names that start with a known or unknown backend-like prefix.
Writes should always use the canonical (unprefixed) model name. Backend-prefixed
duplicates are generated automatically. This function raises ValueError if the
name looks like it was submitted with a backend prefix.
Parameters:
-
model_name(str) –The model name to validate.
Raises:
-
ValueError–If the model name starts with a known backend prefix or matches the
<word>/pattern where<word>is a single lowercase ASCII token that could be mistaken for a backend prefix (e.g.,vllm/SomeModel). Legitimate author-prefixed names likeReadyArt/Modelare allowed because the author segment typically contains uppercase letters or digits.
Source code in src/horde_model_reference/text_backend_names.py
get_model_name_variants
Get all possible name variants for a canonical model name.
Given a canonical name like "ReadyArt/Broken-Tutu-24B", returns all possible variants that might appear in the Horde API stats: - Canonical: ReadyArt/Broken-Tutu-24B - Aphrodite: aphrodite/ReadyArt/Broken-Tutu-24B (prefix + full canonical name) - KoboldCpp: koboldcpp/Broken-Tutu-24B (prefix + model name only)
Parameters:
-
canonical_name(str) –The canonical model name from the model reference.
Returns:
Example
get_model_name_variants("ReadyArt/Broken-Tutu-24B") ['ReadyArt/Broken-Tutu-24B', 'aphrodite/ReadyArt/Broken-Tutu-24B', 'koboldcpp/Broken-Tutu-24B']