Package dev.langchain4j.model.googleai
Class GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder
java.lang.Object
dev.langchain4j.model.googleai.GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder
- Enclosing class:
GoogleAiGeminiStreamingChatModel
public static class GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder
extends Object
-
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) presencePenalty
(Double presencePenalty) responseFormat
(ResponseFormat responseFormat) responseLogprobs
(Boolean responseLogprobs) returnThinking
(Boolean returnThinking) Controls whether to return thinking/reasoning text (if available) insideAiMessage.thinking()
and whether to invoke theStreamingChatResponseHandler.onPartialThinking(PartialThinking)
callback.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) temperature
(Double temperature) thinkingConfig
(GeminiThinkingConfig thinkingConfig) Specifies the config to enable thinking.toolConfig
(GeminiFunctionCallingConfig toolConfig) toolConfig
(GeminiMode mode, String... allowedFunctionNames)
-
Method Details
-
httpClientBuilder
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder httpClientBuilder(HttpClientBuilder httpClientBuilder) -
defaultRequestParameters
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder defaultRequestParameters(ChatRequestParameters defaultRequestParameters) -
toolConfig
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder toolConfig(GeminiMode mode, String... allowedFunctionNames) -
safetySettings
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder safetySettings(Map<GeminiHarmCategory, GeminiHarmBlockThreshold> safetySettingMap) -
apiKey
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder apiKey(String apiKey) -
baseUrl
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder baseUrl(String baseUrl) -
modelName
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder modelName(String modelName) -
temperature
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder temperature(Double temperature) -
topK
-
seed
-
topP
-
frequencyPenalty
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder frequencyPenalty(Double frequencyPenalty) -
presencePenalty
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder presencePenalty(Double presencePenalty) -
maxOutputTokens
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder maxOutputTokens(Integer maxOutputTokens) -
timeout
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder timeout(Duration timeout) -
responseFormat
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder responseFormat(ResponseFormat responseFormat) -
stopSequences
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder stopSequences(List<String> stopSequences) -
toolConfig
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder toolConfig(GeminiFunctionCallingConfig toolConfig) -
allowCodeExecution
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder allowCodeExecution(Boolean allowCodeExecution) -
includeCodeExecutionOutput
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder includeCodeExecutionOutput(Boolean includeCodeExecutionOutput) -
logRequestsAndResponses
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder logRequestsAndResponses(Boolean logRequestsAndResponses) -
safetySettings
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder safetySettings(List<GeminiSafetySetting> safetySettings) -
listeners
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder listeners(List<ChatModelListener> listeners) -
thinkingConfig
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder thinkingConfig(GeminiThinkingConfig thinkingConfig) Specifies the config to enable thinking.- See Also:
-
returnThinking
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder returnThinking(Boolean returnThinking) Controls whether to return thinking/reasoning text (if available) insideAiMessage.thinking()
and whether to invoke theStreamingChatResponseHandler.onPartialThinking(PartialThinking)
callback. 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 andStreamingChatResponseHandler.onPartialResponse(String)
will be invoked instead ofStreamingChatResponseHandler.onPartialThinking(PartialThinking)
.- See Also:
-
sendThinking
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder sendThinking(Boolean 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 GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder responseLogprobs(Boolean responseLogprobs) -
logprobs
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder logprobs(Integer logprobs) -
enableEnhancedCivicAnswers
public GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder enableEnhancedCivicAnswers(Boolean enableEnhancedCivicAnswers) -
build
-