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 path of the System One endpoint, relative to thebase URL.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.customParameters(Map<String, Object> customParameters) Custom parameters added to the body of every request, for example to use a feature of the System One API that this class does not support yet.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. Requests are sent to the base URL followed by theAPI path. -
apiPath
The path of the System One endpoint, relative to thebase URL. Defaults tov1/systemone. Set it for servers that expose the System One API at another path.For example, with base URL
http://localhost:8100/gatewayand API pathv1/decision, requests are sent tohttp://localhost:8100/gateway/v1/decision. -
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. -
customParameters
public TypeSafeDecisionModel.TypeSafeDecisionModelBuilder customParameters(Map<String, Object> customParameters) Custom parameters added to the body of every request, for example to use a feature of the System One API that this class does not support yet. A custom parameter with the same name as a parameter set by this class replaces it. They can be replaced for a single request withTypeSafeDecisionRequestParameters.Builder.customParameters(Map). -
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
-