diff --git a/src/main/java/com/google/genai/LiveConverters.java b/src/main/java/com/google/genai/LiveConverters.java index 56ea4c4cc49..227472cdb46 100644 --- a/src/main/java/com/google/genai/LiveConverters.java +++ b/src/main/java/com/google/genai/LiveConverters.java @@ -71,6 +71,50 @@ ObjectNode audioTranscriptionConfigToMldev(JsonNode fromObject, ObjectNode paren return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode audioTranscriptionConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"languageCodes"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"languageCodes"}, + Common.getValueByPath(fromObject, new String[] {"languageCodes"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"languageAuto"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"languageAuto"}, + Common.getValueByPath(fromObject, new String[] {"languageAuto"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"languageHints"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"languageHints"}, + languageHintsToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"languageHints"})), + toObject)); + } + + if (Common.getValueByPath(fromObject, new String[] {"customVocabulary"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"customVocabulary"}, + Common.getValueByPath(fromObject, new String[] {"customVocabulary"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"adaptationPhrases"}, + Common.getValueByPath(fromObject, new String[] {"adaptationPhrases"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode authConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -256,6 +300,24 @@ ObjectNode contentToVertex(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode contextWindowCompressionConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"triggerTokens"}))) { + throw new IllegalArgumentException( + "triggerTokens parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"slidingWindow"}))) { + throw new IllegalArgumentException( + "slidingWindow parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode executableCodeToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -583,6 +645,31 @@ ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode historyConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (!Common.isZero( + Common.getValueByPath(fromObject, new String[] {"initialHistoryInClientContent"}))) { + throw new IllegalArgumentException( + "initialHistoryInClientContent parameter is only supported in Gemini Developer API mode," + + " not in Gemini Enterprise Agent Platform mode."); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode languageHintsToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"languageCodes"}))) { + throw new IllegalArgumentException( + "languageCodes parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode liveClientContentToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -1032,35 +1119,50 @@ ObjectNode liveClientSetupToVertex(JsonNode fromObject, ObjectNode parentObject) Common.setValueByPath( toObject, new String[] {"realtimeInputConfig"}, - Common.getValueByPath(fromObject, new String[] {"realtimeInputConfig"})); + realtimeInputConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"realtimeInputConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"sessionResumption"}) != null) { Common.setValueByPath( toObject, new String[] {"sessionResumption"}, - Common.getValueByPath(fromObject, new String[] {"sessionResumption"})); + sessionResumptionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"sessionResumption"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"contextWindowCompression"}) != null) { Common.setValueByPath( toObject, new String[] {"contextWindowCompression"}, - Common.getValueByPath(fromObject, new String[] {"contextWindowCompression"})); + contextWindowCompressionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"contextWindowCompression"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"}) != null) { Common.setValueByPath( toObject, new String[] {"inputAudioTranscription"}, - Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"})); + audioTranscriptionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"}) != null) { Common.setValueByPath( toObject, new String[] {"outputAudioTranscription"}, - Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"})); + audioTranscriptionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"proactivity"}) != null) { @@ -1095,7 +1197,10 @@ ObjectNode liveClientSetupToVertex(JsonNode fromObject, ObjectNode parentObject) Common.setValueByPath( toObject, new String[] {"historyConfig"}, - Common.getValueByPath(fromObject, new String[] {"historyConfig"})); + historyConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"historyConfig"})), + toObject)); } return toObject; @@ -1392,35 +1497,50 @@ ObjectNode liveConnectConfigToVertex(JsonNode fromObject, ObjectNode parentObjec Common.setValueByPath( parentObject, new String[] {"setup", "sessionResumption"}, - Common.getValueByPath(fromObject, new String[] {"sessionResumption"})); + sessionResumptionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"sessionResumption"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"}) != null) { Common.setValueByPath( parentObject, new String[] {"setup", "inputAudioTranscription"}, - Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"})); + audioTranscriptionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"inputAudioTranscription"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"}) != null) { Common.setValueByPath( parentObject, new String[] {"setup", "outputAudioTranscription"}, - Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"})); + audioTranscriptionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"outputAudioTranscription"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"realtimeInputConfig"}) != null) { Common.setValueByPath( parentObject, new String[] {"setup", "realtimeInputConfig"}, - Common.getValueByPath(fromObject, new String[] {"realtimeInputConfig"})); + realtimeInputConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"realtimeInputConfig"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"contextWindowCompression"}) != null) { Common.setValueByPath( parentObject, new String[] {"setup", "contextWindowCompression"}, - Common.getValueByPath(fromObject, new String[] {"contextWindowCompression"})); + contextWindowCompressionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"contextWindowCompression"})), + toObject)); } if (Common.getValueByPath(fromObject, new String[] {"proactivity"}) != null) { @@ -2038,6 +2158,31 @@ ObjectNode partToVertex(JsonNode fromObject, ObjectNode parentObject) { return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode realtimeInputConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (!Common.isZero( + Common.getValueByPath(fromObject, new String[] {"automaticActivityDetection"}))) { + throw new IllegalArgumentException( + "automaticActivityDetection parameter is only supported in Gemini Developer API mode, not" + + " in Gemini Enterprise Agent Platform mode."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"activityHandling"}))) { + throw new IllegalArgumentException( + "activityHandling parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"turnCoverage"}))) { + throw new IllegalArgumentException( + "turnCoverage parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode replicatedVoiceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); @@ -2115,6 +2260,25 @@ ObjectNode sessionResumptionConfigToMldev(JsonNode fromObject, ObjectNode parent return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode sessionResumptionConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"handle"}))) { + throw new IllegalArgumentException( + "handle parameter is only supported in Gemini Developer API mode, not in Gemini" + + " Enterprise Agent Platform mode."); + } + + if (Common.getValueByPath(fromObject, new String[] {"transparent"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"transparent"}, + Common.getValueByPath(fromObject, new String[] {"transparent"})); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode speakerVoiceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); diff --git a/src/main/java/com/google/genai/types/ActivityHandling.java b/src/main/java/com/google/genai/types/ActivityHandling.java index d2c39aacfac..cf1ac500fce 100644 --- a/src/main/java/com/google/genai/types/ActivityHandling.java +++ b/src/main/java/com/google/genai/types/ActivityHandling.java @@ -23,7 +23,7 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** The different ways of handling user activity. */ +/** Defines what effect activity has. This enum is not supported in Vertex AI. */ public class ActivityHandling { /** Enum representing the known values for ActivityHandling. */ diff --git a/src/main/java/com/google/genai/types/AuthToken.java b/src/main/java/com/google/genai/types/AuthToken.java index f97f6821bac..cb168721c88 100644 --- a/src/main/java/com/google/genai/types/AuthToken.java +++ b/src/main/java/com/google/genai/types/AuthToken.java @@ -24,16 +24,59 @@ import com.google.auto.value.AutoValue; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.genai.JsonSerializable; +import java.time.Instant; import java.util.Optional; /** Config for auth_tokens.create parameters. */ @AutoValue @JsonDeserialize(builder = AuthToken.Builder.class) public abstract class AuthToken extends JsonSerializable { - /** The name of the auth token. */ + /** Output only. Identifier. The token itself. */ @JsonProperty("name") public abstract Optional name(); + /** Optional. Input only. Immutable. Configuration specific to `BidiGenerateContent`. */ + @JsonProperty("bidiGenerateContentSetup") + public abstract Optional bidiGenerateContentSetup(); + + /** + * Optional. Input only. Immutable. An optional time after which, when using the resulting token, + * messages in BidiGenerateContent sessions will be rejected. (Gemini may preemptively close the + * session after this time.) If not set then this defaults to 30 minutes in the future. If set, + * this value must be less than 20 hours in the future. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Optional. Input only. Immutable. If field_mask is empty, and `bidi_generate_content_setup` is + * not present, then the effective `BidiGenerateContentSetup` message is taken from the Live API + * connection. If field_mask is empty, and `bidi_generate_content_setup` _is_ present, then the + * effective `BidiGenerateContentSetup` message is taken entirely from + * `bidi_generate_content_setup` in this request. The setup message from the Live API connection + * is ignored. If field_mask is not empty, then the corresponding fields from + * `bidi_generate_content_setup` will overwrite the fields from the setup message in the Live API + * connection. + */ + @JsonProperty("fieldMask") + public abstract Optional fieldMask(); + + /** + * Optional. Input only. Immutable. The time after which new Live API sessions using the token + * resulting from this request will be rejected. If not set this defaults to 60 seconds in the + * future. If set, this value must be less than 20 hours in the future. + */ + @JsonProperty("newSessionExpireTime") + public abstract Optional newSessionExpireTime(); + + /** + * Optional. Input only. Immutable. The number of times the token can be used. If this value is + * zero then no limit is applied. Resuming a Live API session does not count as a use. If + * unspecified, the default is 1. + */ + @JsonProperty("uses") + public abstract Optional uses(); + /** Instantiates a builder for AuthToken. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -55,7 +98,7 @@ private static Builder create() { /** * Setter for name. * - *

name: The name of the auth token. + *

name: Output only. Identifier. The token itself. */ @JsonProperty("name") public abstract Builder name(String name); @@ -70,6 +113,126 @@ public Builder clearName() { return name(Optional.empty()); } + /** + * Setter for bidiGenerateContentSetup. + * + *

bidiGenerateContentSetup: Optional. Input only. Immutable. Configuration specific to + * `BidiGenerateContent`. + */ + @JsonProperty("bidiGenerateContentSetup") + public abstract Builder bidiGenerateContentSetup( + BidiGenerateContentSetup bidiGenerateContentSetup); + + /** + * Setter for bidiGenerateContentSetup builder. + * + *

bidiGenerateContentSetup: Optional. Input only. Immutable. Configuration specific to + * `BidiGenerateContent`. + */ + @CanIgnoreReturnValue + public Builder bidiGenerateContentSetup( + BidiGenerateContentSetup.Builder bidiGenerateContentSetupBuilder) { + return bidiGenerateContentSetup(bidiGenerateContentSetupBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bidiGenerateContentSetup( + Optional bidiGenerateContentSetup); + + /** Clears the value of bidiGenerateContentSetup field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBidiGenerateContentSetup() { + return bidiGenerateContentSetup(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Input only. Immutable. An optional time after which, when using the + * resulting token, messages in BidiGenerateContent sessions will be rejected. (Gemini may + * preemptively close the session after this time.) If not set then this defaults to 30 minutes + * in the future. If set, this value must be less than 20 hours in the future. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for fieldMask. + * + *

fieldMask: Optional. Input only. Immutable. If field_mask is empty, and + * `bidi_generate_content_setup` is not present, then the effective `BidiGenerateContentSetup` + * message is taken from the Live API connection. If field_mask is empty, and + * `bidi_generate_content_setup` _is_ present, then the effective `BidiGenerateContentSetup` + * message is taken entirely from `bidi_generate_content_setup` in this request. The setup + * message from the Live API connection is ignored. If field_mask is not empty, then the + * corresponding fields from `bidi_generate_content_setup` will overwrite the fields from the + * setup message in the Live API connection. + */ + @JsonProperty("fieldMask") + public abstract Builder fieldMask(String fieldMask); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fieldMask(Optional fieldMask); + + /** Clears the value of fieldMask field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFieldMask() { + return fieldMask(Optional.empty()); + } + + /** + * Setter for newSessionExpireTime. + * + *

newSessionExpireTime: Optional. Input only. Immutable. The time after which new Live API + * sessions using the token resulting from this request will be rejected. If not set this + * defaults to 60 seconds in the future. If set, this value must be less than 20 hours in the + * future. + */ + @JsonProperty("newSessionExpireTime") + public abstract Builder newSessionExpireTime(Instant newSessionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder newSessionExpireTime(Optional newSessionExpireTime); + + /** Clears the value of newSessionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNewSessionExpireTime() { + return newSessionExpireTime(Optional.empty()); + } + + /** + * Setter for uses. + * + *

uses: Optional. Input only. Immutable. The number of times the token can be used. If this + * value is zero then no limit is applied. Resuming a Live API session does not count as a use. + * If unspecified, the default is 1. + */ + @JsonProperty("uses") + public abstract Builder uses(Integer uses); + + @ExcludeFromGeneratedCoverageReport + abstract Builder uses(Optional uses); + + /** Clears the value of uses field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUses() { + return uses(Optional.empty()); + } + public abstract AuthToken build(); } diff --git a/src/main/java/com/google/genai/types/AutomaticActivityDetection.java b/src/main/java/com/google/genai/types/AutomaticActivityDetection.java index 5fee77a7f9b..d34567e59a0 100644 --- a/src/main/java/com/google/genai/types/AutomaticActivityDetection.java +++ b/src/main/java/com/google/genai/types/AutomaticActivityDetection.java @@ -26,37 +26,37 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Configures automatic detection of activity. */ +/** Configures automatic detection of activity. This data type is not supported in Vertex AI. */ @AutoValue @JsonDeserialize(builder = AutomaticActivityDetection.Builder.class) public abstract class AutomaticActivityDetection extends JsonSerializable { /** - * If enabled, detected voice and text input count as activity. If disabled, the client must send - * activity signals. + * Optional. If enabled (the default), detected voice and text input count as activity. If + * disabled, the client must send activity signals. */ @JsonProperty("disabled") public abstract Optional disabled(); - /** Determines how likely speech is to be detected. */ + /** Optional. Determines how likely speech is to be detected. */ @JsonProperty("startOfSpeechSensitivity") public abstract Optional startOfSpeechSensitivity(); - /** Determines how likely detected speech is ended. */ + /** Optional. Determines how likely detected speech is ended. */ @JsonProperty("endOfSpeechSensitivity") public abstract Optional endOfSpeechSensitivity(); /** - * The required duration of detected speech before start-of-speech is committed. The lower this - * value the more sensitive the start-of-speech detection is and the shorter speech can be + * Optional. The required duration of detected speech before start-of-speech is committed. The + * lower this value, the more sensitive the start-of-speech detection is and shorter speech can be * recognized. However, this also increases the probability of false positives. */ @JsonProperty("prefixPaddingMs") public abstract Optional prefixPaddingMs(); /** - * The required duration of detected non-speech (e.g. silence) before end-of-speech is committed. - * The larger this value, the longer speech gaps can be without interrupting the user's activity - * but this will increase the model's latency. + * Optional. The required duration of detected non-speech (e.g. silence) before end-of-speech is + * committed. The larger this value, the longer speech gaps can be without interrupting the user's + * activity but this will increase the model's latency. */ @JsonProperty("silenceDurationMs") public abstract Optional silenceDurationMs(); @@ -82,8 +82,8 @@ private static Builder create() { /** * Setter for disabled. * - *

disabled: If enabled, detected voice and text input count as activity. If disabled, the - * client must send activity signals. + *

disabled: Optional. If enabled (the default), detected voice and text input count as + * activity. If disabled, the client must send activity signals. */ @JsonProperty("disabled") public abstract Builder disabled(boolean disabled); @@ -101,7 +101,7 @@ public Builder clearDisabled() { /** * Setter for startOfSpeechSensitivity. * - *

startOfSpeechSensitivity: Determines how likely speech is to be detected. + *

startOfSpeechSensitivity: Optional. Determines how likely speech is to be detected. */ @JsonProperty("startOfSpeechSensitivity") public abstract Builder startOfSpeechSensitivity(StartSensitivity startOfSpeechSensitivity); @@ -119,7 +119,7 @@ public Builder clearStartOfSpeechSensitivity() { /** * Setter for startOfSpeechSensitivity given a known enum. * - *

startOfSpeechSensitivity: Determines how likely speech is to be detected. + *

startOfSpeechSensitivity: Optional. Determines how likely speech is to be detected. */ @CanIgnoreReturnValue public Builder startOfSpeechSensitivity(StartSensitivity.Known knownType) { @@ -129,7 +129,7 @@ public Builder startOfSpeechSensitivity(StartSensitivity.Known knownType) { /** * Setter for startOfSpeechSensitivity given a string. * - *

startOfSpeechSensitivity: Determines how likely speech is to be detected. + *

startOfSpeechSensitivity: Optional. Determines how likely speech is to be detected. */ @CanIgnoreReturnValue public Builder startOfSpeechSensitivity(String startOfSpeechSensitivity) { @@ -139,7 +139,7 @@ public Builder startOfSpeechSensitivity(String startOfSpeechSensitivity) { /** * Setter for endOfSpeechSensitivity. * - *

endOfSpeechSensitivity: Determines how likely detected speech is ended. + *

endOfSpeechSensitivity: Optional. Determines how likely detected speech is ended. */ @JsonProperty("endOfSpeechSensitivity") public abstract Builder endOfSpeechSensitivity(EndSensitivity endOfSpeechSensitivity); @@ -157,7 +157,7 @@ public Builder clearEndOfSpeechSensitivity() { /** * Setter for endOfSpeechSensitivity given a known enum. * - *

endOfSpeechSensitivity: Determines how likely detected speech is ended. + *

endOfSpeechSensitivity: Optional. Determines how likely detected speech is ended. */ @CanIgnoreReturnValue public Builder endOfSpeechSensitivity(EndSensitivity.Known knownType) { @@ -167,7 +167,7 @@ public Builder endOfSpeechSensitivity(EndSensitivity.Known knownType) { /** * Setter for endOfSpeechSensitivity given a string. * - *

endOfSpeechSensitivity: Determines how likely detected speech is ended. + *

endOfSpeechSensitivity: Optional. Determines how likely detected speech is ended. */ @CanIgnoreReturnValue public Builder endOfSpeechSensitivity(String endOfSpeechSensitivity) { @@ -177,8 +177,8 @@ public Builder endOfSpeechSensitivity(String endOfSpeechSensitivity) { /** * Setter for prefixPaddingMs. * - *

prefixPaddingMs: The required duration of detected speech before start-of-speech is - * committed. The lower this value the more sensitive the start-of-speech detection is and the + *

prefixPaddingMs: Optional. The required duration of detected speech before start-of-speech + * is committed. The lower this value, the more sensitive the start-of-speech detection is and * shorter speech can be recognized. However, this also increases the probability of false * positives. */ @@ -198,9 +198,9 @@ public Builder clearPrefixPaddingMs() { /** * Setter for silenceDurationMs. * - *

silenceDurationMs: The required duration of detected non-speech (e.g. silence) before - * end-of-speech is committed. The larger this value, the longer speech gaps can be without - * interrupting the user's activity but this will increase the model's latency. + *

silenceDurationMs: Optional. The required duration of detected non-speech (e.g. silence) + * before end-of-speech is committed. The larger this value, the longer speech gaps can be + * without interrupting the user's activity but this will increase the model's latency. */ @JsonProperty("silenceDurationMs") public abstract Builder silenceDurationMs(Integer silenceDurationMs); diff --git a/src/main/java/com/google/genai/types/BidiGenerateContentSetup.java b/src/main/java/com/google/genai/types/BidiGenerateContentSetup.java new file mode 100644 index 00000000000..526db7c739f --- /dev/null +++ b/src/main/java/com/google/genai/types/BidiGenerateContentSetup.java @@ -0,0 +1,455 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * Message to be sent in the first (and only in the first) `BidiGenerateContentClientMessage`. + * Contains configuration that will apply for the duration of the streaming RPC. Clients should wait + * for a `BidiGenerateContentSetupComplete` message before sending any additional messages. This + * data type is not supported in Vertex AI. + */ +@AutoValue +@JsonDeserialize(builder = BidiGenerateContentSetup.Builder.class) +public abstract class BidiGenerateContentSetup extends JsonSerializable { + /** + * Optional. Configures a context window compression mechanism. If included, the server will + * automatically reduce the size of the context when it exceeds the configured length. + */ + @JsonProperty("contextWindowCompression") + public abstract Optional contextWindowCompression(); + + /** + * Optional. Generation config. The following fields are not supported: - `response_logprobs` - + * `response_mime_type` - `logprobs` - `response_schema` - `response_json_schema` - + * `stop_sequence` - `skip_response_cache` - `routing_config` - `audio_timestamp` + */ + @JsonProperty("generationConfig") + public abstract Optional generationConfig(); + + /** Optional. Configures the exchange of history between the client and the server. */ + @JsonProperty("historyConfig") + public abstract Optional historyConfig(); + + /** + * Optional. If set, enables transcription of voice input. The transcription aligns with the input + * audio language, if configured. + */ + @JsonProperty("inputAudioTranscription") + public abstract Optional inputAudioTranscription(); + + /** + * Required. The model's resource name. This serves as an ID for the Model to use. Format: + * `models/{model}` + */ + @JsonProperty("model") + public abstract Optional model(); + + /** + * Optional. If set, enables transcription of the model's audio output. The transcription aligns + * with the language code specified for the output audio, if configured. + */ + @JsonProperty("outputAudioTranscription") + public abstract Optional outputAudioTranscription(); + + /** Optional. Configures the handling of realtime input. */ + @JsonProperty("realtimeInputConfig") + public abstract Optional realtimeInputConfig(); + + /** + * Optional. Configures session resumption mechanism. If included, the server will send + * `SessionResumptionUpdate` messages. + */ + @JsonProperty("sessionResumption") + public abstract Optional sessionResumption(); + + /** + * Optional. 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. + */ + @JsonProperty("systemInstruction") + public abstract Optional systemInstruction(); + + /** + * Optional. 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. + */ + @JsonProperty("tools") + public abstract Optional> tools(); + + /** Instantiates a builder for BidiGenerateContentSetup. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BidiGenerateContentSetup.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BidiGenerateContentSetup. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BidiGenerateContentSetup.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BidiGenerateContentSetup.Builder(); + } + + /** + * Setter for contextWindowCompression. + * + *

contextWindowCompression: Optional. Configures a context window compression mechanism. If + * included, the server will automatically reduce the size of the context when it exceeds the + * configured length. + */ + @JsonProperty("contextWindowCompression") + public abstract Builder contextWindowCompression( + ContextWindowCompressionConfig contextWindowCompression); + + /** + * Setter for contextWindowCompression builder. + * + *

contextWindowCompression: Optional. Configures a context window compression mechanism. If + * included, the server will automatically reduce the size of the context when it exceeds the + * configured length. + */ + @CanIgnoreReturnValue + public Builder contextWindowCompression( + ContextWindowCompressionConfig.Builder contextWindowCompressionBuilder) { + return contextWindowCompression(contextWindowCompressionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contextWindowCompression( + Optional contextWindowCompression); + + /** Clears the value of contextWindowCompression field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContextWindowCompression() { + return contextWindowCompression(Optional.empty()); + } + + /** + * Setter for generationConfig. + * + *

generationConfig: Optional. Generation config. The following fields are not supported: - + * `response_logprobs` - `response_mime_type` - `logprobs` - `response_schema` - + * `response_json_schema` - `stop_sequence` - `skip_response_cache` - `routing_config` - + * `audio_timestamp` + */ + @JsonProperty("generationConfig") + public abstract Builder generationConfig(GenerationConfig generationConfig); + + /** + * Setter for generationConfig builder. + * + *

generationConfig: Optional. Generation config. The following fields are not supported: - + * `response_logprobs` - `response_mime_type` - `logprobs` - `response_schema` - + * `response_json_schema` - `stop_sequence` - `skip_response_cache` - `routing_config` - + * `audio_timestamp` + */ + @CanIgnoreReturnValue + public Builder generationConfig(GenerationConfig.Builder generationConfigBuilder) { + return generationConfig(generationConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder generationConfig(Optional generationConfig); + + /** Clears the value of generationConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGenerationConfig() { + return generationConfig(Optional.empty()); + } + + /** + * Setter for historyConfig. + * + *

historyConfig: Optional. Configures the exchange of history between the client and the + * server. + */ + @JsonProperty("historyConfig") + public abstract Builder historyConfig(HistoryConfig historyConfig); + + /** + * Setter for historyConfig builder. + * + *

historyConfig: Optional. Configures the exchange of history between the client and the + * server. + */ + @CanIgnoreReturnValue + public Builder historyConfig(HistoryConfig.Builder historyConfigBuilder) { + return historyConfig(historyConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder historyConfig(Optional historyConfig); + + /** Clears the value of historyConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHistoryConfig() { + return historyConfig(Optional.empty()); + } + + /** + * Setter for inputAudioTranscription. + * + *

inputAudioTranscription: Optional. If set, enables transcription of voice input. The + * transcription aligns with the input audio language, if configured. + */ + @JsonProperty("inputAudioTranscription") + public abstract Builder inputAudioTranscription( + AudioTranscriptionConfig inputAudioTranscription); + + /** + * Setter for inputAudioTranscription builder. + * + *

inputAudioTranscription: Optional. If set, enables transcription of voice input. The + * transcription aligns with the input audio language, if configured. + */ + @CanIgnoreReturnValue + public Builder inputAudioTranscription( + AudioTranscriptionConfig.Builder inputAudioTranscriptionBuilder) { + return inputAudioTranscription(inputAudioTranscriptionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputAudioTranscription( + Optional inputAudioTranscription); + + /** Clears the value of inputAudioTranscription field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputAudioTranscription() { + return inputAudioTranscription(Optional.empty()); + } + + /** + * Setter for model. + * + *

model: Required. The model's resource name. This serves as an ID for the Model to use. + * Format: `models/{model}` + */ + @JsonProperty("model") + public abstract Builder model(String model); + + @ExcludeFromGeneratedCoverageReport + abstract Builder model(Optional model); + + /** Clears the value of model field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModel() { + return model(Optional.empty()); + } + + /** + * Setter for outputAudioTranscription. + * + *

outputAudioTranscription: Optional. If set, enables transcription of the model's audio + * output. The transcription aligns with the language code specified for the output audio, if + * configured. + */ + @JsonProperty("outputAudioTranscription") + public abstract Builder outputAudioTranscription( + AudioTranscriptionConfig outputAudioTranscription); + + /** + * Setter for outputAudioTranscription builder. + * + *

outputAudioTranscription: Optional. If set, enables transcription of the model's audio + * output. The transcription aligns with the language code specified for the output audio, if + * configured. + */ + @CanIgnoreReturnValue + public Builder outputAudioTranscription( + AudioTranscriptionConfig.Builder outputAudioTranscriptionBuilder) { + return outputAudioTranscription(outputAudioTranscriptionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder outputAudioTranscription( + Optional outputAudioTranscription); + + /** Clears the value of outputAudioTranscription field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutputAudioTranscription() { + return outputAudioTranscription(Optional.empty()); + } + + /** + * Setter for realtimeInputConfig. + * + *

realtimeInputConfig: Optional. Configures the handling of realtime input. + */ + @JsonProperty("realtimeInputConfig") + public abstract Builder realtimeInputConfig(RealtimeInputConfig realtimeInputConfig); + + /** + * Setter for realtimeInputConfig builder. + * + *

realtimeInputConfig: Optional. Configures the handling of realtime input. + */ + @CanIgnoreReturnValue + public Builder realtimeInputConfig(RealtimeInputConfig.Builder realtimeInputConfigBuilder) { + return realtimeInputConfig(realtimeInputConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder realtimeInputConfig(Optional realtimeInputConfig); + + /** Clears the value of realtimeInputConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRealtimeInputConfig() { + return realtimeInputConfig(Optional.empty()); + } + + /** + * Setter for sessionResumption. + * + *

sessionResumption: Optional. Configures session resumption mechanism. If included, the + * server will send `SessionResumptionUpdate` messages. + */ + @JsonProperty("sessionResumption") + public abstract Builder sessionResumption(SessionResumptionConfig sessionResumption); + + /** + * Setter for sessionResumption builder. + * + *

sessionResumption: Optional. Configures session resumption mechanism. If included, the + * server will send `SessionResumptionUpdate` messages. + */ + @CanIgnoreReturnValue + public Builder sessionResumption(SessionResumptionConfig.Builder sessionResumptionBuilder) { + return sessionResumption(sessionResumptionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sessionResumption(Optional sessionResumption); + + /** Clears the value of sessionResumption field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSessionResumption() { + return sessionResumption(Optional.empty()); + } + + /** + * Setter for systemInstruction. + * + *

systemInstruction: Optional. 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. + */ + @JsonProperty("systemInstruction") + public abstract Builder systemInstruction(Content systemInstruction); + + /** + * Setter for systemInstruction builder. + * + *

systemInstruction: Optional. 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. + */ + @CanIgnoreReturnValue + public Builder systemInstruction(Content.Builder systemInstructionBuilder) { + return systemInstruction(systemInstructionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder systemInstruction(Optional systemInstruction); + + /** Clears the value of systemInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSystemInstruction() { + return systemInstruction(Optional.empty()); + } + + /** + * Setter for tools. + * + *

tools: Optional. 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. + */ + @JsonProperty("tools") + public abstract Builder tools(List tools); + + /** + * Setter for tools. + * + *

tools: Optional. 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. + */ + @CanIgnoreReturnValue + public Builder tools(Tool... tools) { + return tools(Arrays.asList(tools)); + } + + /** + * Setter for tools builder. + * + *

tools: Optional. 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. + */ + @CanIgnoreReturnValue + public Builder tools(Tool.Builder... toolsBuilders) { + return tools( + Arrays.asList(toolsBuilders).stream() + .map(Tool.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder tools(Optional> tools); + + /** Clears the value of tools field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTools() { + return tools(Optional.empty()); + } + + public abstract BidiGenerateContentSetup build(); + } + + /** Deserializes a JSON string to a BidiGenerateContentSetup object. */ + @ExcludeFromGeneratedCoverageReport + public static BidiGenerateContentSetup fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BidiGenerateContentSetup.class); + } +} diff --git a/src/main/java/com/google/genai/types/ContextWindowCompressionConfig.java b/src/main/java/com/google/genai/types/ContextWindowCompressionConfig.java index 5e3e34ffdd3..b6ec110aa54 100644 --- a/src/main/java/com/google/genai/types/ContextWindowCompressionConfig.java +++ b/src/main/java/com/google/genai/types/ContextWindowCompressionConfig.java @@ -27,17 +27,23 @@ import java.util.Optional; /** - * Enables context window compression -- mechanism managing model context window so it does not - * exceed given length. + * Enables context window compression — a mechanism for managing the model's context window so that + * it does not exceed a given length. This data type is not supported in Vertex AI. */ @AutoValue @JsonDeserialize(builder = ContextWindowCompressionConfig.Builder.class) public abstract class ContextWindowCompressionConfig extends JsonSerializable { - /** Number of tokens (before running turn) that triggers context window compression mechanism. */ + /** + * The number of tokens (before running a turn) required to trigger a context window compression. + * This can be used to balance quality against latency as shorter context windows may result in + * faster model responses. However, any compression operation will cause a temporary latency + * increase, so they should not be triggered frequently. If not set, the default is 80% of the + * model's context window limit. This leaves 20% for the next user request/model response. + */ @JsonProperty("triggerTokens") public abstract Optional triggerTokens(); - /** Sliding window compression mechanism. */ + /** A sliding-window mechanism. */ @JsonProperty("slidingWindow") public abstract Optional slidingWindow(); @@ -64,8 +70,12 @@ private static Builder create() { /** * Setter for triggerTokens. * - *

triggerTokens: Number of tokens (before running turn) that triggers context window - * compression mechanism. + *

triggerTokens: The number of tokens (before running a turn) required to trigger a context + * window compression. This can be used to balance quality against latency as shorter context + * windows may result in faster model responses. However, any compression operation will cause a + * temporary latency increase, so they should not be triggered frequently. If not set, the + * default is 80% of the model's context window limit. This leaves 20% for the next user + * request/model response. */ @JsonProperty("triggerTokens") public abstract Builder triggerTokens(Long triggerTokens); @@ -83,7 +93,7 @@ public Builder clearTriggerTokens() { /** * Setter for slidingWindow. * - *

slidingWindow: Sliding window compression mechanism. + *

slidingWindow: A sliding-window mechanism. */ @JsonProperty("slidingWindow") public abstract Builder slidingWindow(SlidingWindow slidingWindow); @@ -91,7 +101,7 @@ public Builder clearTriggerTokens() { /** * Setter for slidingWindow builder. * - *

slidingWindow: Sliding window compression mechanism. + *

slidingWindow: A sliding-window mechanism. */ @CanIgnoreReturnValue public Builder slidingWindow(SlidingWindow.Builder slidingWindowBuilder) { diff --git a/src/main/java/com/google/genai/types/EndSensitivity.java b/src/main/java/com/google/genai/types/EndSensitivity.java index 04ab74b27f6..11ab9e9dea2 100644 --- a/src/main/java/com/google/genai/types/EndSensitivity.java +++ b/src/main/java/com/google/genai/types/EndSensitivity.java @@ -23,15 +23,12 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** End of speech sensitivity. */ +/** Determines how likely detected speech is ended. This enum is not supported in Vertex AI. */ public class EndSensitivity { /** Enum representing the known values for EndSensitivity. */ public enum Known { - /** - * The default is END_SENSITIVITY_LOW for Gemini Enterprise Agent Platform and - * END_SENSITIVITY_HIGH for Gemini Live. - */ + /** The default is END_SENSITIVITY_HIGH. */ END_SENSITIVITY_UNSPECIFIED, /** Automatic detection ends speech more often. */ diff --git a/src/main/java/com/google/genai/types/GenerationConfig.java b/src/main/java/com/google/genai/types/GenerationConfig.java index e35403c01a4..fed14606e8c 100644 --- a/src/main/java/com/google/genai/types/GenerationConfig.java +++ b/src/main/java/com/google/genai/types/GenerationConfig.java @@ -65,7 +65,7 @@ public abstract class GenerationConfig extends JsonSerializable { /** * Optional. If enabled, the model will detect emotions and adapt its responses accordingly. For * example, if the model detects that the user is frustrated, it may provide a more empathetic - * response. This field is not supported in Gemini API. + * response. */ @JsonProperty("enableAffectiveDialog") public abstract Optional enableAffectiveDialog(); @@ -338,7 +338,7 @@ public Builder clearCandidateCount() { * *

enableAffectiveDialog: Optional. If enabled, the model will detect emotions and adapt its * responses accordingly. For example, if the model detects that the user is frustrated, it may - * provide a more empathetic response. This field is not supported in Gemini API. + * provide a more empathetic response. */ @JsonProperty("enableAffectiveDialog") public abstract Builder enableAffectiveDialog(boolean enableAffectiveDialog); diff --git a/src/main/java/com/google/genai/types/HarmCategory.java b/src/main/java/com/google/genai/types/HarmCategory.java index d28271667be..f3e3d0172f2 100644 --- a/src/main/java/com/google/genai/types/HarmCategory.java +++ b/src/main/java/com/google/genai/types/HarmCategory.java @@ -51,6 +51,9 @@ public enum Known { */ HARM_CATEGORY_CIVIC_INTEGRITY, + /** Prompts designed to bypass safety filters. */ + HARM_CATEGORY_JAILBREAK, + /** Images that contain hate speech. This enum value is not supported in Gemini API. */ HARM_CATEGORY_IMAGE_HATE, @@ -64,12 +67,7 @@ public enum Known { * Images that contain sexually explicit content. This enum value is not supported in Gemini * API. */ - HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT, - - /** - * Prompts designed to bypass safety filters. This enum value is not supported in Gemini API. - */ - HARM_CATEGORY_JAILBREAK + HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT } private Known harmCategoryEnum; diff --git a/src/main/java/com/google/genai/types/HistoryConfig.java b/src/main/java/com/google/genai/types/HistoryConfig.java index 197ca74e3ec..71f1da78172 100644 --- a/src/main/java/com/google/genai/types/HistoryConfig.java +++ b/src/main/java/com/google/genai/types/HistoryConfig.java @@ -26,15 +26,19 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** Configuration for history exchange between client and server. */ +/** + * History configuration. This message is included in the session configuration as + * `BidiGenerateContentSetup.history_config`. Configures the exchange of history messages. This data + * type is not supported in Vertex AI. + */ @AutoValue @JsonDeserialize(builder = HistoryConfig.Builder.class) public abstract class HistoryConfig extends JsonSerializable { /** - * If true, after sending `setup_complete`, the server will wait and at first process + * Optional. If true, after sending `setup_complete`, the server will wait and at first process * `client_content` messages until `turn_complete` is `true`. This initial history will not - * trigger a model call and may end with model content. After `turn_complete` is `true`, the - * client can start the realtime conversation via `realtime_input`. + * trigger a model call and may end with role `MODEL`. After `turn_complete` is `true`, the client + * can start the realtime conversation via `realtime_input`. */ @JsonProperty("initialHistoryInClientContent") public abstract Optional initialHistoryInClientContent(); @@ -60,10 +64,10 @@ private static Builder create() { /** * Setter for initialHistoryInClientContent. * - *

initialHistoryInClientContent: If true, after sending `setup_complete`, the server will - * wait and at first process `client_content` messages until `turn_complete` is `true`. This - * initial history will not trigger a model call and may end with model content. After - * `turn_complete` is `true`, the client can start the realtime conversation via + *

initialHistoryInClientContent: Optional. If true, after sending `setup_complete`, the + * server will wait and at first process `client_content` messages until `turn_complete` is + * `true`. This initial history will not trigger a model call and may end with role `MODEL`. + * After `turn_complete` is `true`, the client can start the realtime conversation via * `realtime_input`. */ @JsonProperty("initialHistoryInClientContent") diff --git a/src/main/java/com/google/genai/types/LanguageAuto.java b/src/main/java/com/google/genai/types/LanguageAuto.java index b675299ea38..780e7588fe1 100644 --- a/src/main/java/com/google/genai/types/LanguageAuto.java +++ b/src/main/java/com/google/genai/types/LanguageAuto.java @@ -23,7 +23,10 @@ import com.google.auto.value.AutoValue; import com.google.genai.JsonSerializable; -/** Indicates the language of the audio should be automatically detected. */ +/** + * Indicates the language of the audio should be automatically detected. This data type is not + * supported in Vertex AI. + */ @AutoValue @JsonDeserialize(builder = LanguageAuto.Builder.class) public abstract class LanguageAuto extends JsonSerializable { diff --git a/src/main/java/com/google/genai/types/LanguageHints.java b/src/main/java/com/google/genai/types/LanguageHints.java index 68c82eae239..7b25d36736f 100644 --- a/src/main/java/com/google/genai/types/LanguageHints.java +++ b/src/main/java/com/google/genai/types/LanguageHints.java @@ -28,11 +28,14 @@ import java.util.List; import java.util.Optional; -/** Provides hints to the model about possible languages present in the audio. */ +/** + * Provides hints to the model about possible languages present in the audio. This data type is not + * supported in Vertex AI. + */ @AutoValue @JsonDeserialize(builder = LanguageHints.Builder.class) public abstract class LanguageHints extends JsonSerializable { - /** BCP-47 language codes. At least one must be specified. */ + /** Required. BCP-47 language codes. */ @JsonProperty("languageCodes") public abstract Optional> languageCodes(); @@ -57,7 +60,7 @@ private static Builder create() { /** * Setter for languageCodes. * - *

languageCodes: BCP-47 language codes. At least one must be specified. + *

languageCodes: Required. BCP-47 language codes. */ @JsonProperty("languageCodes") public abstract Builder languageCodes(List languageCodes); @@ -65,7 +68,7 @@ private static Builder create() { /** * Setter for languageCodes. * - *

languageCodes: BCP-47 language codes. At least one must be specified. + *

languageCodes: Required. BCP-47 language codes. */ @CanIgnoreReturnValue public Builder languageCodes(String... languageCodes) { diff --git a/src/main/java/com/google/genai/types/RealtimeInputConfig.java b/src/main/java/com/google/genai/types/RealtimeInputConfig.java index c8e8254f086..b6635c994df 100644 --- a/src/main/java/com/google/genai/types/RealtimeInputConfig.java +++ b/src/main/java/com/google/genai/types/RealtimeInputConfig.java @@ -27,25 +27,24 @@ import java.util.Optional; /** - * Marks the end of user activity. - * - *

This can only be sent if automatic (i.e. server-side) activity detection is disabled. + * Configures the realtime input behavior in `BidiGenerateContent`. This data type is not supported + * in Vertex AI. */ @AutoValue @JsonDeserialize(builder = RealtimeInputConfig.Builder.class) public abstract class RealtimeInputConfig extends JsonSerializable { /** - * If not set, automatic activity detection is enabled by default. If automatic voice detection is - * disabled, the client must send activity signals. + * Optional. If not set, automatic activity detection is enabled by default. If automatic voice + * detection is disabled, the client must send activity signals. */ @JsonProperty("automaticActivityDetection") public abstract Optional automaticActivityDetection(); - /** Defines what effect activity has. */ + /** Optional. Defines what effect activity has. */ @JsonProperty("activityHandling") public abstract Optional activityHandling(); - /** Defines which input is included in the user's turn. */ + /** Optional. Defines which input is included in the user's turn. */ @JsonProperty("turnCoverage") public abstract Optional turnCoverage(); @@ -70,8 +69,8 @@ private static Builder create() { /** * Setter for automaticActivityDetection. * - *

automaticActivityDetection: If not set, automatic activity detection is enabled by - * default. If automatic voice detection is disabled, the client must send activity signals. + *

automaticActivityDetection: Optional. If not set, automatic activity detection is enabled + * by default. If automatic voice detection is disabled, the client must send activity signals. */ @JsonProperty("automaticActivityDetection") public abstract Builder automaticActivityDetection( @@ -80,8 +79,8 @@ public abstract Builder automaticActivityDetection( /** * Setter for automaticActivityDetection builder. * - *

automaticActivityDetection: If not set, automatic activity detection is enabled by - * default. If automatic voice detection is disabled, the client must send activity signals. + *

automaticActivityDetection: Optional. If not set, automatic activity detection is enabled + * by default. If automatic voice detection is disabled, the client must send activity signals. */ @CanIgnoreReturnValue public Builder automaticActivityDetection( @@ -103,7 +102,7 @@ public Builder clearAutomaticActivityDetection() { /** * Setter for activityHandling. * - *

activityHandling: Defines what effect activity has. + *

activityHandling: Optional. Defines what effect activity has. */ @JsonProperty("activityHandling") public abstract Builder activityHandling(ActivityHandling activityHandling); @@ -121,7 +120,7 @@ public Builder clearActivityHandling() { /** * Setter for activityHandling given a known enum. * - *

activityHandling: Defines what effect activity has. + *

activityHandling: Optional. Defines what effect activity has. */ @CanIgnoreReturnValue public Builder activityHandling(ActivityHandling.Known knownType) { @@ -131,7 +130,7 @@ public Builder activityHandling(ActivityHandling.Known knownType) { /** * Setter for activityHandling given a string. * - *

activityHandling: Defines what effect activity has. + *

activityHandling: Optional. Defines what effect activity has. */ @CanIgnoreReturnValue public Builder activityHandling(String activityHandling) { @@ -141,7 +140,7 @@ public Builder activityHandling(String activityHandling) { /** * Setter for turnCoverage. * - *

turnCoverage: Defines which input is included in the user's turn. + *

turnCoverage: Optional. Defines which input is included in the user's turn. */ @JsonProperty("turnCoverage") public abstract Builder turnCoverage(TurnCoverage turnCoverage); @@ -159,7 +158,7 @@ public Builder clearTurnCoverage() { /** * Setter for turnCoverage given a known enum. * - *

turnCoverage: Defines which input is included in the user's turn. + *

turnCoverage: Optional. Defines which input is included in the user's turn. */ @CanIgnoreReturnValue public Builder turnCoverage(TurnCoverage.Known knownType) { @@ -169,7 +168,7 @@ public Builder turnCoverage(TurnCoverage.Known knownType) { /** * Setter for turnCoverage given a string. * - *

turnCoverage: Defines which input is included in the user's turn. + *

turnCoverage: Optional. Defines which input is included in the user's turn. */ @CanIgnoreReturnValue public Builder turnCoverage(String turnCoverage) { diff --git a/src/main/java/com/google/genai/types/ReinforcementTuningHyperParameters.java b/src/main/java/com/google/genai/types/ReinforcementTuningHyperParameters.java index e94f49c6cc9..605b820b378 100644 --- a/src/main/java/com/google/genai/types/ReinforcementTuningHyperParameters.java +++ b/src/main/java/com/google/genai/types/ReinforcementTuningHyperParameters.java @@ -90,6 +90,10 @@ public abstract class ReinforcementTuningHyperParameters extends JsonSerializabl @JsonProperty("thinkingBudget") public abstract Optional thinkingBudget(); + /** Optional. Number of steps for the tuning job (mutually exclusive with epoch_count). */ + @JsonProperty("stepCount") + public abstract Optional stepCount(); + /** Instantiates a builder for ReinforcementTuningHyperParameters. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -349,6 +353,25 @@ public Builder clearThinkingBudget() { return thinkingBudget(Optional.empty()); } + /** + * Setter for stepCount. + * + *

stepCount: Optional. Number of steps for the tuning job (mutually exclusive with + * epoch_count). + */ + @JsonProperty("stepCount") + public abstract Builder stepCount(Long stepCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder stepCount(Optional stepCount); + + /** Clears the value of stepCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStepCount() { + return stepCount(Optional.empty()); + } + public abstract ReinforcementTuningHyperParameters build(); } diff --git a/src/main/java/com/google/genai/types/SessionResumptionConfig.java b/src/main/java/com/google/genai/types/SessionResumptionConfig.java index 4006c1552b8..0bdc4dc98c3 100644 --- a/src/main/java/com/google/genai/types/SessionResumptionConfig.java +++ b/src/main/java/com/google/genai/types/SessionResumptionConfig.java @@ -36,9 +36,8 @@ @JsonDeserialize(builder = SessionResumptionConfig.Builder.class) public abstract class SessionResumptionConfig extends JsonSerializable { /** - * Session resumption handle of previous session (session to restore). - * - *

If not present new session will be started. + * The handle of a previous session. If not present then a new session is created. Session handles + * come from `SessionResumptionUpdate.token` values in previous connections. */ @JsonProperty("handle") public abstract Optional handle(); @@ -71,9 +70,8 @@ private static Builder create() { /** * Setter for handle. * - *

handle: Session resumption handle of previous session (session to restore). - * - *

If not present new session will be started. + *

handle: The handle of a previous session. If not present then a new session is created. + * Session handles come from `SessionResumptionUpdate.token` values in previous connections. */ @JsonProperty("handle") public abstract Builder handle(String handle); diff --git a/src/main/java/com/google/genai/types/SlidingWindow.java b/src/main/java/com/google/genai/types/SlidingWindow.java index 6404af53364..92952971681 100644 --- a/src/main/java/com/google/genai/types/SlidingWindow.java +++ b/src/main/java/com/google/genai/types/SlidingWindow.java @@ -27,19 +27,18 @@ import java.util.Optional; /** - * Context window will be truncated by keeping only suffix of it. - * - *

Context window will always be cut at start of USER role turn. System instructions and - * `BidiGenerateContentSetup.prefix_turns` will not be subject to the sliding window mechanism, they - * will always stay at the beginning of context window. + * The SlidingWindow method operates by discarding content at the beginning of the context window. + * The resulting context will always begin at the start of a USER role turn. System instructions and + * any `BidiGenerateContentSetup.prefix_turns` will always remain at the beginning of the result. + * This data type is not supported in Vertex AI. */ @AutoValue @JsonDeserialize(builder = SlidingWindow.Builder.class) public abstract class SlidingWindow extends JsonSerializable { /** - * Session reduction target -- how many tokens we should keep. Window shortening operation has - * some latency costs, so we should avoid running it on every turn. Should be < trigger_tokens. - * If not set, trigger_tokens/2 is assumed. + * The target number of tokens to keep. The default value is trigger_tokens/2. Discarding parts of + * the context window causes a temporary latency increase so this value should be calibrated to + * avoid frequent compression operations. */ @JsonProperty("targetTokens") public abstract Optional targetTokens(); @@ -65,9 +64,9 @@ private static Builder create() { /** * Setter for targetTokens. * - *

targetTokens: Session reduction target -- how many tokens we should keep. Window - * shortening operation has some latency costs, so we should avoid running it on every turn. - * Should be < trigger_tokens. If not set, trigger_tokens/2 is assumed. + *

targetTokens: The target number of tokens to keep. The default value is trigger_tokens/2. + * Discarding parts of the context window causes a temporary latency increase so this value + * should be calibrated to avoid frequent compression operations. */ @JsonProperty("targetTokens") public abstract Builder targetTokens(Long targetTokens); diff --git a/src/main/java/com/google/genai/types/StartSensitivity.java b/src/main/java/com/google/genai/types/StartSensitivity.java index fd3420a2f19..ec47d34221a 100644 --- a/src/main/java/com/google/genai/types/StartSensitivity.java +++ b/src/main/java/com/google/genai/types/StartSensitivity.java @@ -23,15 +23,12 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** Start of speech sensitivity. */ +/** Determines how likely speech is to be detected. This enum is not supported in Vertex AI. */ public class StartSensitivity { /** Enum representing the known values for StartSensitivity. */ public enum Known { - /** - * The default is START_SENSITIVITY_LOW for Gemini Enterprise Agent Platform and - * START_SENSITIVITY_HIGH for Gemini Live. - */ + /** The default is START_SENSITIVITY_HIGH. */ START_SENSITIVITY_UNSPECIFIED, /** Automatic detection will detect the start of speech more often. */ diff --git a/src/main/java/com/google/genai/types/ToolParallelAiSearch.java b/src/main/java/com/google/genai/types/ToolParallelAiSearch.java index 70c2d5c9fbe..3c350305cc2 100644 --- a/src/main/java/com/google/genai/types/ToolParallelAiSearch.java +++ b/src/main/java/com/google/genai/types/ToolParallelAiSearch.java @@ -54,6 +54,24 @@ public abstract class ToolParallelAiSearch extends JsonSerializable { @JsonProperty("customConfigs") public abstract Optional> customConfigs(); + /** + * Optional. Deprecated: Use `enable_zero_data_retention` instead. Instructs Vertex Grounding to + * use Parallel's Zero Data Retention Marketplace product. If this value is "false" or omitted, + * the Parallel Web Search for Grounding standard subscription will be used. If this value is + * "true", the Parallel Web Search for Grounding - ZDR subscription will be used. + */ + @JsonProperty("enableDataRetention") + public abstract Optional enableDataRetention(); + + /** + * Optional. Instructs Vertex Grounding to use Parallel's Zero Data Retention Marketplace product. + * If this value is "false" or omitted, the Parallel Web Search for Grounding standard + * subscription will be used. If this value is "true", the Parallel Web Search for Grounding - ZDR + * subscription will be used. + */ + @JsonProperty("enableZeroDataRetention") + public abstract Optional enableZeroDataRetention(); + /** Instantiates a builder for ToolParallelAiSearch. */ @ExcludeFromGeneratedCoverageReport public static Builder builder() { @@ -117,6 +135,49 @@ public Builder clearCustomConfigs() { return customConfigs(Optional.empty()); } + /** + * Setter for enableDataRetention. + * + *

enableDataRetention: Optional. Deprecated: Use `enable_zero_data_retention` instead. + * Instructs Vertex Grounding to use Parallel's Zero Data Retention Marketplace product. If this + * value is "false" or omitted, the Parallel Web Search for Grounding standard subscription will + * be used. If this value is "true", the Parallel Web Search for Grounding - ZDR subscription + * will be used. + */ + @JsonProperty("enableDataRetention") + public abstract Builder enableDataRetention(boolean enableDataRetention); + + @ExcludeFromGeneratedCoverageReport + abstract Builder enableDataRetention(Optional enableDataRetention); + + /** Clears the value of enableDataRetention field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnableDataRetention() { + return enableDataRetention(Optional.empty()); + } + + /** + * Setter for enableZeroDataRetention. + * + *

enableZeroDataRetention: Optional. Instructs Vertex Grounding to use Parallel's Zero Data + * Retention Marketplace product. If this value is "false" or omitted, the Parallel Web Search + * for Grounding standard subscription will be used. If this value is "true", the Parallel Web + * Search for Grounding - ZDR subscription will be used. + */ + @JsonProperty("enableZeroDataRetention") + public abstract Builder enableZeroDataRetention(boolean enableZeroDataRetention); + + @ExcludeFromGeneratedCoverageReport + abstract Builder enableZeroDataRetention(Optional enableZeroDataRetention); + + /** Clears the value of enableZeroDataRetention field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnableZeroDataRetention() { + return enableZeroDataRetention(Optional.empty()); + } + public abstract ToolParallelAiSearch build(); } diff --git a/src/main/java/com/google/genai/types/TurnCoverage.java b/src/main/java/com/google/genai/types/TurnCoverage.java index e61d707c340..66dbd76c0e8 100644 --- a/src/main/java/com/google/genai/types/TurnCoverage.java +++ b/src/main/java/com/google/genai/types/TurnCoverage.java @@ -23,23 +23,27 @@ import com.google.common.base.Ascii; import java.util.Objects; -/** Options about which input is included in the user's turn. */ +/** Defines which input is included in the user's turn. This enum is not supported in Vertex AI. */ public class TurnCoverage { /** Enum representing the known values for TurnCoverage. */ public enum Known { - /** If unspecified, the default behavior is `TURN_INCLUDES_ONLY_ACTIVITY`. */ + /** + * If unspecified, a default behavior is selected based on the model. E.g., for Gemini 2.5, the + * default is `TURN_INCLUDES_ONLY_ACTIVITY`, while for Gemini 3.1 and onwards, it's + * `TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO`. + */ TURN_COVERAGE_UNSPECIFIED, /** - * The users turn only includes activity since the last turn, excluding inactivity (e.g. silence - * on the audio stream). This is the default behavior. + * Includes activity since the last turn, excluding inactivity (e.g. silence on the audio + * stream). */ TURN_INCLUDES_ONLY_ACTIVITY, /** - * The users turn includes all realtime input since the last turn, including inactivity (e.g. - * silence on the audio stream). + * Includes all realtime input since the last turn, including inactivity (e.g. silence on the + * audio stream). */ TURN_INCLUDES_ALL_INPUT,