yera.setup.provider_setup.openai

Obtain and validate OpenAI provider configuration.

Symbols

class OpenAIProviderSetup — Provide presentation-independent OpenAI setup operations.

OpenAIProviderSetup

Provide presentation-independent OpenAI setup operations.

Automatic discovery looks for the conventional OpenAI API-key environment variable. Validation resolves the configured API-key reference from either the environment or the protected credential store, then checks its prefix and length locally. It does not contact OpenAI.

Attributes

provider_type

Configuration key for the OpenAI provider.

display_name

Human-readable provider name shown during setup.

dependencies

Python modules required by the integration.

connection_cls

OpenAI connection schema produced by the integration.

Methods

get_config — Obtain OpenAI configuration from the process environment.
validate — Validate an OpenAI connection's API-key reference locally.

OpenAIProviderSetup.get_config

get_config() → SetupResult[tuple[OpenAIConnection, ...]]

Obtain OpenAI configuration from the process environment.

Returns

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

A result containing one connection candidate referencing OPENAI_API_KEY when it is present. Otherwise, the result contains an empty candidate tuple.

OpenAIProviderSetup.validate

validate(
    config: OpenAIConnection,
    secret_store: SecretStore | None = None,
) → SetupResult[OpenAIConnection]

Validate an OpenAI connection's API-key reference locally.

The reference may point to an environment variable or an entry in the protected credential store. Validation checks the resolved key's prefix and length without contacting OpenAI.

Parameters

config
type: OpenAIConnection

OpenAI connection containing an API-key reference.

secret_store
type: SecretStore | None = None

Optional protected store used to resolve the API key.

Returns

type: SetupResult[OpenAIConnection]

The supplied configuration with errors describing a missing, empty, or implausibly formatted API key.