Class LiveConnectConfig.Builder

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

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

    • Builder

      public Builder()
  • Method Details

    • httpOptions

      public abstract LiveConnectConfig.Builder httpOptions(HttpOptions httpOptions)
      Setter for httpOptions.

      httpOptions: Used to override HTTP request options.

    • httpOptions

      public LiveConnectConfig.Builder httpOptions(HttpOptions.Builder httpOptionsBuilder)
      Setter for httpOptions builder.

      httpOptions: Used to override HTTP request options.

    • responseModalities

      public abstract LiveConnectConfig.Builder responseModalities(List<Modality> responseModalities)
      Setter for responseModalities.

      responseModalities: The requested modalities of the response. Represents the set of modalities that the model can return. Defaults to AUDIO if not specified.

    • responseModalities

      public LiveConnectConfig.Builder responseModalities(Modality... responseModalities)
      Setter for responseModalities.

      responseModalities: The requested modalities of the response. Represents the set of modalities that the model can return. Defaults to AUDIO if not specified.

    • responseModalities

      @CanIgnoreReturnValue public LiveConnectConfig.Builder responseModalities(String... responseModalities)
      Setter for responseModalities given a varargs of strings.

      responseModalities: The requested modalities of the response. Represents the set of modalities that the model can return. Defaults to AUDIO if not specified.

    • responseModalities

      @CanIgnoreReturnValue public LiveConnectConfig.Builder responseModalities(Modality.Known... knownTypes)
      Setter for responseModalities given a varargs of known enums.

      responseModalities: The requested modalities of the response. Represents the set of modalities that the model can return. Defaults to AUDIO if not specified.

    • responseModalitiesFromKnown

      @CanIgnoreReturnValue public LiveConnectConfig.Builder responseModalitiesFromKnown(List<Modality.Known> knownTypes)
      Setter for responseModalities given a list of known enums.

      responseModalities: The requested modalities of the response. Represents the set of modalities that the model can return. Defaults to AUDIO if not specified.

    • responseModalitiesFromString

      @CanIgnoreReturnValue public LiveConnectConfig.Builder responseModalitiesFromString(List<String> responseModalities)
      Setter for responseModalities given a list of strings.

      responseModalities: The requested modalities of the response. Represents the set of modalities that the model can return. Defaults to AUDIO if not specified.

    • temperature

      public abstract LiveConnectConfig.Builder temperature(Float temperature)
      Setter for temperature.

      temperature: Value that controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a less open-ended or creative response, while higher temperatures can lead to more diverse or creative results.

    • topP

      public abstract LiveConnectConfig.Builder topP(Float topP)
      Setter for topP.

      topP: Tokens are selected from the most to least probable until the sum of their probabilities equals this value. Use a lower value for less random responses and a higher value for more random responses.

    • topK

      public abstract LiveConnectConfig.Builder topK(Float topK)
      Setter for topK.

      topK: For each token selection step, the ``top_k`` tokens with the highest probabilities are sampled. Then tokens are further filtered based on ``top_p`` with the final token selected using temperature sampling. Use a lower number for less random responses and a higher number for more random responses.

    • maxOutputTokens

      public abstract LiveConnectConfig.Builder maxOutputTokens(Integer maxOutputTokens)
      Setter for maxOutputTokens.

      maxOutputTokens: Maximum number of tokens that can be generated in the response.

    • mediaResolution

      public abstract LiveConnectConfig.Builder mediaResolution(MediaResolution mediaResolution)
      Setter for mediaResolution.

      mediaResolution: If specified, the media resolution specified will be used.

    • mediaResolution

      @CanIgnoreReturnValue public LiveConnectConfig.Builder mediaResolution(MediaResolution.Known knownType)
      Setter for mediaResolution given a known enum.

      mediaResolution: If specified, the media resolution specified will be used.

    • mediaResolution

      @CanIgnoreReturnValue public LiveConnectConfig.Builder mediaResolution(String mediaResolution)
      Setter for mediaResolution given a string.

      mediaResolution: If specified, the media resolution specified will be used.

    • seed

      public abstract LiveConnectConfig.Builder seed(Integer seed)
      Setter for seed.

      seed: When ``seed`` is fixed to a specific number, the model makes a best effort to provide the same response for repeated requests. By default, a random number is used.

    • speechConfig

      public abstract LiveConnectConfig.Builder speechConfig(SpeechConfig speechConfig)
      Setter for speechConfig.

      speechConfig: The speech generation configuration.

    • speechConfig

      public LiveConnectConfig.Builder speechConfig(SpeechConfig.Builder speechConfigBuilder)
      Setter for speechConfig builder.

      speechConfig: The speech generation configuration.

    • enableAffectiveDialog

      public abstract LiveConnectConfig.Builder enableAffectiveDialog(boolean enableAffectiveDialog)
      Setter for enableAffectiveDialog.

      enableAffectiveDialog: If enabled, the model will detect emotions and adapt its responses accordingly.

    • systemInstruction

      public abstract LiveConnectConfig.Builder systemInstruction(Content systemInstruction)
      Setter for systemInstruction.

      systemInstruction: The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

    • systemInstruction

      public LiveConnectConfig.Builder systemInstruction(Content.Builder systemInstructionBuilder)
      Setter for systemInstruction builder.

      systemInstruction: The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

    • tools

      public abstract LiveConnectConfig.Builder tools(List<Tool> tools)
      Setter for tools.

      tools: A list of `Tools` the model may use to generate the next response.

      A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

    • tools

      public LiveConnectConfig.Builder tools(Tool... tools)
      Setter for tools.

      tools: A list of `Tools` the model may use to generate the next response.

      A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

    • tools

      public LiveConnectConfig.Builder tools(Tool.Builder... toolsBuilders)
      Setter for tools builder.

      tools: A list of `Tools` the model may use to generate the next response.

      A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

    • sessionResumption

      public abstract LiveConnectConfig.Builder sessionResumption(SessionResumptionConfig sessionResumption)
      Setter for sessionResumption.

      sessionResumption: Configures session resumption mechanism.

      If included the server will send SessionResumptionUpdate messages.

    • sessionResumption

      public LiveConnectConfig.Builder sessionResumption(SessionResumptionConfig.Builder sessionResumptionBuilder)
      Setter for sessionResumption builder.

      sessionResumption: Configures session resumption mechanism.

      If included the server will send SessionResumptionUpdate messages.

    • inputAudioTranscription

      public abstract LiveConnectConfig.Builder inputAudioTranscription(AudioTranscriptionConfig inputAudioTranscription)
      Setter for inputAudioTranscription.

      inputAudioTranscription: The transcription of the input aligns with the input audio language.

    • inputAudioTranscription

      public LiveConnectConfig.Builder inputAudioTranscription(AudioTranscriptionConfig.Builder inputAudioTranscriptionBuilder)
      Setter for inputAudioTranscription builder.

      inputAudioTranscription: The transcription of the input aligns with the input audio language.

    • outputAudioTranscription

      public abstract LiveConnectConfig.Builder outputAudioTranscription(AudioTranscriptionConfig outputAudioTranscription)
      Setter for outputAudioTranscription.

      outputAudioTranscription: The transcription of the output aligns with the language code specified for the output audio.

    • outputAudioTranscription

      public LiveConnectConfig.Builder outputAudioTranscription(AudioTranscriptionConfig.Builder outputAudioTranscriptionBuilder)
      Setter for outputAudioTranscription builder.

      outputAudioTranscription: The transcription of the output aligns with the language code specified for the output audio.

    • realtimeInputConfig

      public abstract LiveConnectConfig.Builder realtimeInputConfig(RealtimeInputConfig realtimeInputConfig)
      Setter for realtimeInputConfig.

      realtimeInputConfig: Configures the realtime input behavior in BidiGenerateContent.

    • realtimeInputConfig

      public LiveConnectConfig.Builder realtimeInputConfig(RealtimeInputConfig.Builder realtimeInputConfigBuilder)
      Setter for realtimeInputConfig builder.

      realtimeInputConfig: Configures the realtime input behavior in BidiGenerateContent.

    • contextWindowCompression

      public abstract LiveConnectConfig.Builder contextWindowCompression(ContextWindowCompressionConfig contextWindowCompression)
      Setter for contextWindowCompression.

      contextWindowCompression: Configures context window compression mechanism.

      If included, server will compress context window to fit into given length.

    • contextWindowCompression

      public LiveConnectConfig.Builder contextWindowCompression(ContextWindowCompressionConfig.Builder contextWindowCompressionBuilder)
      Setter for contextWindowCompression builder.

      contextWindowCompression: Configures context window compression mechanism.

      If included, server will compress context window to fit into given length.

    • proactivity

      public abstract LiveConnectConfig.Builder proactivity(ProactivityConfig proactivity)
      Setter for proactivity.

      proactivity: Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.

    • proactivity

      public LiveConnectConfig.Builder proactivity(ProactivityConfig.Builder proactivityBuilder)
      Setter for proactivity builder.

      proactivity: Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.

    • build

      public abstract LiveConnectConfig build()