Package bg.codexio.ai.openai.api.http
Class AuthenticationInterceptor
- java.lang.Object
-
- bg.codexio.ai.openai.api.http.AuthenticationInterceptor
-
- All Implemented Interfaces:
okhttp3.Interceptor
public class AuthenticationInterceptor extends Object implements okhttp3.Interceptor
OkHttpinterceptor type for OpenAI authentication
-
-
Constructor Summary
Constructors Constructor Description AuthenticationInterceptor(HttpExecutorContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description okhttp3.Responseintercept(okhttp3.Interceptor.Chain chain)Sends theApiCredentials.apiKey()as a Bearer token.
-
-
-
Constructor Detail
-
AuthenticationInterceptor
public AuthenticationInterceptor(HttpExecutorContext context)
- Parameters:
context- passed along the HTTP configuration, mainly the credentials
-
-
Method Detail
-
intercept
@NotNull public okhttp3.Response intercept(@NotNull okhttp3.Interceptor.Chain chain) throws IOExceptionSends theApiCredentials.apiKey()as a Bearer token. In addition, sets OpenAI-Organization ifApiCredentials.organization()is present.- Specified by:
interceptin interfaceokhttp3.Interceptor- Throws:
IOException
-
-