yera.providers.openai_common

Common infrastructure for accessing OpenAI services.

Symbols

def get_openai_client — Build an OpenAI client from a configured connection.

get_openai_client

get_openai_client(
    connection: OpenAIConnection,
    secret_store: SecretStore | None = None,
) → OpenAI

Build an OpenAI client from a configured connection.

Parameters

connection
type: OpenAIConnection

OpenAI connection containing an API-key reference.

secret_store
type: SecretStore | None = None

Optional store override for resolving a stored key.

Returns

type: OpenAI

OpenAI client authenticated with the resolved API key.

Raises

ProviderCredentialError

If the referenced API key cannot be resolved.