When adding or extending client/provider integrations, enforce a single, predictable configuration-resolution contract:
api_version, region), accept an explicit argument, otherwise fall back to the corresponding environment variable(s). Only raise a clear error when neither is provided.base_url derived from region), then copy()/cloning/overrides must recompute or correctly forward dependent values so behavior matches the updated config.copy() clears/normalizes incompatible fields instead of forwarding stale state.__init__.py), update the generator configuration so the change persists across automated releases.Example patterns:
# 1) Env fallback + clear error
resolved_api_version = api_version or os.environ.get("OPENAI_API_VERSION")
if not resolved_api_version:
raise ValueError("Must provide api_version or set OPENAI_API_VERSION")
# 2) copy(): keep dependent config consistent
new_region = region or self._region
# ensure base_url is recalculated when region changes
_forward_base_url = {} if region else {"base_url": self.base_url}
# 3) copy(): normalize mutually-exclusive auth fields
# if switching to api_key, drop credential provider
forwarded_credential_provider = None if "api_key" in kwargs else (credential_provider or self._credential_provider)
Add unit tests that cover:
region → base_url),Enter the URL of a public GitHub repository