yera.setup.base
Define the common result and interfaces used during interactive setup.
Symbols
ModelSetup
ABC, Generic[TConnection]OpenAIModelSetup, LlamaCppModelSetup, OllamaModelSetup, GeminiModelSetup, OpenRouterModelSetup, AzureModelSetup, MistralModelSetup, AWSModelSetup, AnthropicModelSetupObtain and validate model configuration for one provider connection.
A model setup is bound to a configured provider connection. Implementations contain provider-specific discovery and validation but perform no prompting, rendering, or persistence. Expected client, credential, and service failures are returned as diagnostics.
Attributes
Configuration key identifying the provider.
Python import paths required by the integration.
Name of the provider connection used for setup.
Typed provider connection used to obtain model configuration.
Methods
ModelSetup.__init__
__init__(
connection_name: str,
connection: TConnection,
) → NoneInitialize model discovery for a named provider connection.
Parameters
Configuration name of the provider connection.
Typed connection used to discover available models.
ModelSetup.get_config
get_config() → SetupResult[list[ModelConfig]]Obtain model configuration from the bound provider connection.
Returns
Discovered model configuration and associated diagnostics. An empty model list is valid when discovery completed successfully without finding supported models.
ModelSetup.validate
validate(
config: list[ModelConfig],
) → SetupResult[list[ModelConfig]]Validate model configuration without persisting it.
Typed model configuration has already passed schema validation. This default implementation therefore accepts it unchanged. Implementations may override the method when a provider has additional semantic constraints.
Parameters
Model configuration obtained or supplied during setup.
Returns
A valid result containing the supplied model configuration.
ProviderSetup
ABC, Generic[TConnection]OpenAIProviderSetup, LlamaCppProviderSetup, OllamaProviderSetup, GeminiProviderSetup, OpenRouterProviderSetup, AzureProviderSetup, MistralProviderSetup, AWSProviderSetup, AnthropicProviderSetupObtain and validate configuration for one provider integration.
Provider setup implementations contain no prompting, rendering, or persistence. Expected environmental, credential, and connectivity failures are returned as diagnostics so callers can decide whether to retry, edit, skip, or display the failure.
Attributes
Configuration key identifying the provider.
Human-readable provider name shown during setup.
Python import paths required by the integration.
Typed connection schema produced by the integration.
Methods
ProviderSetup.connection_label
connection_label(
config: TConnection,
) → strReturn a human-readable label for a discovered connection.
API-key connections use their non-secret reference. Other connection types use their serialized configuration, allowing provider-specific implementations to override this with a more concise identifier.
Parameters
Discovered provider connection.
Returns
Stable label suitable for a connection-selection form.
ProviderSetup.get_config
get_config() → SetupResult[tuple[TConnection, ...]]Obtain provider configuration candidates from the environment.
Discovery may produce multiple usable connections, such as AWS profiles or Azure OpenAI accounts. Expected discovery failures are returned as errors rather than raised.
Returns
Detected provider connection candidates and associated diagnostics. An empty tuple means discovery completed without finding a candidate. None means discovery could not produce a result.
ProviderSetup.validate
validate(
config: TConnection,
secret_store: SecretStore | None = None,
) → SetupResult[TConnection]Validate provider configuration without persisting it.
Expected credential, configuration, and connectivity failures are returned as errors. Invalid configuration is retained in the result so an interactive caller can present or edit it.
Parameters
Provider connection configuration to validate.
Optional protected store used to resolve pending provider credentials.
Returns
The supplied configuration and its validation diagnostics.
SetupResult
Generic[TConfig]Describe configuration and diagnostics produced during setup.
Setup operations return expected environmental and configuration failures through this type rather than raising exceptions. A result may retain invalid configuration so an interactive caller can display or edit it.
Fields
Configuration obtained or validated by the operation.
Problems that prevent the configuration from being used.
Recoverable problems that do not prevent configuration.
Number of items intentionally omitted while obtaining configuration.
Methods
SetupResult.__init__
__init__(
config: TConfig | None = None,
errors: list[str] = list(),
warnings: list[str] = list(),
skipped: int = 0,
) → None