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

      @CanIgnoreReturnValue 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.

    • clearModelTurn

      @CanIgnoreReturnValue public LiveServerContent.Builder clearModelTurn()
      Clears the value of modelTurn field.
    • 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.

    • clearTurnComplete

      @CanIgnoreReturnValue public LiveServerContent.Builder clearTurnComplete()
      Clears the value of turnComplete field.
    • 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.

    • clearInterrupted

      @CanIgnoreReturnValue public LiveServerContent.Builder clearInterrupted()
      Clears the value of interrupted field.
    • groundingMetadata

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

      groundingMetadata: Metadata returned to client when grounding is enabled.

    • groundingMetadata

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

      groundingMetadata: Metadata returned to client when grounding is enabled.

    • clearGroundingMetadata

      @CanIgnoreReturnValue public LiveServerContent.Builder clearGroundingMetadata()
      Clears the value of groundingMetadata field.
    • 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.

    • clearGenerationComplete

      @CanIgnoreReturnValue public LiveServerContent.Builder clearGenerationComplete()
      Clears the value of generationComplete field.
    • 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

      @CanIgnoreReturnValue 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.

    • clearInputTranscription

      @CanIgnoreReturnValue public LiveServerContent.Builder clearInputTranscription()
      Clears the value of inputTranscription field.
    • 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

      @CanIgnoreReturnValue 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.

    • clearOutputTranscription

      @CanIgnoreReturnValue public LiveServerContent.Builder clearOutputTranscription()
      Clears the value of outputTranscription field.
    • urlContextMetadata

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

      urlContextMetadata: Metadata related to url context retrieval tool.

    • urlContextMetadata

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

      urlContextMetadata: Metadata related to url context retrieval tool.

    • clearUrlContextMetadata

      @CanIgnoreReturnValue public LiveServerContent.Builder clearUrlContextMetadata()
      Clears the value of urlContextMetadata field.
    • turnCompleteReason

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

      turnCompleteReason: Reason for the turn is complete.

    • clearTurnCompleteReason

      @CanIgnoreReturnValue public LiveServerContent.Builder clearTurnCompleteReason()
      Clears the value of turnCompleteReason field.
    • 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.

    • clearWaitingForInput

      @CanIgnoreReturnValue public LiveServerContent.Builder clearWaitingForInput()
      Clears the value of waitingForInput field.
    • build

      public abstract LiveServerContent build()