Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/main/java/com/google/genai/LiveConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,11 @@ ObjectNode liveClientSetupToMldev(JsonNode fromObject, ObjectNode parentObject)
Common.getValueByPath(fromObject, new String[] {"proactivity"}));
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}))) {
throw new IllegalArgumentException(
"explicitVadSignal parameter is not supported in Gemini API.");
}

return toObject;
}

Expand Down Expand Up @@ -814,6 +819,13 @@ ObjectNode liveClientSetupToVertex(JsonNode fromObject, ObjectNode parentObject)
Common.getValueByPath(fromObject, new String[] {"proactivity"}));
}

if (Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"explicitVadSignal"},
Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}));
}

return toObject;
}

Expand Down Expand Up @@ -961,6 +973,11 @@ ObjectNode liveConnectConfigToMldev(JsonNode fromObject, ObjectNode parentObject
Common.getValueByPath(fromObject, new String[] {"proactivity"}));
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}))) {
throw new IllegalArgumentException(
"explicitVadSignal parameter is not supported in Gemini API.");
}

return toObject;
}

Expand Down Expand Up @@ -1105,6 +1122,13 @@ ObjectNode liveConnectConfigToVertex(JsonNode fromObject, ObjectNode parentObjec
Common.getValueByPath(fromObject, new String[] {"proactivity"}));
}

if (Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}) != null) {
Common.setValueByPath(
parentObject,
new String[] {"setup", "explicitVadSignal"},
Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}));
}

return toObject;
}

Expand Down Expand Up @@ -1337,6 +1361,13 @@ ObjectNode liveServerMessageFromVertex(JsonNode fromObject, ObjectNode parentObj
Common.getValueByPath(fromObject, new String[] {"sessionResumptionUpdate"}));
}

if (Common.getValueByPath(fromObject, new String[] {"voiceActivityDetectionSignal"}) != null) {
Common.setValueByPath(
toObject,
new String[] {"voiceActivityDetectionSignal"},
Common.getValueByPath(fromObject, new String[] {"voiceActivityDetectionSignal"}));
}

return toObject;
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/google/genai/TokensConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,11 @@ ObjectNode liveConnectConfigToMldev(JsonNode fromObject, ObjectNode parentObject
Common.getValueByPath(fromObject, new String[] {"proactivity"}));
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"explicitVadSignal"}))) {
throw new IllegalArgumentException(
"explicitVadSignal parameter is not supported in Gemini API.");
}

return toObject;
}

Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/google/genai/types/LiveClientSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ public abstract class LiveClientSetup extends JsonSerializable {
@JsonProperty("proactivity")
public abstract Optional<ProactivityConfig> proactivity();

/**
* Configures the explicit VAD signal. If enabled, the client will send vad_signal to indicate the
* start and end of speech. This allows the server to process the audio more efficiently.
*/
@JsonProperty("explicitVadSignal")
public abstract Optional<Boolean> explicitVadSignal();

/** Instantiates a builder for LiveClientSetup. */
@ExcludeFromGeneratedCoverageReport
public static Builder builder() {
Expand Down Expand Up @@ -432,6 +439,26 @@ public Builder clearProactivity() {
return proactivity(Optional.empty());
}

/**
* Setter for explicitVadSignal.
*
* <p>explicitVadSignal: Configures the explicit VAD signal. If enabled, the client will send
* vad_signal to indicate the start and end of speech. This allows the server to process the
* audio more efficiently.
*/
@JsonProperty("explicitVadSignal")
public abstract Builder explicitVadSignal(boolean explicitVadSignal);

@ExcludeFromGeneratedCoverageReport
abstract Builder explicitVadSignal(Optional<Boolean> explicitVadSignal);

/** Clears the value of explicitVadSignal field. */
@ExcludeFromGeneratedCoverageReport
@CanIgnoreReturnValue
public Builder clearExplicitVadSignal() {
return explicitVadSignal(Optional.empty());
}

public abstract LiveClientSetup build();
}

Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/google/genai/types/LiveConnectConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ public abstract class LiveConnectConfig extends JsonSerializable {
@JsonProperty("proactivity")
public abstract Optional<ProactivityConfig> proactivity();

/**
* Configures the explicit VAD signal. If enabled, the client will send vad_signal to indicate the
* start and end of speech. This allows the server to process the audio more efficiently.
*/
@JsonProperty("explicitVadSignal")
public abstract Optional<Boolean> explicitVadSignal();

/** Instantiates a builder for LiveConnectConfig. */
@ExcludeFromGeneratedCoverageReport
public static Builder builder() {
Expand Down Expand Up @@ -762,6 +769,26 @@ public Builder clearProactivity() {
return proactivity(Optional.empty());
}

/**
* Setter for explicitVadSignal.
*
* <p>explicitVadSignal: Configures the explicit VAD signal. If enabled, the client will send
* vad_signal to indicate the start and end of speech. This allows the server to process the
* audio more efficiently.
*/
@JsonProperty("explicitVadSignal")
public abstract Builder explicitVadSignal(boolean explicitVadSignal);

@ExcludeFromGeneratedCoverageReport
abstract Builder explicitVadSignal(Optional<Boolean> explicitVadSignal);

/** Clears the value of explicitVadSignal field. */
@ExcludeFromGeneratedCoverageReport
@CanIgnoreReturnValue
public Builder clearExplicitVadSignal() {
return explicitVadSignal(Optional.empty());
}

public abstract LiveConnectConfig build();
}

Expand Down
35 changes: 35 additions & 0 deletions src/main/java/com/google/genai/types/LiveServerMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public abstract class LiveServerMessage extends JsonSerializable {
@JsonProperty("sessionResumptionUpdate")
public abstract Optional<LiveServerSessionResumptionUpdate> sessionResumptionUpdate();

/** Voice activity detection signal. */
@JsonProperty("voiceActivityDetectionSignal")
public abstract Optional<VoiceActivityDetectionSignal> voiceActivityDetectionSignal();

/** Instantiates a builder for LiveServerMessage. */
@ExcludeFromGeneratedCoverageReport
public static Builder builder() {
Expand Down Expand Up @@ -290,6 +294,37 @@ public Builder clearSessionResumptionUpdate() {
return sessionResumptionUpdate(Optional.empty());
}

/**
* Setter for voiceActivityDetectionSignal.
*
* <p>voiceActivityDetectionSignal: Voice activity detection signal.
*/
@JsonProperty("voiceActivityDetectionSignal")
public abstract Builder voiceActivityDetectionSignal(
VoiceActivityDetectionSignal voiceActivityDetectionSignal);

/**
* Setter for voiceActivityDetectionSignal builder.
*
* <p>voiceActivityDetectionSignal: Voice activity detection signal.
*/
@CanIgnoreReturnValue
public Builder voiceActivityDetectionSignal(
VoiceActivityDetectionSignal.Builder voiceActivityDetectionSignalBuilder) {
return voiceActivityDetectionSignal(voiceActivityDetectionSignalBuilder.build());
}

@ExcludeFromGeneratedCoverageReport
abstract Builder voiceActivityDetectionSignal(
Optional<VoiceActivityDetectionSignal> voiceActivityDetectionSignal);

/** Clears the value of voiceActivityDetectionSignal field. */
@ExcludeFromGeneratedCoverageReport
@CanIgnoreReturnValue
public Builder clearVoiceActivityDetectionSignal() {
return voiceActivityDetectionSignal(Optional.empty());
}

public abstract LiveServerMessage build();
}

Expand Down
111 changes: 111 additions & 0 deletions src/main/java/com/google/genai/types/VadSignalType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* 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 com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.base.Ascii;
import java.util.Objects;

/** The type of the VAD signal. */
public class VadSignalType {

/** Enum representing the known values for VadSignalType. */
public enum Known {
/** The default is VAD_SIGNAL_TYPE_UNSPECIFIED. */
VAD_SIGNAL_TYPE_UNSPECIFIED,

/** Start of sentence signal. */
VAD_SIGNAL_TYPE_SOS,

/** End of sentence signal. */
VAD_SIGNAL_TYPE_EOS
}

private Known vadSignalTypeEnum;
private final String value;

@JsonCreator
public VadSignalType(String value) {
this.value = value;
for (Known vadSignalTypeEnum : Known.values()) {
if (Ascii.equalsIgnoreCase(vadSignalTypeEnum.toString(), value)) {
this.vadSignalTypeEnum = vadSignalTypeEnum;
break;
}
}
if (this.vadSignalTypeEnum == null) {
this.vadSignalTypeEnum = Known.VAD_SIGNAL_TYPE_UNSPECIFIED;
}
}

public VadSignalType(Known knownValue) {
this.vadSignalTypeEnum = knownValue;
this.value = knownValue.toString();
}

@ExcludeFromGeneratedCoverageReport
@Override
@JsonValue
public String toString() {
return this.value;
}

@ExcludeFromGeneratedCoverageReport
@SuppressWarnings("PatternMatchingInstanceof")
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null) {
return false;
}

if (!(o instanceof VadSignalType)) {
return false;
}

VadSignalType other = (VadSignalType) o;

if (this.vadSignalTypeEnum != Known.VAD_SIGNAL_TYPE_UNSPECIFIED
&& other.vadSignalTypeEnum != Known.VAD_SIGNAL_TYPE_UNSPECIFIED) {
return this.vadSignalTypeEnum == other.vadSignalTypeEnum;
} else if (this.vadSignalTypeEnum == Known.VAD_SIGNAL_TYPE_UNSPECIFIED
&& other.vadSignalTypeEnum == Known.VAD_SIGNAL_TYPE_UNSPECIFIED) {
return this.value.equals(other.value);
}
return false;
}

@ExcludeFromGeneratedCoverageReport
@Override
public int hashCode() {
if (this.vadSignalTypeEnum != Known.VAD_SIGNAL_TYPE_UNSPECIFIED) {
return this.vadSignalTypeEnum.hashCode();
} else {
return Objects.hashCode(this.value);
}
}

@ExcludeFromGeneratedCoverageReport
public Known knownEnum() {
return this.vadSignalTypeEnum;
}
}
Loading
Loading