Package dev.langchain4j.model.googleai
Class GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder
java.lang.Object
dev.langchain4j.model.googleai.GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder
- Enclosing class:
GoogleAiGeminiChatModel
-
Method Summary
Modifier and TypeMethodDescriptionallowCodeExecution
(Boolean allowCodeExecution) build()
defaultRequestParameters
(ChatRequestParameters defaultRequestParameters) enableEnhancedCivicAnswers
(Boolean enableEnhancedCivicAnswers) frequencyPenalty
(Double frequencyPenalty) httpClientBuilder
(HttpClientBuilder httpClientBuilder) includeCodeExecutionOutput
(Boolean includeCodeExecutionOutput) listeners
(List<ChatModelListener> listeners) logRequestsAndResponses
(Boolean logRequestsAndResponses) maxOutputTokens
(Integer maxOutputTokens) maxRetries
(Integer maxRetries) presencePenalty
(Double presencePenalty) responseFormat
(ResponseFormat responseFormat) responseLogprobs
(Boolean responseLogprobs) returnThinking
(Boolean returnThinking) Controls whether to return thinking/reasoning text (if available) insideAiMessage.thinking()
.safetySettings
(List<GeminiSafetySetting> safetySettings) safetySettings
(Map<GeminiHarmCategory, GeminiHarmBlockThreshold> safetySettingMap) sendThinking
(Boolean sendThinking) Controls whether to send thinking/reasoning text to the LLM in follow-up requests.stopSequences
(List<String> stopSequences) supportedCapabilities
(Capability... supportedCapabilities) supportedCapabilities
(Set<Capability> supportedCapabilities) temperature
(Double temperature) thinkingConfig
(GeminiThinkingConfig thinkingConfig) Specifies the config to enable thinking.toolConfig
(GeminiFunctionCallingConfig toolConfig) toolConfig
(GeminiMode mode, String... allowedFunctionNames)
-
Method Details
-
httpClientBuilder
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder httpClientBuilder(HttpClientBuilder httpClientBuilder) -
defaultRequestParameters
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder defaultRequestParameters(ChatRequestParameters defaultRequestParameters) -
toolConfig
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder toolConfig(GeminiMode mode, String... allowedFunctionNames) -
safetySettings
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder safetySettings(Map<GeminiHarmCategory, GeminiHarmBlockThreshold> safetySettingMap) -
apiKey
-
baseUrl
-
modelName
-
maxRetries
-
temperature
-
topK
-
seed
-
topP
-
frequencyPenalty
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder frequencyPenalty(Double frequencyPenalty) -
presencePenalty
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder presencePenalty(Double presencePenalty) -
maxOutputTokens
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder maxOutputTokens(Integer maxOutputTokens) -
timeout
-
responseFormat
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder responseFormat(ResponseFormat responseFormat) -
stopSequences
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder stopSequences(List<String> stopSequences) -
toolConfig
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder toolConfig(GeminiFunctionCallingConfig toolConfig) -
allowCodeExecution
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder allowCodeExecution(Boolean allowCodeExecution) -
includeCodeExecutionOutput
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder includeCodeExecutionOutput(Boolean includeCodeExecutionOutput) -
logRequestsAndResponses
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder logRequestsAndResponses(Boolean logRequestsAndResponses) -
safetySettings
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder safetySettings(List<GeminiSafetySetting> safetySettings) -
thinkingConfig
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder thinkingConfig(GeminiThinkingConfig thinkingConfig) Specifies the config to enable thinking.- See Also:
-
returnThinking
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder returnThinking(Boolean returnThinking) Controls whether to return thinking/reasoning text (if available) insideAiMessage.thinking()
. Please note that this does not enable thinking/reasoning for the LLM; it only controls whether to parse thethought
block from the API response and return it inside theAiMessage
.Disabled by default. If enabled, the thinking text will be stored within the
AiMessage
and may be persisted. If enabled, thinking signatures will also be stored and returned inside theAiMessage.attributes()
.Please note that when
returnThinking
is not set (isnull
) andthinkingConfig
is set, thinking/reasoning text will be prepended to the actual response inside theAiMessage.text()
field.- See Also:
-
sendThinking
Controls whether to send thinking/reasoning text to the LLM in follow-up requests.Disabled by default. If enabled, the contents of
AiMessage.thinking()
will be sent in the API request. If enabled, thinking signatures (inside theAiMessage.attributes()
) will also be sent.- See Also:
-
responseLogprobs
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder responseLogprobs(Boolean responseLogprobs) -
enableEnhancedCivicAnswers
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder enableEnhancedCivicAnswers(Boolean enableEnhancedCivicAnswers) -
logprobs
-
listeners
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder listeners(List<ChatModelListener> listeners) -
supportedCapabilities
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder supportedCapabilities(Set<Capability> supportedCapabilities) -
supportedCapabilities
public GoogleAiGeminiChatModel.GoogleAiGeminiChatModelBuilder supportedCapabilities(Capability... supportedCapabilities) -
build
-