Class OpenAiDecisionModel.OpenAiDecisionModelBuilder
java.lang.Object
dev.langchain4j.model.openai.OpenAiDecisionModel.OpenAiDecisionModelBuilder
- Enclosing class:
OpenAiDecisionModel
- Since:
- 1.22.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe base URL of the API.build()customHeaders(Supplier<Map<String, String>> customHeadersSupplier) Sets a supplier for custom HTTP headers.customHeaders(Map<String, String> customHeaders) Sets custom HTTP headers.customQueryParams(Map<String, String> customQueryParams) httpClientBuilder(HttpClientBuilder httpClientBuilder) Sets a custom HTTP client builder, allowing fine-grained control over the HTTP client configuration such as timeouts and proxy settings.listeners(DecisionModelListener... listeners) listeners(List<DecisionModelListener> listeners) logger(org.slf4j.Logger logger) logRequests(Boolean logRequests) Whether to log requests.logResponses(Boolean logResponses) Whether to log responses.maxRetries(Integer maxRetries) The number of retries after the first attempt, for transient errors such as timeouts, rate limits and server errors.modelName(OpenAiDecisionModelName modelName) The model to use when a request does not specify one.The model to use when a request does not specify one, for examplegpt-6-luna.organizationId(String organizationId) The connect and read timeout.
-
Constructor Details
-
OpenAiDecisionModelBuilder
public OpenAiDecisionModelBuilder()
-
-
Method Details
-
httpClientBuilder
public OpenAiDecisionModel.OpenAiDecisionModelBuilder httpClientBuilder(HttpClientBuilder httpClientBuilder) Sets a custom HTTP client builder, allowing fine-grained control over the HTTP client configuration such as timeouts and proxy settings. -
baseUrl
The base URL of the API. Defaults tohttps://api.openai.com/v1. -
apiKey
-
organizationId
-
projectId
-
modelName
The model to use when a request does not specify one, for examplegpt-6-luna. The model name must be set either here or on each request. -
modelName
The model to use when a request does not specify one. The model name must be set either here or on each request. -
timeout
The connect and read timeout. Default values are 15 seconds (connect) and 60 seconds (read). -
maxRetries
The number of retries after the first attempt, for transient errors such as timeouts, rate limits and server errors. Default value is 2. -
logRequests
Whether to log requests. Default value isfalse. -
logResponses
Whether to log responses. Default value isfalse. -
logger
- Parameters:
logger- an alternateLoggerto be used instead of the default one provided by LangChain4j for logging requests and responses.- Returns:
this.
-
customHeaders
public OpenAiDecisionModel.OpenAiDecisionModelBuilder customHeaders(Map<String, String> customHeaders) Sets custom HTTP headers. -
customHeaders
public OpenAiDecisionModel.OpenAiDecisionModelBuilder customHeaders(Supplier<Map<String, String>> customHeadersSupplier) Sets a supplier for custom HTTP headers. The supplier is called before each request, allowing dynamic header values. For example, this is useful for OAuth2 tokens that expire and need refreshing. -
customQueryParams
public OpenAiDecisionModel.OpenAiDecisionModelBuilder customQueryParams(Map<String, String> customQueryParams) -
listeners
public OpenAiDecisionModel.OpenAiDecisionModelBuilder listeners(List<DecisionModelListener> listeners) -
listeners
-
build
-