Class VertexAiGeminiChatModel
java.lang.Object
org.springframework.ai.chat.model.AbstractToolCallSupport
org.springframework.ai.vertexai.gemini.VertexAiGeminiChatModel
- All Implemented Interfaces:
ChatModel
,StreamingChatModel
,Model<Prompt,
,ChatResponse> StreamingModel<Prompt,
,ChatResponse> org.springframework.beans.factory.DisposableBean
public class VertexAiGeminiChatModel
extends AbstractToolCallSupport
implements ChatModel, org.springframework.beans.factory.DisposableBean
- Since:
- 0.8.1
- Author:
- Christian Tzolov, Grogdunn, luocongqiu, Chris Turchin, Mark Pollack, Soby Chacko
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
static final record
-
Field Summary
Fields inherited from class org.springframework.ai.chat.model.AbstractToolCallSupport
functionCallbackContext, functionCallbackRegister, IS_RUNTIME_CALL
-
Constructor Summary
ConstructorDescriptionVertexAiGeminiChatModel
(com.google.cloud.vertexai.VertexAI vertexAI) VertexAiGeminiChatModel
(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options) VertexAiGeminiChatModel
(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext) VertexAiGeminiChatModel
(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks) VertexAiGeminiChatModel
(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate) VertexAiGeminiChatModel
(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionExecutes a method call to the AI model.void
destroy()
protected List<Generation>
responseCandiateToGeneration
(com.google.cloud.vertexai.api.Candidate candidate) void
setObservationConvention
(ChatModelObservationConvention observationConvention) Use the provided convention for reporting observation datareactor.core.publisher.Flux<ChatResponse>
Executes a method call to the AI model.Methods inherited from class org.springframework.ai.chat.model.AbstractToolCallSupport
buildToolCallConversation, executeFunctions, getFunctionCallbackRegister, handleToolCalls, isProxyToolCalls, isToolCall, isToolCall, resolveFunctionCallbacks, runtimeFunctionCallbackConfigurations
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.ai.chat.model.StreamingChatModel
stream, stream
-
Constructor Details
-
VertexAiGeminiChatModel
public VertexAiGeminiChatModel(com.google.cloud.vertexai.VertexAI vertexAI) -
VertexAiGeminiChatModel
public VertexAiGeminiChatModel(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options) -
VertexAiGeminiChatModel
public VertexAiGeminiChatModel(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext) -
VertexAiGeminiChatModel
public VertexAiGeminiChatModel(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks) -
VertexAiGeminiChatModel
public VertexAiGeminiChatModel(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate) -
VertexAiGeminiChatModel
public VertexAiGeminiChatModel(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
Method Details
-
call
Description copied from interface:Model
Executes a method call to the AI model. -
stream
Description copied from interface:StreamingModel
Executes a method call to the AI model.- Specified by:
stream
in interfaceChatModel
- Specified by:
stream
in interfaceStreamingChatModel
- Specified by:
stream
in interfaceStreamingModel<Prompt,
ChatResponse> - Parameters:
prompt
- the request object to be sent to the AI model- Returns:
- the streaming response from the AI model
-
responseCandiateToGeneration
protected List<Generation> responseCandiateToGeneration(com.google.cloud.vertexai.api.Candidate candidate) -
getDefaultOptions
- Specified by:
getDefaultOptions
in interfaceChatModel
-
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
-
setObservationConvention
Use the provided convention for reporting observation data- Parameters:
observationConvention
- The provided convention
-