Class GoogleGenAiDecisionModel.Builder
java.lang.Object
dev.langchain4j.model.google.genai.GoogleGenAiDecisionModel.Builder
- Enclosing class:
GoogleGenAiDecisionModel
- Since:
- 1.24.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapiEndpoint(@Nullable String apiEndpoint) Overrides the base URL of the API, for example to go through a proxy.The Gemini API key.apiVersion(@Nullable String apiVersion) The version of the Gemini Developer API to call, for example when the Decisions API moves to a newer version.build()client(@Nullable com.google.genai.Client client) Sets a preconfigured Google Gen AIClient.customHeaders(@Nullable Map<String, String> customHeaders) HTTP headers added to every request.customParameters(@Nullable Map<String, Object> customParameters) Custom parameters added to the body of every request, for example to use a feature of the Gemini Decisions API that this class does not support yet.listeners(DecisionModelListener... listeners) listeners(@Nullable List<DecisionModelListener> listeners) The listeners notified of every request, response and error, for example for observability.logRequests(@Nullable Boolean logRequests) Whether to log each request at INFO level.logRequestsAndResponses(@Nullable Boolean logRequestsAndResponses) Sets bothlogRequests(Boolean)andlogResponses(Boolean).logResponses(@Nullable Boolean logResponses) Whether to log each response at INFO level.maxRetries(@Nullable Integer maxRetries) The maximum number of retries for transient errors such as timeouts, rate limits and server errors.The model to use when a request does not specify one, for examplegemini-decision-1.The maximum duration of one call to the API: connecting, sending the input, waiting for Gemini and receiving the answer.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
client
Sets a preconfigured Google Gen AIClient. The other client settings of this builder (apiKey,timeout,customHeadersandapiEndpoint) are then ignored. The SDK client's ownHttpRetryOptionsrun in addition tomaxRetries(Integer): setHttpRetryOptions.builder().attempts(1).httpStatusCodes(List.of()).build()on the client (ormaxRetries(0)here) to avoid stacking retries. When not set (null), a client is created from the settings of this builder. -
apiKey
The Gemini API key. When not set (null), the Google Gen AI SDK reads it from theGOOGLE_API_KEYorGEMINI_API_KEYenvironment variable. -
apiEndpoint
Overrides the base URL of the API, for example to go through a proxy. When not set (null), the SDK's default endpoint is used. -
apiVersion
The version of the Gemini Developer API to call, for example when the Decisions API moves to a newer version. It replaces the API version of aclient(Client). When not set (null),v1betais used. -
timeout
The maximum duration of one call to the API: connecting, sending the input, waiting for Gemini and receiving the answer. Each retry gets the full timeout. When not set (null), 20 minutes. -
customHeaders
HTTP headers added to every request. AUser-Agentheader is added to the SDK's own User-Agent. When not set (null), no custom headers are added. -
modelName
The model to use when a request does not specify one, for examplegemini-decision-1. The model name must be set either here or on each request. -
customParameters
public GoogleGenAiDecisionModel.Builder customParameters(@Nullable Map<String, Object> customParameters) Custom parameters added to the body of every request, for example to use a feature of the Gemini Decisions API that this class does not support yet.model,inputandquestionsare set by this class and cannot be custom parameters: the request is rejected with anIllegalArgumentExceptionbefore anything is sent. They can be replaced for a single request withGoogleGenAiDecisionRequestParameters.Builder.customParameters(Map). When not set (null), no custom parameters are added. -
maxRetries
The maximum number of retries for transient errors such as timeouts, rate limits and server errors. Default value is 2. -
logRequests
Whether to log each request at INFO level. Default value isfalse. -
logResponses
Whether to log each response at INFO level. Default value isfalse. -
logRequestsAndResponses
public GoogleGenAiDecisionModel.Builder logRequestsAndResponses(@Nullable Boolean logRequestsAndResponses) Sets bothlogRequests(Boolean)andlogResponses(Boolean). -
listeners
The listeners notified of every request, response and error, for example for observability. When not set (null), there are none. -
listeners
-
build
-