Class TypeSafeDecisionModel.TypeSafeDecisionModelBuilder
java.lang.Object
dev.langchain4j.model.typesafe.TypeSafeDecisionModel.TypeSafeDecisionModelBuilder
- Enclosing class:
TypeSafeDecisionModel
- Since:
- 1.21.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe API key.The 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.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) Sets the listeners that are notified of every request, response and error.logger(org.slf4j.Logger logger) An alternateLoggerto be used instead of the default one for logging requests and responses.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.The model to use when a request does not specify one, for examplejev-latest.The connect and read timeout.
-
Constructor Details
-
TypeSafeDecisionModelBuilder
public TypeSafeDecisionModelBuilder()
-
-
Method Details
-
httpClientBuilder
public TypeSafeDecisionModel.TypeSafeDecisionModelBuilder 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.typesafe.ai. Set it to use another server that implements the System One API. -
apiKey
The API key. Required when using the default base URL; optional for other servers. -
modelName
The model to use when a request does not specify one, for examplejev-latest. The model name must be set either here or on each request. -
timeout
The connect and read timeout. When not set, the timeouts of thehttpClientBuilder(HttpClientBuilder)are used, or 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
An alternateLoggerto be used instead of the default one for logging requests and responses. -
customHeaders
public TypeSafeDecisionModel.TypeSafeDecisionModelBuilder customHeaders(Map<String, String> customHeaders) Sets custom HTTP headers. -
customHeaders
public TypeSafeDecisionModel.TypeSafeDecisionModelBuilder 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 OAuth2 tokens that expire and need refreshing. -
listeners
public TypeSafeDecisionModel.TypeSafeDecisionModelBuilder listeners(List<DecisionModelListener> listeners) Sets the listeners that are notified of every request, response and error. -
listeners
public TypeSafeDecisionModel.TypeSafeDecisionModelBuilder listeners(DecisionModelListener... listeners) -
build
-