Class VertexAiGeminiChatClient
java.lang.Object
org.springframework.ai.model.function.AbstractFunctionCallSupport<com.google.cloud.vertexai.api.Content,VertexAiGeminiChatClient.GeminiRequest,com.google.cloud.vertexai.api.GenerateContentResponse>
org.springframework.ai.vertexai.gemini.VertexAiGeminiChatClient
- All Implemented Interfaces:
ChatClient,StreamingChatClient,ModelClient<Prompt,,ChatResponse> StreamingModelClient<Prompt,,ChatResponse> org.springframework.beans.factory.DisposableBean
public class VertexAiGeminiChatClient
extends AbstractFunctionCallSupport<com.google.cloud.vertexai.api.Content,VertexAiGeminiChatClient.GeminiRequest,com.google.cloud.vertexai.api.GenerateContentResponse>
implements ChatClient, StreamingChatClient, org.springframework.beans.factory.DisposableBean
- Since:
- 0.8.1
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic final record -
Field Summary
Fields inherited from class org.springframework.ai.model.function.AbstractFunctionCallSupport
functionCallbackContext, functionCallbackRegister -
Constructor Summary
ConstructorsConstructorDescriptionVertexAiGeminiChatClient(com.google.cloud.vertexai.VertexAI vertexAI) VertexAiGeminiChatClient(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options) VertexAiGeminiChatClient(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext) -
Method Summary
Modifier and TypeMethodDescriptionExecutes a method call to the AI model.voiddestroy()protected com.google.cloud.vertexai.api.GenerateContentResponseprotected VertexAiGeminiChatClient.GeminiRequestdoCreateToolResponseRequest(VertexAiGeminiChatClient.GeminiRequest previousRequest, com.google.cloud.vertexai.api.Content responseMessage, List<com.google.cloud.vertexai.api.Content> conversationHistory) protected com.google.cloud.vertexai.api.ContentdoGetToolResponseMessage(com.google.cloud.vertexai.api.GenerateContentResponse response) protected List<com.google.cloud.vertexai.api.Content> protected booleanisToolFunctionCall(com.google.cloud.vertexai.api.GenerateContentResponse response) reactor.core.publisher.Flux<ChatResponse> Executes a method call to the AI model.Methods inherited from class org.springframework.ai.model.function.AbstractFunctionCallSupport
callWithFunctionSupport, getFunctionCallbackRegister, handleFunctionCallbackConfigurations, handleFunctionCallOrReturn, resolveFunctionCallbacksMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.chat.ChatClient
callMethods inherited from interface org.springframework.ai.chat.StreamingChatClient
stream
-
Constructor Details
-
VertexAiGeminiChatClient
public VertexAiGeminiChatClient(com.google.cloud.vertexai.VertexAI vertexAI) -
VertexAiGeminiChatClient
public VertexAiGeminiChatClient(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options) -
VertexAiGeminiChatClient
public VertexAiGeminiChatClient(com.google.cloud.vertexai.VertexAI vertexAI, VertexAiGeminiChatOptions options, FunctionCallbackContext functionCallbackContext)
-
-
Method Details
-
call
Description copied from interface:ModelClientExecutes a method call to the AI model.- Specified by:
callin interfaceChatClient- Specified by:
callin interfaceModelClient<Prompt,ChatResponse> - Parameters:
prompt- the request object to be sent to the AI model- Returns:
- the response from the AI model
-
stream
Description copied from interface:StreamingModelClientExecutes a method call to the AI model.- Specified by:
streamin interfaceStreamingChatClient- Specified by:
streamin interfaceStreamingModelClient<Prompt,ChatResponse> - Parameters:
prompt- the request object to be sent to the AI model- Returns:
- the streaming response from the AI model
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-
doCreateToolResponseRequest
protected VertexAiGeminiChatClient.GeminiRequest doCreateToolResponseRequest(VertexAiGeminiChatClient.GeminiRequest previousRequest, com.google.cloud.vertexai.api.Content responseMessage, List<com.google.cloud.vertexai.api.Content> conversationHistory) - Specified by:
doCreateToolResponseRequestin classAbstractFunctionCallSupport<com.google.cloud.vertexai.api.Content,VertexAiGeminiChatClient.GeminiRequest, com.google.cloud.vertexai.api.GenerateContentResponse>
-
doGetUserMessages
protected List<com.google.cloud.vertexai.api.Content> doGetUserMessages(VertexAiGeminiChatClient.GeminiRequest request) - Specified by:
doGetUserMessagesin classAbstractFunctionCallSupport<com.google.cloud.vertexai.api.Content,VertexAiGeminiChatClient.GeminiRequest, com.google.cloud.vertexai.api.GenerateContentResponse>
-
doGetToolResponseMessage
protected com.google.cloud.vertexai.api.Content doGetToolResponseMessage(com.google.cloud.vertexai.api.GenerateContentResponse response) - Specified by:
doGetToolResponseMessagein classAbstractFunctionCallSupport<com.google.cloud.vertexai.api.Content,VertexAiGeminiChatClient.GeminiRequest, com.google.cloud.vertexai.api.GenerateContentResponse>
-
doChatCompletion
protected com.google.cloud.vertexai.api.GenerateContentResponse doChatCompletion(VertexAiGeminiChatClient.GeminiRequest request) - Specified by:
doChatCompletionin classAbstractFunctionCallSupport<com.google.cloud.vertexai.api.Content,VertexAiGeminiChatClient.GeminiRequest, com.google.cloud.vertexai.api.GenerateContentResponse>
-
isToolFunctionCall
protected boolean isToolFunctionCall(com.google.cloud.vertexai.api.GenerateContentResponse response) - Specified by:
isToolFunctionCallin classAbstractFunctionCallSupport<com.google.cloud.vertexai.api.Content,VertexAiGeminiChatClient.GeminiRequest, com.google.cloud.vertexai.api.GenerateContentResponse>
-