Class VertexAiGeminiChatModel
java.lang.Object
dev.langchain4j.model.vertexai.gemini.VertexAiGeminiChatModel
- All Implemented Interfaces:
dev.langchain4j.model.chat.ChatModel, Closeable, AutoCloseable
public class VertexAiGeminiChatModel
extends Object
implements dev.langchain4j.model.chat.ChatModel, Closeable
Represents a Google Vertex AI Gemini language model with a chat completion interface, such as gemini-pro.
See details here.
Please follow these steps before using this model:
1. Authentication
When developing locally, you can use one of:
a) Google Cloud SDK
b) Service account When using service account, ensure that
2. Authorization
3. Prerequisites
Please follow these steps before using this model:
1. Authentication
When developing locally, you can use one of:
a) Google Cloud SDK
b) Service account When using service account, ensure that
GOOGLE_APPLICATION_CREDENTIALS environment variable points to your JSON service account key.
2. Authorization
3. Prerequisites
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsConstructorDescriptionVertexAiGeminiChatModel(com.google.cloud.vertexai.generativeai.GenerativeModel generativeModel, com.google.cloud.vertexai.api.GenerationConfig generationConfig) VertexAiGeminiChatModel(com.google.cloud.vertexai.generativeai.GenerativeModel generativeModel, com.google.cloud.vertexai.api.GenerationConfig generationConfig, Integer maxRetries) VertexAiGeminiChatModel(String project, String location, String modelName, Float temperature, Integer maxOutputTokens, Integer topK, Float topP, Integer seed, Integer maxRetries, 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<dev.langchain4j.model.chat.listener.ChatModelListener> listeners, Set<dev.langchain4j.model.chat.Capability> supportedCapabilities) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()dev.langchain4j.model.chat.response.ChatResponsechat(dev.langchain4j.model.chat.request.ChatRequest chatRequest) voidclose()List<dev.langchain4j.model.chat.listener.ChatModelListener> dev.langchain4j.model.ModelProviderprovider()Set<dev.langchain4j.model.chat.Capability> Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.langchain4j.model.chat.ChatModel
chat, chat, chat, chat, defaultRequestParameters, doChat
-
Constructor Details
-
VertexAiGeminiChatModel
-
VertexAiGeminiChatModel
@Deprecated(forRemoval=true, since="1.1.0-beta7") public VertexAiGeminiChatModel(String project, String location, String modelName, Float temperature, Integer maxOutputTokens, Integer topK, Float topP, Integer seed, Integer maxRetries, 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<dev.langchain4j.model.chat.listener.ChatModelListener> listeners, Set<dev.langchain4j.model.chat.Capability> supportedCapabilities) Deprecated, for removal: This API element is subject to removal in a future version.please useVertexAiGeminiChatModel(VertexAiGeminiChatModelBuilder)instead -
VertexAiGeminiChatModel
public VertexAiGeminiChatModel(com.google.cloud.vertexai.generativeai.GenerativeModel generativeModel, com.google.cloud.vertexai.api.GenerationConfig generationConfig) -
VertexAiGeminiChatModel
public VertexAiGeminiChatModel(com.google.cloud.vertexai.generativeai.GenerativeModel generativeModel, com.google.cloud.vertexai.api.GenerationConfig generationConfig, Integer maxRetries)
-
-
Method Details
-
chat
public dev.langchain4j.model.chat.response.ChatResponse chat(dev.langchain4j.model.chat.request.ChatRequest chatRequest) - Specified by:
chatin interfacedev.langchain4j.model.chat.ChatModel
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
supportedCapabilities
- Specified by:
supportedCapabilitiesin interfacedev.langchain4j.model.chat.ChatModel
-
listeners
- Specified by:
listenersin interfacedev.langchain4j.model.chat.ChatModel
-
provider
public dev.langchain4j.model.ModelProvider provider()- Specified by:
providerin interfacedev.langchain4j.model.chat.ChatModel
-
builder
-
VertexAiGeminiChatModel(VertexAiGeminiChatModelBuilder)instead