Class Chat
- java.lang.Object
-
- bg.codexio.ai.openai.api.sdk.chat.Chat
-
public final class Chat extends Object
Entrypoint for Chat Completions API.
The interaction starts by configuring the HTTP connection
either by providing a preconfiguredChatHttpExecutorhttp client,
HttpExecutorContext,SdkAuthor leave it todefaults().
Further configuration happens on multiple bypassable stages, whatever is important for specific needs.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpBuilder<AIModelStage>authenticate(HttpExecutorContext context)static HttpBuilder<AIModelStage>authenticate(SdkAuth auth)Authenticates against OpenAI API with an implementation ofSdkAuth.static HttpBuilder<AIModelStage>defaults()Authenticates against OpenAPI with the first success fromFromEnvironmentandFromJson
authentication methods.static ImmediateContextStagesimply()Authenticates against OpenAPI with the first success fromFromEnvironmentandFromJson
authentication methods.static ImmediateContextStagesimply(SdkAuth auth)Authenticates against OpenAI API with an implementation ofSdkAuthand preconfigures simpleGPT35TurboModelfor prompting.static AIModelStagethroughHttp(ChatHttpExecutor httpExecutor)
-
-
-
Method Detail
-
throughHttp
public static AIModelStage throughHttp(ChatHttpExecutor httpExecutor)
- Parameters:
httpExecutor- ConfiguredChatHttpExecutorwith manually setHttpExecutorContext,OkHttpClientand/orObjectMapper.- Returns:
AIModelStageto configure the necessaryModelType
-
authenticate
public static HttpBuilder<AIModelStage> authenticate(HttpExecutorContext context)
Authenticates against OpenAI API with manually supplied
ApiCredentialsandHttpTimeouts. Mostly used if credentials
are fetched from external source.- Parameters:
context-HttpExecutorContext- Returns:
HttpBuilderso timeouts can be reconfigured and possiblyObjectMapperis supplied.
-
authenticate
public static HttpBuilder<AIModelStage> authenticate(SdkAuth auth)
Authenticates against OpenAI API with an implementation ofSdkAuth.- Parameters:
auth- of typeSdkAuth
Allows you to choose from one of the default authentication methods
Options:FromDeveloper,FromJson,FromEnvironment- Returns:
HttpBuilderso timeouts can be reconfigured and possiblyObjectMapperis supplied.
-
simply
public static ImmediateContextStage simply(SdkAuth auth)
Authenticates against OpenAI API with an implementation ofSdkAuthand preconfigures simpleGPT35TurboModelfor prompting.- Parameters:
auth- of typeSdkAuth
Allows you to choose from one of the default authentication methods
Options:FromDeveloper,FromJson,FromEnvironment- Returns:
ImmediateContextStage
-
simply
public static ImmediateContextStage simply()
Authenticates against OpenAPI with the first success fromFromEnvironmentandFromJson
authentication methods. Preconfigures simpleGPT35TurboModelfor prompting.- Returns:
ImmediateContextStage
-
defaults
public static HttpBuilder<AIModelStage> defaults()
Authenticates against OpenAPI with the first success fromFromEnvironmentandFromJson
authentication methods. All other configurations can be manually customized- Returns:
HttpBuilderso timeouts can be reconfigured and possiblyObjectMapperis supplied.
-
-