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
Vertex AI Gemini Chat Model implementation.
Since:
0.8.1
Author:
Christian Tzolov, Grogdunn, luocongqiu, Chris Turchin, Mark Pollack, Soby Chacko, Jihoon Kim
  • Constructor Details

  • Method Details

    • call

      public ChatResponse call(Prompt prompt)
      Description copied from interface: Model
      Executes a method call to the AI model.
      Specified by:
      call in interface ChatModel
      Specified by:
      call in interface Model<Prompt,ChatResponse>
      Parameters:
      prompt - the request object to be sent to the AI model
      Returns:
      the response from the AI model
    • stream

      public reactor.core.publisher.Flux<ChatResponse> stream(Prompt prompt)
      Description copied from interface: StreamingModel
      Executes a method call to the AI model.
      Specified by:
      stream in interface ChatModel
      Specified by:
      stream in interface StreamingChatModel
      Specified by:
      stream in interface StreamingModel<Prompt,ChatResponse>
      Parameters:
      prompt - the request object to be sent to the AI model
      Returns:
      the streaming response from the AI model
    • responseCandidateToGeneration

      protected List<Generation> responseCandidateToGeneration(com.google.cloud.vertexai.api.Candidate candidate)
    • getDefaultOptions

      public ChatOptions getDefaultOptions()
      Specified by:
      getDefaultOptions in interface ChatModel
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception
    • setObservationConvention

      public void setObservationConvention(ChatModelObservationConvention observationConvention)
      Use the provided convention for reporting observation data
      Parameters:
      observationConvention - The provided convention