yera.ui.settings_state
Load and persist the configuration state exposed through Yera Settings.
Symbols
InvalidSettingsState
Invalid global configuration state shown by Settings.
load_settings_state
load_settings_state() → SettingsState | InvalidSettingsState | UnconfiguredSettingsStateLoad the configuration state required by the Settings UI.
Returns
A complete editable Settings state when configuration is valid, an invalid state containing diagnostics when the TOML is malformed or schema-invalid, or an unconfigured state when no profiles exist.
Raises
If profiles exist but no active profile can be resolved.
save_default_models
save_default_models(
state: SettingsState,
model_defaults: ProfileModelDefaults,
) → NonePersist model defaults for the active profile.
Parameters
Settings state containing the active profile and available model catalogue.
Model identifiers to store as defaults for each model type.
Returns
None.
Raises
If the configuration changed after the state was loaded.
If a selected model is unavailable to the active profile.
save_model_inference
save_model_inference(
state: SettingsState,
model_type: str,
model_id: str,
inference: LLMInference,
) → NonePersist default inference parameters for an existing model.
Parameters
Settings state containing the active model catalogue.
Catalogue type containing the model.
Yera identifier of the model to update.
Validated inference configuration to persist.
Returns
None.
Raises
If the configuration changed after the state was loaded.
If the model type or model is unavailable, the model has no editable inference settings, or the inference type is incorrect.
save_profile_settings
save_profile_settings(
state: SettingsState,
description: str | None,
providers: ProfileProviderConnections,
) → NonePersist editable settings belonging to the active profile.
Parameters
Settings state containing the active profile and configured providers.
Optional description to store on the active profile.
Provider connections selected by the active profile.
Returns
None.
Raises
If the configuration changed after the state was loaded.
If a selected provider connection does not exist.
save_provider_connection
save_provider_connection(
state: SettingsState,
provider_type: str,
connection_name: str,
connection: BaseConnection,
) → NonePersist changes to an existing provider connection.
Parameters
Settings state containing the configured provider connection.
Provider key containing the connection.
Name of the connection to update.
Validated connection configuration to persist.
Returns
None.
Raises
If the configuration changed after the state was loaded.
If the connection does not exist or its configuration type differs from the existing connection.
SettingsConflictError
RuntimeErrorConfiguration changed while a Settings form was open.
SettingsState
Configuration state required by the Settings UI.
UnconfiguredSettingsState
Global configuration state before a profile has been configured.