public abstract static class OpenAiClient.Builder<T extends OpenAiClient,B extends OpenAiClient.Builder<T,B>> extends Object
| Modifier and Type | Field and Description |
|---|---|
String |
apiVersion |
String |
azureApiKey |
String |
baseUrl |
Duration |
callTimeout |
Duration |
connectTimeout |
boolean |
logRequests |
boolean |
logResponses |
boolean |
logStreamingResponses |
String |
openAiApiKey |
Proxy |
proxy |
Duration |
readTimeout |
Duration |
writeTimeout |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
B |
apiVersion(String apiVersion) |
B |
azureApiKey(String azureApiKey) |
B |
baseUrl(String baseUrl) |
abstract T |
build() |
B |
callTimeout(Duration callTimeout) |
B |
connectTimeout(Duration connectTimeout) |
B |
logRequests() |
B |
logRequests(Boolean logRequests) |
B |
logResponses() |
B |
logResponses(Boolean logResponses) |
B |
logStreamingResponses() |
B |
logStreamingResponses(Boolean logStreamingResponses) |
B |
openAiApiKey(String openAiApiKey) |
B |
proxy(Proxy.Type type,
String ip,
int port) |
B |
proxy(Proxy proxy) |
B |
readTimeout(Duration readTimeout) |
B |
writeTimeout(Duration writeTimeout) |
public String baseUrl
public String apiVersion
public String openAiApiKey
public String azureApiKey
public Duration callTimeout
public Duration connectTimeout
public Duration readTimeout
public Duration writeTimeout
public Proxy proxy
public boolean logRequests
public boolean logResponses
public boolean logStreamingResponses
public abstract T build()
public B baseUrl(String baseUrl)
baseUrl - Base URL of OpenAI API.
For OpenAI (default): "https://api.openai.com/v1/"
For Azure OpenAI: "https://{resource-name}.openai.azure.com/openai/deployments/{deployment-id}/"public B apiVersion(String apiVersion)
apiVersion - Version of the API in the YYYY-MM-DD format. Applicable only for Azure OpenAI.public B openAiApiKey(String openAiApiKey)
openAiApiKey - OpenAI API key.
Will be injected in HTTP headers like this: "Authorization: Bearer ${openAiApiKey}"public B azureApiKey(String azureApiKey)
azureApiKey - Azure API key.
Will be injected in HTTP headers like this: "api-key: ${azureApiKey}"public B proxy(Proxy.Type type, String ip, int port)
public B logRequests()
public B logResponses()
public B logStreamingResponses()
Copyright © 2023. All rights reserved.