Class FromEnvironment
- java.lang.Object
-
- bg.codexio.ai.openai.api.sdk.auth.FromEnvironment
-
- All Implemented Interfaces:
SdkAuth
public class FromEnvironment extends Object implements SdkAuth
When instantiated andcredentials()is called, series of environment variables will be scanned to provide necessaryApiCredentials. The expected environment variables names can be checked inAvailableEnvironmentVariables
-
-
Field Summary
Fields Modifier and Type Field Description static FromEnvironmentAUTH
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description bg.codexio.ai.openai.api.payload.credentials.ApiCredentialscredentials()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 usedprotected StringgetEnv(String key)
-
-
-
Field Detail
-
AUTH
public static final FromEnvironment AUTH
-
-
Method Detail
-
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
-
-