Package dev.langchain4j.model.googleai
Class GoogleAiGeminiStreamingChatModel
java.lang.Object
dev.langchain4j.model.googleai.GoogleAiGeminiStreamingChatModel
- All Implemented Interfaces:
dev.langchain4j.model.chat.StreamingChatLanguageModel
public class GoogleAiGeminiStreamingChatModel
extends Object
implements dev.langchain4j.model.chat.StreamingChatLanguageModel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected final Stringprotected final dev.langchain4j.model.googleai.GeminiServiceprotected final booleanprotected final List<dev.langchain4j.model.chat.listener.ChatModelListener> protected final Integerprotected final Integerprotected final Stringprotected final dev.langchain4j.model.chat.request.ResponseFormatprotected final List<GeminiSafetySetting> protected final Doubleprotected final GeminiFunctionCallingConfigprotected final Integerprotected final Double -
Constructor Summary
ConstructorsConstructorDescriptionGoogleAiGeminiStreamingChatModel(String apiKey, String modelName, Double temperature, Integer topK, Double topP, Integer maxOutputTokens, Duration timeout, dev.langchain4j.model.chat.request.ResponseFormat responseFormat, List<String> stopSequences, GeminiFunctionCallingConfig toolConfig, Boolean allowCodeExecution, Boolean includeCodeExecutionOutput, Boolean logRequestsAndResponses, List<GeminiSafetySetting> safetySettings, List<dev.langchain4j.model.chat.listener.ChatModelListener> listeners, Integer maxRetries) -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringcomputeMimeType(dev.langchain4j.model.chat.request.ResponseFormat responseFormat) protected dev.langchain4j.model.chat.listener.ChatModelRequestcreateChatModelRequest(List<dev.langchain4j.data.message.ChatMessage> messages, List<dev.langchain4j.agent.tool.ToolSpecification> toolSpecifications) protected dev.langchain4j.model.googleai.GeminiGenerateContentRequestcreateGenerateContentRequest(List<dev.langchain4j.data.message.ChatMessage> messages, List<dev.langchain4j.agent.tool.ToolSpecification> toolSpecifications, dev.langchain4j.model.chat.request.ResponseFormat responseFormat) voidgenerate(List<dev.langchain4j.data.message.ChatMessage> messages, dev.langchain4j.agent.tool.ToolSpecification toolSpecification, dev.langchain4j.model.StreamingResponseHandler<dev.langchain4j.data.message.AiMessage> handler) voidgenerate(List<dev.langchain4j.data.message.ChatMessage> messages, dev.langchain4j.model.StreamingResponseHandler<dev.langchain4j.data.message.AiMessage> handler) voidgenerate(List<dev.langchain4j.data.message.ChatMessage> messages, List<dev.langchain4j.agent.tool.ToolSpecification> toolSpecifications, dev.langchain4j.model.StreamingResponseHandler<dev.langchain4j.data.message.AiMessage> handler) protected voidnotifyListenersOnError(Exception exception, dev.langchain4j.model.chat.listener.ChatModelRequest request, ConcurrentHashMap<Object, Object> attributes) protected voidnotifyListenersOnRequest(dev.langchain4j.model.chat.listener.ChatModelRequestContext context) protected voidnotifyListenersOnResponse(dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> response, dev.langchain4j.model.chat.listener.ChatModelRequest request, ConcurrentHashMap<Object, Object> attributes) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.model.chat.StreamingChatLanguageModel
generate, generate
-
Field Details
-
geminiService
protected final dev.langchain4j.model.googleai.GeminiService geminiService -
apiKey
-
modelName
-
temperature
-
topK
-
topP
-
maxOutputTokens
-
stopSequences
-
responseFormat
protected final dev.langchain4j.model.chat.request.ResponseFormat responseFormat -
toolConfig
-
allowCodeExecution
protected final boolean allowCodeExecution -
includeCodeExecutionOutput
protected final boolean includeCodeExecutionOutput -
safetySettings
-
listeners
-
maxRetries
-
-
Constructor Details
-
GoogleAiGeminiStreamingChatModel
public GoogleAiGeminiStreamingChatModel(String apiKey, String modelName, Double temperature, Integer topK, Double topP, Integer maxOutputTokens, Duration timeout, dev.langchain4j.model.chat.request.ResponseFormat responseFormat, List<String> stopSequences, GeminiFunctionCallingConfig toolConfig, Boolean allowCodeExecution, Boolean includeCodeExecutionOutput, Boolean logRequestsAndResponses, List<GeminiSafetySetting> safetySettings, List<dev.langchain4j.model.chat.listener.ChatModelListener> listeners, Integer maxRetries)
-
-
Method Details
-
generate
public void generate(List<dev.langchain4j.data.message.ChatMessage> messages, dev.langchain4j.model.StreamingResponseHandler<dev.langchain4j.data.message.AiMessage> handler) - Specified by:
generatein interfacedev.langchain4j.model.chat.StreamingChatLanguageModel
-
generate
public void generate(List<dev.langchain4j.data.message.ChatMessage> messages, dev.langchain4j.agent.tool.ToolSpecification toolSpecification, dev.langchain4j.model.StreamingResponseHandler<dev.langchain4j.data.message.AiMessage> handler) - Specified by:
generatein interfacedev.langchain4j.model.chat.StreamingChatLanguageModel
-
generate
public void generate(List<dev.langchain4j.data.message.ChatMessage> messages, List<dev.langchain4j.agent.tool.ToolSpecification> toolSpecifications, dev.langchain4j.model.StreamingResponseHandler<dev.langchain4j.data.message.AiMessage> handler) - Specified by:
generatein interfacedev.langchain4j.model.chat.StreamingChatLanguageModel
-
createGenerateContentRequest
-
createChatModelRequest
-
computeMimeType
protected static String computeMimeType(dev.langchain4j.model.chat.request.ResponseFormat responseFormat) -
notifyListenersOnRequest
protected void notifyListenersOnRequest(dev.langchain4j.model.chat.listener.ChatModelRequestContext context) -
notifyListenersOnResponse
protected void notifyListenersOnResponse(dev.langchain4j.model.output.Response<dev.langchain4j.data.message.AiMessage> response, dev.langchain4j.model.chat.listener.ChatModelRequest request, ConcurrentHashMap<Object, Object> attributes) -
notifyListenersOnError
protected void notifyListenersOnError(Exception exception, dev.langchain4j.model.chat.listener.ChatModelRequest request, ConcurrentHashMap<Object, Object> attributes)
-