Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/main/java/com/google/genai/AsyncModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ public CompletableFuture<DeleteModelResponse> delete(String model, DeleteModelCo
* Asynchronously counts tokens given a GenAI model and a list of content.
*
* @param model the name of the GenAI model to use.
* @param contents a {@link List<com.google.genai.types.Content>} to send to count tokens for.
* @param contents a {@link List&lt;com.google.genai.types.Content&gt;} to send to count tokens
* for.
* @param config a {@link com.google.genai.types.CountTokensConfig} instance that specifies the
* optional configurations
* @return a {@link com.google.genai.types.CountTokensResponse} instance that contains tokens
Expand Down Expand Up @@ -493,7 +494,8 @@ public CompletableFuture<CountTokensResponse> countTokens(
* Asynchronously computes tokens given a GenAI model and a list of content.
*
* @param model the name of the GenAI model to use.
* @param contents a {@link List<com.google.genai.types.Content>} to send to compute tokens for.
* @param contents a {@link List&lt;com.google.genai.types.Content&gt;} to send to compute tokens
* for.
* @param config a {@link com.google.genai.types.ComputeTokensConfig} instance that specifies the
* optional configurations
* @return a {@link com.google.genai.types.ComputeTokensResponse} instance that contains tokens
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/google/genai/Batches.java
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,12 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"mcpServers"}));
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) {
throw new IllegalArgumentException(
"exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in"
+ " Gemini Developer API mode.");
}

return toObject;
}

Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/google/genai/Caches.java
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,12 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"mcpServers"}));
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) {
throw new IllegalArgumentException(
"exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in"
+ " Gemini Developer API mode.");
}

return toObject;
}

Expand Down Expand Up @@ -1314,6 +1320,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) {
Common.setValueByPath(toObject, new String[] {"mcpServers"}, result);
}

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

return toObject;
}

Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/google/genai/LiveConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,19 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject
+ " in Gemini Enterprise Agent Platform mode.");
}

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

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"translationConfig"}))) {
throw new IllegalArgumentException(
"translationConfig parameter is only supported in Gemini Developer API mode, not in"
+ " Gemini Enterprise Agent Platform mode.");
}

return toObject;
}

Expand Down Expand Up @@ -2115,6 +2128,12 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) {
Common.getValueByPath(fromObject, new String[] {"mcpServers"}));
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) {
throw new IllegalArgumentException(
"exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in"
+ " Gemini Developer API mode.");
}

return toObject;
}

Expand Down Expand Up @@ -2212,6 +2231,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) {
Common.setValueByPath(toObject, new String[] {"mcpServers"}, result);
}

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

return toObject;
}

Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/google/genai/Models.java
Original file line number Diff line number Diff line change
Expand Up @@ -3547,6 +3547,19 @@ ObjectNode generationConfigToVertex(
+ " in Gemini Enterprise Agent Platform mode.");
}

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

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"translationConfig"}))) {
throw new IllegalArgumentException(
"translationConfig parameter is only supported in Gemini Developer API mode, not in"
+ " Gemini Enterprise Agent Platform mode.");
}

return toObject;
}

Expand Down Expand Up @@ -5126,6 +5139,12 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode ro
Common.getValueByPath(fromObject, new String[] {"mcpServers"}));
}

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) {
throw new IllegalArgumentException(
"exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in"
+ " Gemini Developer API mode.");
}

return toObject;
}

Expand Down Expand Up @@ -5224,6 +5243,13 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode r
Common.setValueByPath(toObject, new String[] {"mcpServers"}, result);
}

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

return toObject;
}

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

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"exaAiSearch"}))) {
throw new IllegalArgumentException(
"exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in"
+ " Gemini Developer API mode.");
}

return toObject;
}
}
20 changes: 20 additions & 0 deletions src/main/java/com/google/genai/Tunings.java
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,13 @@ ObjectNode generationConfigFromVertex(
Common.getValueByPath(fromObject, new String[] {"topP"}));
}

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

return toObject;
}

Expand Down Expand Up @@ -1387,6 +1394,19 @@ ObjectNode generationConfigToVertex(
+ " in Gemini Enterprise Agent Platform mode.");
}

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

if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"translationConfig"}))) {
throw new IllegalArgumentException(
"translationConfig parameter is only supported in Gemini Developer API mode, not in"
+ " Gemini Enterprise Agent Platform mode.");
}

return toObject;
}

Expand Down
147 changes: 147 additions & 0 deletions src/main/java/com/google/genai/types/AspectRatio.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*
* 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 aspect ratio for the image output. */
public class AspectRatio {

/** Enum representing the known values for AspectRatio. */
public enum Known {
/** Default value. This value is unused. */
ASPECT_RATIO_UNSPECIFIED,

/** 1:1 aspect ratio. */
ASPECT_RATIO_ONE_BY_ONE,

/** 2:3 aspect ratio. */
ASPECT_RATIO_TWO_BY_THREE,

/** 3:2 aspect ratio. */
ASPECT_RATIO_THREE_BY_TWO,

/** 3:4 aspect ratio. */
ASPECT_RATIO_THREE_BY_FOUR,

/** 4:3 aspect ratio. */
ASPECT_RATIO_FOUR_BY_THREE,

/** 4:5 aspect ratio. */
ASPECT_RATIO_FOUR_BY_FIVE,

/** 5:4 aspect ratio. */
ASPECT_RATIO_FIVE_BY_FOUR,

/** 9:16 aspect ratio. */
ASPECT_RATIO_NINE_BY_SIXTEEN,

/** 16:9 aspect ratio. */
ASPECT_RATIO_SIXTEEN_BY_NINE,

/** 21:9 aspect ratio. */
ASPECT_RATIO_TWENTY_ONE_BY_NINE,

/** 1:8 aspect ratio. */
ASPECT_RATIO_ONE_BY_EIGHT,

/** 8:1 aspect ratio. */
ASPECT_RATIO_EIGHT_BY_ONE,

/** 1:4 aspect ratio. */
ASPECT_RATIO_ONE_BY_FOUR,

/** 4:1 aspect ratio. */
ASPECT_RATIO_FOUR_BY_ONE
}

private Known aspectRatioEnum;
private final String value;

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

public AspectRatio(Known knownValue) {
this.aspectRatioEnum = 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 AspectRatio)) {
return false;
}

AspectRatio other = (AspectRatio) o;

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

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

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