Package dev.langchain4j.model.vertexai
Class VertexAiGeminiStreamingChatModel
java.lang.Object
dev.langchain4j.model.vertexai.VertexAiGeminiStreamingChatModel
- All Implemented Interfaces:
StreamingChatLanguageModel
,Closeable
,AutoCloseable
public class VertexAiGeminiStreamingChatModel
extends Object
implements StreamingChatLanguageModel, Closeable
Represents a Google Vertex AI Gemini language model with a stream chat completion interface, such as gemini-pro.
See details here.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
-
Constructor Summary
ConstructorsConstructorDescriptionVertexAiGeminiStreamingChatModel
(com.google.cloud.vertexai.generativeai.GenerativeModel generativeModel, com.google.cloud.vertexai.api.GenerationConfig generationConfig) VertexAiGeminiStreamingChatModel
(String project, String location, String modelName, Float temperature, Integer maxOutputTokens, Integer topK, Float topP, String responseMimeType, com.google.cloud.vertexai.api.Schema responseSchema, Map<HarmCategory, SafetyThreshold> safetySettings, Boolean useGoogleSearch, String vertexSearchDatastore, ToolCallingMode toolCallingMode, List<String> allowedFunctionNames, Boolean logRequests, Boolean logResponses, List<ChatModelListener> listeners) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
void
chat
(ChatRequest chatRequest, StreamingChatResponseHandler handler) This is the main API to interact with the chat model.void
close()
provider()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.langchain4j.model.chat.StreamingChatLanguageModel
chat, chat, defaultRequestParameters, doChat, supportedCapabilities
-
Constructor Details
-
VertexAiGeminiStreamingChatModel
public VertexAiGeminiStreamingChatModel(String project, String location, String modelName, Float temperature, Integer maxOutputTokens, Integer topK, Float topP, String responseMimeType, com.google.cloud.vertexai.api.Schema responseSchema, Map<HarmCategory, SafetyThreshold> safetySettings, Boolean useGoogleSearch, String vertexSearchDatastore, ToolCallingMode toolCallingMode, List<String> allowedFunctionNames, Boolean logRequests, Boolean logResponses, List<ChatModelListener> listeners) -
VertexAiGeminiStreamingChatModel
public VertexAiGeminiStreamingChatModel(com.google.cloud.vertexai.generativeai.GenerativeModel generativeModel, com.google.cloud.vertexai.api.GenerationConfig generationConfig)
-
-
Method Details
-
chat
Description copied from interface:StreamingChatLanguageModel
This is the main API to interact with the chat model.A temporary default implementation of this method is necessary until all
StreamingChatLanguageModel
implementations adopt it. It should be removed once that occurs.- Specified by:
chat
in interfaceStreamingChatLanguageModel
- Parameters:
chatRequest
- aChatRequest
, containing all the inputs to the LLMhandler
- aStreamingChatResponseHandler
that will handle streaming response from the LLM
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
listeners
- Specified by:
listeners
in interfaceStreamingChatLanguageModel
-
provider
- Specified by:
provider
in interfaceStreamingChatLanguageModel
-
builder
-