yera.config.schema.models

Model schema — universe of all discovered models and runtime catalog view.

Symbols

class BaseModelConfig — Fields common to all model types.
class EmbeddingsConfig — Config for an embeddings model.
class LLMConfig — Config for a large language model.
class ModelCatalogue — Runtime view of the model universe filtered to the active Yera profile.
class ModelsUniverse — All discovered models across all provider connections.
class RerankerConfig — Config for a reranker model.
class STTConfig — Config for a speech-to-text model.
class TTSConfig — Config for a text-to-speech model.
class TypedCatalogue — A filtered runtime view of models of one type for the active Yera profile.

BaseModelConfig

Inherits: BaseModel

Fields common to all model types.

Attributes

id
type: str

Yera-internal dot-delimited identifier. Must have at least three segments: <provider>.<author>.<model_name>, with optional further nesting for variants e.g. llama_cpp.meta.llama3.8b.q4_k_m. Does not encode the connection name — that is stored separately in connection.

model_id
type: str

Provider-side model identifier passed directly to the API or library, e.g. "claude-sonnet-4-20250514" or a HuggingFace repo id like "meta-llama/Meta-Llama-3-8B-GGUF".

name
type: str

Human-readable display name, e.g. "Claude Sonnet 4".

provider
type: str

Key into :class:~yera.config.schema.providers.Providers identifying which provider serves this model, e.g. "aws".

connection
type: str

Name of the provider connection under which this model was discovered, e.g. "work". Together with provider, uniquely identifies the runtime interface and credentials to use.

author
type: str

Who created the model, e.g. "anthropic" or "meta". Distinct from provider — a Meta model can be served via AWS Bedrock.

Raises

ValueError

If id has fewer than three dot-delimited segments.

Methods

id_has_minimum_depth — Check that id has at least three dot-delimited segments.
id_prefix_matches_provider — Check that the first segment of id matches provider.

BaseModelConfig.id_has_minimum_depth

id_has_minimum_depth(
    v: str,
) → str

Check that id has at least three dot-delimited segments.

Parameters

v
type: str

The id string to validate.

Returns

type: str

The validated id string.

Raises

ValueError

If the id has fewer than three segments.

BaseModelConfig.id_prefix_matches_provider

id_prefix_matches_provider() → BaseModelConfig

Check that the first segment of id matches provider.

Returns

type: BaseModelConfig

The validated model config.

Raises

ValueError

If the first segment of id does not match provider.

EmbeddingsConfig

Inherits: BaseModelConfig

Config for an embeddings model.

Attributes

type
type: Literal['embedding']

Discriminator field, always "embedding".

dimensions
type: int | None

Size of the embedding vector produced by the model.

max_input_tokens
type: int | None

Maximum number of tokens the model can embed in a single request.

LLMConfig

Inherits: BaseModelConfig

Config for a large language model.

Attributes

type
type: Literal['llm']

Discriminator field, always "llm".

context_window
type: int | None

Maximum number of tokens the model can process in a single request (prompt + completion).

max_output_tokens
type: int | None

Maximum number of tokens the model can generate.

supports_vision
type: bool

Whether the model accepts image inputs.

ModelCatalogue

Inherits: BaseModel

Runtime view of the model universe filtered to the active Yera profile.

Never serialized — constructed by :meth:ModelsUniverse.for_profile. Contains only models whose provider and connection match the active Yera profile's provider map.

Attributes

llm
type: TypedCatalogue[LLMConfig]

Catalogue of large language models visible under the active profile.

embedding
type: TypedCatalogue[EmbeddingsConfig]

Catalogue of embeddings models visible under the active profile.

tts
type: TypedCatalogue[TTSConfig]

Catalogue of text-to-speech models visible under the active profile.

stt
type: TypedCatalogue[STTConfig]

Catalogue of speech-to-text models visible under the active profile.

reranker
type: TypedCatalogue[RerankerConfig]

Catalogue of reranker models visible under the active profile.

ModelsUniverse

Inherits: BaseModel

All discovered models across all provider connections.

Serialized to and from yera.toml under [models]. Contains no defaults — those live in :class:~yera.config.schema.profiles.Profile.

Attributes

llm
type: list[LLMConfig]

All discovered large language models.

embedding
type: list[EmbeddingsConfig]

All discovered embeddings models.

tts
type: list[TTSConfig]

All discovered text-to-speech models.

stt
type: list[STTConfig]

All discovered speech-to-text models.

reranker
type: list[RerankerConfig]

All discovered reranker models.

Methods

for_profile — Build a filtered runtime ``ModelCatalogue`` for the active Yera profile.

ModelsUniverse.for_profile

for_profile(
    profile: Profile,
) → ModelCatalogue

Build a filtered runtime ModelCatalogue for the active Yera profile.

Filters each model type list to models whose provider and connection match an entry in the profile's provider map, then inserts per-type defaults from the profile's model_defaults.

Parameters

profile
type: Profile

The active Yera profile to filter and resolve against.

Returns

type: ModelCatalogue

A ModelCatalogue containing only models visible under the active profile, with defaults populated from the profile.

RerankerConfig

Inherits: BaseModelConfig

Config for a reranker model.

Attributes

type
type: Literal['reranker']

Discriminator field, always "reranker".

STTConfig

Inherits: BaseModelConfig

Config for a speech-to-text model.

Attributes

type
type: Literal['stt']

Discriminator field, always "stt".

TTSConfig

Inherits: BaseModelConfig

Config for a text-to-speech model.

Attributes

type
type: Literal['tts']

Discriminator field, always "tts".

TypedCatalogue

Inherits: BaseModel, Generic[M]

A filtered runtime view of models of one type for the active Yera profile.

Never serialized — constructed at runtime by :meth:ModelsUniverse.for_profile. The default field is populated from the active :class:~yera.config.schema.profiles.Profile's model_defaults.

Attributes

models
type: dict[str, M]

Models of this type visible under the active Yera profile.

default
type: str | None

Yera id of the default model for this type, sourced from the active Yera profile. None if no default is configured — a runtime error when a default is actually needed.

Methods

default_exists — Check that the default model id exists in models.

TypedCatalogue.default_exists

default_exists() → TypedCatalogue

Check that the default model id exists in models.

Returns

type: TypedCatalogue

The validated catalogue.

Raises

ValueError

If default is set but not present in models.