yera.setup.base

Define the common result and interfaces used during interactive setup.

Symbols

class ModelSetup — Obtain and validate model configuration for one provider connection.
class ProviderSetup — Obtain and validate configuration for one provider integration.
class SetupResult — Describe configuration and diagnostics produced during setup.

ModelSetup

Inherits: ABC, Generic[TConnection]

Obtain 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

provider_type
type: str

Configuration key identifying the provider.

dependencies
type: tuple[str, ...]

Python import paths required by the integration.

connection_name

Name of the provider connection used for setup.

connection

Typed provider connection used to obtain model configuration.

Methods

get_config — Obtain model configuration from the bound provider connection.
validate — Validate model configuration without persisting it.

ModelSetup.get_config

get_config() → SetupResult[list[BaseModelConfig]]

Obtain model configuration from the bound provider connection.

Returns

type: SetupResult[list[BaseModelConfig]]

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[BaseModelConfig],
) → SetupResult[list[BaseModelConfig]]

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

config
type: list[BaseModelConfig]

Model configuration obtained or supplied during setup.

Returns

type: SetupResult[list[BaseModelConfig]]

A valid result containing the supplied model configuration.

ProviderSetup

Inherits: ABC, Generic[TConnection]

Obtain 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

provider_type
type: str

Configuration key identifying the provider.

dependencies
type: tuple[str, ...]

Python import paths required by the integration.

Methods

get_config — Obtain provider configuration candidates from the environment.
validate — Validate provider configuration without persisting it.

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

type: SetupResult[tuple[TConnection, ...]]

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,
) → 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

config
type: TConnection

Provider connection configuration to validate.

Returns

type: SetupResult[TConnection]

The supplied configuration and its validation diagnostics.

SetupResult

Inherits: 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.

Attributes

config
type: TConfig | None

Configuration obtained or validated by the operation.

errors
type: list[str]

Problems that prevent the configuration from being used.

warnings
type: list[str]

Recoverable problems that do not prevent configuration.

skipped
type: int

Number of items intentionally omitted while obtaining configuration.