Class FromEnvironment
java.lang.Object
bg.codexio.ai.openai.api.sdk.auth.FromEnvironment
- All Implemented Interfaces:
SdkAuth
When instantiated and
credentials() is called, series of
environment variables will be scanned to provide necessary
ApiCredentials.
The expected environment variables names can be checked in
AvailableEnvironmentVariables-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbg.codexio.ai.openai.api.payload.credentials.ApiCredentialsIn this implementation we first look for the api key in the environment variables
If this variable is missing, aNotValidAuthenticationMethoderror is thrown, as the authentication can never proceed without an api key.
If organization id is configured, it is applied, otherwise the default empty value is usedprotected String
-
Field Details
-
AUTH
-
-
Method Details
-
credentials
public bg.codexio.ai.openai.api.payload.credentials.ApiCredentials credentials()In this implementation we first look for the api key in the environment variables
If this variable is missing, aNotValidAuthenticationMethoderror is thrown, as the authentication can never proceed without an api key.
If organization id is configured, it is applied, otherwise the default empty value is used- Specified by:
credentialsin interfaceSdkAuth- Returns:
- ready for usage instance of
ApiCredentials
-
getEnv
-