Class LiveServerContent.Builder

java.lang.Object
com.google.genai.types.LiveServerContent.Builder
Enclosing class:
LiveServerContent

public abstract static class LiveServerContent.Builder extends Object
Builder for LiveServerContent.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • modelTurn

      public abstract LiveServerContent.Builder modelTurn(Content modelTurn)
      Setter for modelTurn.

      modelTurn: The content that the model has generated as part of the current conversation with the user.

    • modelTurn

      public LiveServerContent.Builder modelTurn(Content.Builder modelTurnBuilder)
      Setter for modelTurn builder.

      modelTurn: The content that the model has generated as part of the current conversation with the user.

    • turnComplete

      public abstract LiveServerContent.Builder turnComplete(boolean turnComplete)
      Setter for turnComplete.

      turnComplete: If true, indicates that the model is done generating. Generation will only start in response to additional client messages. Can be set alongside `content`, indicating that the `content` is the last in the turn.

    • interrupted

      public abstract LiveServerContent.Builder interrupted(boolean interrupted)
      Setter for interrupted.

      interrupted: If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in realtime, this is a good signal to stop and empty the current queue.

    • groundingMetadata

      public abstract LiveServerContent.Builder groundingMetadata(GroundingMetadata groundingMetadata)
      Setter for groundingMetadata.

      groundingMetadata: Metadata returned to client when grounding is enabled.

    • groundingMetadata

      public LiveServerContent.Builder groundingMetadata(GroundingMetadata.Builder groundingMetadataBuilder)
      Setter for groundingMetadata builder.

      groundingMetadata: Metadata returned to client when grounding is enabled.

    • generationComplete

      public abstract LiveServerContent.Builder generationComplete(boolean generationComplete)
      Setter for generationComplete.

      generationComplete: If true, indicates that the model is done generating. When model is interrupted while generating there will be no generation_complete message in interrupted turn, it will go through interrupted > turn_complete. When model assumes realtime playback there will be delay between generation_complete and turn_complete that is caused by model waiting for playback to finish. If true, indicates that the model has finished generating all content. This is a signal to the client that it can stop sending messages.

    • inputTranscription

      public abstract LiveServerContent.Builder inputTranscription(Transcription inputTranscription)
      Setter for inputTranscription.

      inputTranscription: Input transcription. The transcription is independent to the model turn which means it doesn’t imply any ordering between transcription and model turn.

    • inputTranscription

      public LiveServerContent.Builder inputTranscription(Transcription.Builder inputTranscriptionBuilder)
      Setter for inputTranscription builder.

      inputTranscription: Input transcription. The transcription is independent to the model turn which means it doesn’t imply any ordering between transcription and model turn.

    • outputTranscription

      public abstract LiveServerContent.Builder outputTranscription(Transcription outputTranscription)
      Setter for outputTranscription.

      outputTranscription: Output transcription. The transcription is independent to the model turn which means it doesn’t imply any ordering between transcription and model turn.

    • outputTranscription

      public LiveServerContent.Builder outputTranscription(Transcription.Builder outputTranscriptionBuilder)
      Setter for outputTranscription builder.

      outputTranscription: Output transcription. The transcription is independent to the model turn which means it doesn’t imply any ordering between transcription and model turn.

    • urlContextMetadata

      public abstract LiveServerContent.Builder urlContextMetadata(UrlContextMetadata urlContextMetadata)
      Setter for urlContextMetadata.

      urlContextMetadata: Metadata related to url context retrieval tool.

    • urlContextMetadata

      public LiveServerContent.Builder urlContextMetadata(UrlContextMetadata.Builder urlContextMetadataBuilder)
      Setter for urlContextMetadata builder.

      urlContextMetadata: Metadata related to url context retrieval tool.

    • turnCompleteReason

      public abstract LiveServerContent.Builder turnCompleteReason(TurnCompleteReason turnCompleteReason)
      Setter for turnCompleteReason.

      turnCompleteReason: Reason for the turn is complete.

    • turnCompleteReason

      @CanIgnoreReturnValue public LiveServerContent.Builder turnCompleteReason(TurnCompleteReason.Known knownType)
      Setter for turnCompleteReason given a known enum.

      turnCompleteReason: Reason for the turn is complete.

    • turnCompleteReason

      @CanIgnoreReturnValue public LiveServerContent.Builder turnCompleteReason(String turnCompleteReason)
      Setter for turnCompleteReason given a string.

      turnCompleteReason: Reason for the turn is complete.

    • waitingForInput

      public abstract LiveServerContent.Builder waitingForInput(boolean waitingForInput)
      Setter for waitingForInput.

      waitingForInput: If true, indicates that the model is not generating content because it is waiting for more input from the user, e.g. because it expects the user to continue talking.

    • build

      public abstract LiveServerContent build()