Class GoogleAiGeminiStreamingChatModel
java.lang.Object
dev.langchain4j.model.googleai.GoogleAiGeminiStreamingChatModel
- All Implemented Interfaces:
StreamingChatModel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected final booleanprotected final booleanprotected final booleanprotected final GoogleAiGeminiChatRequestParametersprotected final Booleanprotected final GeminiFunctionCallingConfigprotected final dev.langchain4j.model.googleai.GeminiServiceprotected final booleanprotected final List<ChatModelListener> protected final Integerprotected final GeminiMediaResolutionLevelprotected final booleanprotected final Booleanprotected final booleanprotected final Booleanprotected final List<GeminiSafetySetting> protected final Integerprotected final booleanprotected final GeminiThinkingConfig -
Constructor Summary
ConstructorsConstructorDescriptionGoogleAiGeminiStreamingChatModel(GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder builder) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()protected static dev.langchain4j.model.googleai.GeminiServicebuildGeminiService(dev.langchain4j.model.googleai.BaseGeminiChatModel.GoogleAiGeminiChatModelBaseBuilder<?> builder) protected static StringcomputeMimeType(ResponseFormat responseFormat) protected AiMessagecreateAiMessage(dev.langchain4j.model.googleai.GeminiGenerateContentResponse.GeminiCandidate candidate) protected dev.langchain4j.model.googleai.GeminiGenerateContentRequestcreateGenerateContentRequest(ChatRequest chatRequest) protected TokenUsagecreateTokenUsage(dev.langchain4j.model.googleai.GeminiGenerateContentResponse.GeminiUsageMetadata tokenCounts) voiddoChat(ChatRequest request, StreamingChatResponseHandler handler) Provider-specific implementation ofStreamingChatModel.chat(ChatRequest, StreamingChatResponseHandler), which wraps it withChatModelListenerinvocation and failure reporting.protected ChatResponseprocessResponse(dev.langchain4j.model.googleai.GeminiGenerateContentResponse geminiResponse) provider()
-
Field Details
-
geminiService
protected final dev.langchain4j.model.googleai.GeminiService geminiService -
functionCallingConfig
-
allowCodeExecution
protected final boolean allowCodeExecution -
allowGoogleSearch
protected final boolean allowGoogleSearch -
allowGoogleMaps
protected final boolean allowGoogleMaps -
retrieveGoogleMapsWidgetToken
protected final boolean retrieveGoogleMapsWidgetToken -
allowUrlContext
protected final boolean allowUrlContext -
includeCodeExecutionOutput
protected final boolean includeCodeExecutionOutput -
safetySettings
-
listeners
-
thinkingConfig
-
returnThinking
-
sendThinking
protected final boolean sendThinking -
seed
-
logprobs
-
responseLogprobs
-
enableEnhancedCivicAnswers
-
mediaResolution
-
mediaResolutionPerPartEnabled
protected final boolean mediaResolutionPerPartEnabled -
defaultRequestParameters
-
-
Constructor Details
-
GoogleAiGeminiStreamingChatModel
public GoogleAiGeminiStreamingChatModel(GoogleAiGeminiStreamingChatModel.GoogleAiGeminiStreamingChatModelBuilder builder)
-
-
Method Details
-
builder
-
defaultRequestParameters
- Specified by:
defaultRequestParametersin interfaceStreamingChatModel
-
doChat
Description copied from interface:StreamingChatModelProvider-specific implementation ofStreamingChatModel.chat(ChatRequest, StreamingChatResponseHandler), which wraps it withChatModelListenerinvocation and failure reporting.An implementation may throw a failure that it finds before the request is sent, for example an invalid request:
StreamingChatModel.chat(ChatRequest, StreamingChatResponseHandler)then reports it toStreamingChatResponseHandler.onError(Throwable). Every later failure goes tohandler.onError(...). An implementation does not need to care about what the user'sonErrorthrows: it never reaches the implementation. Core throws it fromchat(...)when it happens on the calling thread beforechat(...)returns, and logs it otherwise.- Specified by:
doChatin interfaceStreamingChatModel- Parameters:
request- the request, with the default request parameters of this model appliedhandler- the handler to send the streamed response and failures to
-
listeners
- Specified by:
listenersin interfaceStreamingChatModel
-
provider
- Specified by:
providerin interfaceStreamingChatModel
-
buildGeminiService
protected static dev.langchain4j.model.googleai.GeminiService buildGeminiService(dev.langchain4j.model.googleai.BaseGeminiChatModel.GoogleAiGeminiChatModelBaseBuilder<?> builder) -
createGenerateContentRequest
protected dev.langchain4j.model.googleai.GeminiGenerateContentRequest createGenerateContentRequest(ChatRequest chatRequest) -
computeMimeType
-
processResponse
protected ChatResponse processResponse(dev.langchain4j.model.googleai.GeminiGenerateContentResponse geminiResponse) -
createAiMessage
protected AiMessage createAiMessage(dev.langchain4j.model.googleai.GeminiGenerateContentResponse.GeminiCandidate candidate) -
createTokenUsage
protected TokenUsage createTokenUsage(dev.langchain4j.model.googleai.GeminiGenerateContentResponse.GeminiUsageMetadata tokenCounts)
-