From bde214f777a2c3b8667fde8afd444d17b7e07e97 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Wed, 30 Jul 2025 10:12:19 -0700 Subject: [PATCH 001/178] chore: Automate closing of stale issues This commit updates the GitHub Actions workflow to automatically manage and close stale issues that are awaiting a user response. The workflow now performs the following actions: - Marks issues with the "status:awaiting user response" label as stale after 7 days of inactivity. - Posts a comment notifying that the issue will be closed if no further activity occurs. - Closes the issue if there is no activity for an additional 2 days. PiperOrigin-RevId: 788946450 --- .github/workflows/stale.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000000..a78b673f193 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,31 @@ +# This workflow warns and then closes issues that have had no activity for a specified amount of time. +name: Mark and close stale issues + +on: + schedule: + # Scheduled to run at 1:30 UTC everyday + - cron: '30 1 * * *' + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-issue-stale: 7 + days-before-issue-close: 2 + stale-issue-label: "status:stale" + close-issue-reason: not_planned + any-of-labels: "status:awaiting user response" + stale-issue-message: > + This issue has been marked as stale because it has been open for 7 days with no activity. It will be closed in 2 days if no further activity occurs. + close-issue-message: > + This issue was closed because it has been inactive for 9 days. + Please post a new issue if you need further assistance. Thanks! + # Label that can be assigned to issues to exclude them from being marked as stale + exempt-issue-labels: 'override-stale' \ No newline at end of file From 2562f09c42ba1cec01932c9056a924f893afd2e7 Mon Sep 17 00:00:00 2001 From: Jaycee Li Date: Wed, 30 Jul 2025 15:07:50 -0700 Subject: [PATCH 002/178] chore: Add test coverage check to unit tests PiperOrigin-RevId: 789060195 --- .github/workflows/unit-tests.yml | 2 +- pom.xml | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 72e3eec72d4..a68a2963436 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -25,4 +25,4 @@ jobs: java-version: ${{matrix.java}} cache: 'maven' - name: Java Unit Tests - run: mvn clean test -Dtest=${{matrix.testgroup}} \ No newline at end of file + run: mvn clean test -Dtest=${{matrix.testgroup}} -Djacoco.skip=true \ No newline at end of file diff --git a/pom.xml b/pom.xml index caea5b8c446..84fac6477cd 100644 --- a/pom.xml +++ b/pom.xml @@ -313,6 +313,7 @@ test report + check @@ -321,6 +322,49 @@ com/google/genai/types/AutoValue_*.class + + + PACKAGE + + com.google.genai + + + + INSTRUCTION + COVEREDRATIO + + 0.70 + + + + + PACKAGE + + com.google.genai.errors + + + + INSTRUCTION + COVEREDRATIO + 0.95 + + + + + PACKAGE + + com.google.genai.types + + + + INSTRUCTION + COVEREDRATIO + + 0.30 + + + + From be3e50e4217780329c0636fd7f8a1b743e7f9597 Mon Sep 17 00:00:00 2001 From: Jaycee Li Date: Thu, 31 Jul 2025 10:29:46 -0700 Subject: [PATCH 003/178] docs: mark Client as thread safe and Chat as not thread safe PiperOrigin-RevId: 789388237 --- src/main/java/com/google/genai/Chat.java | 2 ++ src/main/java/com/google/genai/Client.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/genai/Chat.java b/src/main/java/com/google/genai/Chat.java index 1e8bedf794c..e2e5ae1cf62 100644 --- a/src/main/java/com/google/genai/Chat.java +++ b/src/main/java/com/google/genai/Chat.java @@ -27,6 +27,8 @@ * *

This class provides a way to interact with a generative model in a multi-turn chat session. It * keeps track of the chat history and uses it to provide context for subsequent messages. + * + *

Note: this class is NOT thread-safe. */ public class Chat extends ChatBase { private final ApiClient apiClient; diff --git a/src/main/java/com/google/genai/Client.java b/src/main/java/com/google/genai/Client.java index c033cd01fd5..2efca2a4b91 100644 --- a/src/main/java/com/google/genai/Client.java +++ b/src/main/java/com/google/genai/Client.java @@ -26,7 +26,7 @@ import java.io.IOException; import java.util.Optional; -/** Client class for GenAI. */ +/** Client class for GenAI. This class is thread-safe. */ public final class Client implements AutoCloseable { /** Async class for GenAI. */ From f937dd1752e8a774e06d9afc6953211bd569fc35 Mon Sep 17 00:00:00 2001 From: Wanlin Du Date: Thu, 31 Jul 2025 10:41:17 -0700 Subject: [PATCH 004/178] feat: allow methods in batch to return headers in sdk_http_response by default PiperOrigin-RevId: 789392436 --- src/main/java/com/google/genai/Batches.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/google/genai/Batches.java b/src/main/java/com/google/genai/Batches.java index d0c5aadf02d..a93e4fbd0ef 100644 --- a/src/main/java/com/google/genai/Batches.java +++ b/src/main/java/com/google/genai/Batches.java @@ -2076,6 +2076,7 @@ ObjectNode listBatchJobsResponseFromMldev(JsonNode fromObject, ObjectNode parent @ExcludeFromGeneratedCoverageReport ObjectNode deleteResourceJobFromMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( toObject, @@ -2307,6 +2308,7 @@ ObjectNode listBatchJobsResponseFromVertex(JsonNode fromObject, ObjectNode paren @ExcludeFromGeneratedCoverageReport ObjectNode deleteResourceJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( toObject, From a7dbd4c527456f20aa5d154bde14f74f6e66d174 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Thu, 31 Jul 2025 11:24:49 -0700 Subject: [PATCH 005/178] Copybara import of the project: -- f29e93ee10d03b4e4f75cf3267522d3f24a873db by Michael Vorburger : fix: Remove duplicate JavaTimeModule in JsonSerializable COPYBARA_INTEGRATE_REVIEW=https://github.com/googleapis/java-genai/pull/430 from vorburger:patch-1 f29e93ee10d03b4e4f75cf3267522d3f24a873db PiperOrigin-RevId: 789408532 --- src/main/java/com/google/genai/JsonSerializable.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/google/genai/JsonSerializable.java b/src/main/java/com/google/genai/JsonSerializable.java index 57874b9600e..65b1fafc001 100644 --- a/src/main/java/com/google/genai/JsonSerializable.java +++ b/src/main/java/com/google/genai/JsonSerializable.java @@ -83,7 +83,6 @@ public java.time.Duration deserialize(JsonParser p, DeserializationContext ctxt) static { objectMapper.setSerializationInclusion(JsonInclude.Include.NON_ABSENT); objectMapper.registerModule(new Jdk8Module()); - objectMapper.registerModule(new JavaTimeModule()); // Disable writing dates as timestamps to use ISO-8601 string format for Instant objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -98,7 +97,6 @@ public java.time.Duration deserialize(JsonParser p, DeserializationContext ctxt) // provided by JavaTimeModule. objectMapper.registerModule(new JavaTimeModule()); objectMapper.registerModule(customModule); - } /** Serializes the instance to a Json string. */ From 139a0112097676caf426fc74ce4ef6342d77b3aa Mon Sep 17 00:00:00 2001 From: Johannes Rauber Date: Thu, 31 Jul 2025 14:38:40 -0700 Subject: [PATCH 006/178] Copybara import of the project: -- 10b1050c7cc45601d0762aebdb0a0ccc48f075a0 by jrauber : Add an automatic module name to better support JPMS COPYBARA_INTEGRATE_REVIEW=https://github.com/googleapis/java-genai/pull/399 from jrauber:main 4f175a9d0559ec1e04a7bee16bd37bdb48f58d35 PiperOrigin-RevId: 789476969 --- pom.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 84fac6477cd..aef2e2b8d25 100644 --- a/pom.xml +++ b/pom.xml @@ -213,7 +213,14 @@ maven-jar-plugin - 3.0.2 + 3.3.0 + + + + com.google.genai + + + maven-install-plugin From a2eccafae5c6c9b82341a148b572bf9bc80f241b Mon Sep 17 00:00:00 2001 From: Jaycee Li Date: Thu, 31 Jul 2025 14:41:42 -0700 Subject: [PATCH 007/178] docs: Add latest models features in README PiperOrigin-RevId: 789477988 --- README.md | 227 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 150 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index dbaa7e1a39a..41deec6b25c 100644 --- a/README.md +++ b/README.md @@ -178,11 +178,11 @@ Client client = Client.builder() ``` ### Interact with models -The Gen AI Java SDK allows you to access the service programmatically. +The Google Gen AI Java SDK allows you to access the service programmatically. The following code snippets are some basic usages of model inferencing. #### Generate Content -Use `generateContent` method for the most basic text generation. +Use `generateContent` method for the most basic content generation. ##### with text input @@ -199,10 +199,17 @@ public class GenerateContentWithTextInput { Client client = new Client(); GenerateContentResponse response = - client.models.generateContent("gemini-2.0-flash-001", "What is your name?", null); + client.models.generateContent("gemini-2.5-flash", "What is your name?", null); // Gets the text string from the response by the quick accessor method `text()`. System.out.println("Unary response: " + response.text()); + + // Gets the http headers from the response. + response + .sdkHttpResponse() + .ifPresent( + httpResponse -> + System.out.println("Response headers: " + httpResponse.headers().orElse(null))); } } ``` @@ -232,7 +239,68 @@ public class GenerateContentWithImageInput { Part.fromUri("gs://path/to/image.jpg", "image/jpeg")); GenerateContentResponse response = - client.models.generateContent("gemini-2.0-flash-001", content, null); + client.models.generateContent("gemini-2.5-flash", content, null); + + System.out.println("Response: " + response.text()); + } +} +``` + +##### Generate Content with extra configs +To set configurations like System Instructions and Safety Settings, you can pass +a `GenerateContentConfig` to the `GenerateContent` method. + +```java +package ; + +import com.google.common.collect.ImmutableList; +import com.google.genai.Client; +import com.google.genai.types.Content; +import com.google.genai.types.GenerateContentConfig; +import com.google.genai.types.GenerateContentResponse; +import com.google.genai.types.GoogleSearch; +import com.google.genai.types.HarmBlockThreshold; +import com.google.genai.types.HarmCategory; +import com.google.genai.types.Part; +import com.google.genai.types.SafetySetting; +import com.google.genai.types.ThinkingConfig; +import com.google.genai.types.Tool; + +public class GenerateContentWithConfigs { + public static void main(String[] args) { + Client client = new Client(); + + // Sets the safety settings in the config. + ImmutableList safetySettings = + ImmutableList.of( + SafetySetting.builder() + .category(HarmCategory.Known.HARM_CATEGORY_HATE_SPEECH) + .threshold(HarmBlockThreshold.Known.BLOCK_ONLY_HIGH) + .build(), + SafetySetting.builder() + .category(HarmCategory.Known.HARM_CATEGORY_DANGEROUS_CONTENT) + .threshold(HarmBlockThreshold.Known.BLOCK_LOW_AND_ABOVE) + .build()); + + // Sets the system instruction in the config. + Content systemInstruction = Content.fromParts(Part.fromText("You are a history teacher.")); + + // Sets the Google Search tool in the config. + Tool googleSearchTool = Tool.builder().googleSearch(GoogleSearch.builder()).build(); + + GenerateContentConfig config = + GenerateContentConfig.builder() + // Sets the thinking budget to 0 to disable thinking mode + .thinkingConfig(ThinkingConfig.builder().thinkingBudget(0)) + .candidateCount(1) + .maxOutputTokens(1024) + .safetySettings(safetySettings) + .systemInstruction(systemInstruction) + .tools(googleSearchTool) + .build(); + + GenerateContentResponse response = + client.models.generateContent("gemini-2.5-flash", "Tell me the history of LLM", config); System.out.println("Response: " + response.text()); } @@ -287,14 +355,12 @@ public class GenerateContentWithFunctionCall { GenerateContentConfig config = GenerateContentConfig.builder() - .tools( - ImmutableList.of( - Tool.builder().functions(ImmutableList.of(method)).build())) + .tools(Tool.builder().functions(method)) .build(); GenerateContentResponse response = client.models.generateContent( - "gemini-2.0-flash-001", + "gemini-2.5-flash", "What is the weather in Vancouver?", config); @@ -306,7 +372,7 @@ public class GenerateContentWithFunctionCall { } ``` -#### Stream Generated Content +##### Stream Generated Content To get a streamed response, you can use the `generateContentStream` method: ```java @@ -318,13 +384,11 @@ import com.google.genai.types.GenerateContentResponse; public class StreamGeneration { public static void main(String[] args) { - // Instantiate the client using Vertex API. The client gets the project and location from the - // environment variables `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION`. - Client client = Client.builder().vertexAI(true).build(); + Client client = new Client(); ResponseStream responseStream = client.models.generateContentStream( - "gemini-2.0-flash-001", "Tell me a story in 300 words.", null); + "gemini-2.5-flash", "Tell me a story in 300 words.", null); System.out.println("Streaming response: "); for (GenerateContentResponse res : responseStream) { @@ -338,7 +402,7 @@ public class StreamGeneration { } ``` -#### Async Generate Content +##### Async Generate Content To get a response asynchronously, you can use the `generateContent` method from the `client.async.models` namespace. @@ -351,12 +415,11 @@ import java.util.concurrent.CompletableFuture; public class GenerateContentAsync { public static void main(String[] args) { - // Instantiates the client using Gemini API, and sets the API key in the builder. - Client client = Client.builder().apiKey("your-api-key").build(); + Client client = new Client(); CompletableFuture responseFuture = client.async.models.generateContent( - "gemini-2.0-flash-001", "Introduce Google AI Studio.", null); + "gemini-2.5-flash", "Introduce Google AI Studio.", null); responseFuture .thenAccept( @@ -368,65 +431,7 @@ public class GenerateContentAsync { } ``` -#### Generate Content with extra configs -To set configurations like System Instructions and Safety Settings, you can pass -a `GenerateContentConfig` to the `GenerateContent` method. - -```java -package ; - -import com.google.common.collect.ImmutableList; -import com.google.genai.Client; -import com.google.genai.types.Content; -import com.google.genai.types.GenerateContentConfig; -import com.google.genai.types.GenerateContentResponse; -import com.google.genai.types.GoogleSearch; -import com.google.genai.types.HarmBlockThreshold; -import com.google.genai.types.HarmCategory; -import com.google.genai.types.Part; -import com.google.genai.types.SafetySetting; -import com.google.genai.types.Tool; - -public class GenerateContentWithConfigs { - public static void main(String[] args) { - Client client = new Client(); - - // Sets the safety settings in the config. - ImmutableList safetySettings = - ImmutableList.of( - SafetySetting.builder() - .category(HarmCategory.Known.HARM_CATEGORY_HATE_SPEECH) - .threshold(HarmBlockThreshold.Known.BLOCK_ONLY_HIGH) - .build(), - SafetySetting.builder() - .category(HarmCategory.Known.HARM_CATEGORY_DANGEROUS_CONTENT) - .threshold(HarmBlockThreshold.Known.BLOCK_LOW_AND_ABOVE) - .build()); - - // Sets the system instruction in the config. - Content systemInstruction = Content.fromParts(Part.fromText("You are a history teacher.")); - - // Sets the Google Search tool in the config. - Tool googleSearchTool = Tool.builder().googleSearch(GoogleSearch.builder().build()).build(); - - GenerateContentConfig config = - GenerateContentConfig.builder() - .candidateCount(1) - .maxOutputTokens(1024) - .safetySettings(safetySettings) - .systemInstruction(systemInstruction) - .tools(ImmutableList.of(googleSearchTool)) - .build(); - - GenerateContentResponse response = - client.models.generateContent("gemini-2.0-flash-001", "Tell me the history of LLM", config); - - System.out.println("Response: " + response.text()); - } -} -``` - -#### Generate Content with JSON response schema +##### Generate Content with JSON response schema To get a response in JSON by passing in a response schema to the `GenerateContent` API. @@ -465,13 +470,81 @@ public class GenerateContentWithSchema { .build(); GenerateContentResponse response = - client.models.generateContent("gemini-2.0-flash-001", "Tell me your name", config); + client.models.generateContent("gemini-2.5-flash", "Tell me your name", config); System.out.println("Response: " + response.text()); } } ``` +#### Count Tokens and Compute Tokens + +The `countTokens` method allows you to calculate the number of tokens your +prompt will use before sending it to the model, helping you manage costs and +stay within the context window. + +```java +package ; + +import com.google.genai.Client; +import com.google.genai.types.CountTokensResponse; + +public class CountTokens { + public static void main(String[] args) { + Client client = new Client(); + + CountTokensResponse response = + client.models.countTokens("gemini-2.5-flash", "What is your name?", null); + + System.out.println("Count tokens response: " + response); + } +} +``` + +The `computeTokens` method returns the Tokens Info that contains tokens and +token IDs given your prompt. This method is only supported in Vertex AI. + +```java +package ; + +import com.google.genai.Client; +import com.google.genai.types.ComputeTokensResponse; + +public class ComputeTokens { + public static void main(String[] args) { + Client client = Client.builder().vertexAI(true).build(); + + ComputeTokensResponse response = + client.models.computeTokens("gemini-2.5-flash", "What is your name?", null); + + System.out.println("Compute tokens response: " + response); + } +} +``` + +#### Embed Content + +The `embedContent` method allows you to generate embeddings for words, phrases, +sentences, and code. Note that only text embedding is supported in this method. + +```java +package ; + +import com.google.genai.Client; +import com.google.genai.types.EmbedContentResponse; + +public class EmbedContent { + public static void main(String[] args) { + Client client = new Client(); + + EmbedContentResponse response = + client.models.embedContent("gemini-embedding-001", "why is the sky blue?", null); + + System.out.println("Embedding response: " + response); + } +} +``` + ## Versioning This library follows [Semantic Versioning](http://semver.org/). From e7de8c83bbd2e7e37c2198c3501e2d5bee58c0a2 Mon Sep 17 00:00:00 2001 From: Matthew Tang Date: Thu, 31 Jul 2025 15:20:48 -0700 Subject: [PATCH 008/178] feat: Support image recontext on Vertex PiperOrigin-RevId: 789490902 --- .../genai/examples/RecontextImageAsync.java | 111 ++++++++ .../RecontextImageProductRecontext.java | 103 +++++++ .../examples/RecontextImageVirtualTryOn.java | 104 +++++++ .../java/com/google/genai/AsyncModels.java | 28 ++ src/main/java/com/google/genai/Models.java | 261 ++++++++++++++++++ .../com/google/genai/types/ProductImage.java | 77 ++++++ .../genai/types/RecontextImageConfig.java | 231 ++++++++++++++++ .../genai/types/RecontextImageParameters.java | 116 ++++++++ .../genai/types/RecontextImageResponse.java | 93 +++++++ .../genai/types/RecontextImageSource.java | 130 +++++++++ 10 files changed, 1254 insertions(+) create mode 100644 examples/src/main/java/com/google/genai/examples/RecontextImageAsync.java create mode 100644 examples/src/main/java/com/google/genai/examples/RecontextImageProductRecontext.java create mode 100644 examples/src/main/java/com/google/genai/examples/RecontextImageVirtualTryOn.java create mode 100644 src/main/java/com/google/genai/types/ProductImage.java create mode 100644 src/main/java/com/google/genai/types/RecontextImageConfig.java create mode 100644 src/main/java/com/google/genai/types/RecontextImageParameters.java create mode 100644 src/main/java/com/google/genai/types/RecontextImageResponse.java create mode 100644 src/main/java/com/google/genai/types/RecontextImageSource.java diff --git a/examples/src/main/java/com/google/genai/examples/RecontextImageAsync.java b/examples/src/main/java/com/google/genai/examples/RecontextImageAsync.java new file mode 100644 index 00000000000..092056d5db8 --- /dev/null +++ b/examples/src/main/java/com/google/genai/examples/RecontextImageAsync.java @@ -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. + */ + +/** + * Usage: + * + *

1a. If you are using Vertex AI, setup ADC to get credentials: + * https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp + * + *

Then set Project, Location, and USE_VERTEXAI flag as environment variables: + * + *

export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT + * + *

export GOOGLE_CLOUD_LOCATION=YOUR_LOCATION + * + *

export GOOGLE_GENAI_USE_VERTEXAI=true + * + *

1b. If you are using Gemini Developer API, set an API key environment variable. You can find a + * list of available API keys here: https://aistudio.google.com/app/apikey + * + *

export GOOGLE_API_KEY=YOUR_API_KEY + * + *

2. Compile the java package and run the sample code. + * + *

mvn clean compile + * + *

mvn exec:java -Dexec.mainClass="com.google.genai.examples.RecontextImageAsync" + * -Dexec.args="YOUR_MODEL_ID" + */ +package com.google.genai.examples; + +import com.google.genai.Client; +import com.google.genai.types.Image; +import com.google.genai.types.ProductImage; +import com.google.genai.types.RecontextImageConfig; +import com.google.genai.types.RecontextImageResponse; +import com.google.genai.types.RecontextImageSource; +import java.util.ArrayList; +import java.util.concurrent.CompletableFuture; + +/** + * An example of using the Unified Gen AI Java SDK to recontextualize an image (product recontext) + * asynchronously. + */ +public final class RecontextImageAsync { + public static void main(String[] args) { + String modelId = "imagen-product-recontext-preview-06-30"; + if (args.length != 0) { + modelId = args[0]; + } + + // Instantiate the client. The client by default uses the Gemini Developer API. It gets the API + // key from the environment variable `GOOGLE_API_KEY`. Vertex AI API can be used by setting the + // environment variables `GOOGLE_CLOUD_LOCATION` and `GOOGLE_CLOUD_PROJECT`, as well as setting + // `GOOGLE_GENAI_USE_VERTEXAI` to "true". + // + // Note: Some services are only available in a specific API backend (Gemini or Vertex), you will + // get a `UnsupportedOperationException` if you try to use a service that is not available in + // the backend you are using. + Client client = new Client(); + + if (client.vertexAI()) { + System.out.println("Using Vertex AI"); + } else { + System.out.println("Using Gemini Developer API"); + } + + Image productImageBackpack = + Image.builder().gcsUri("gs://genai-sdk-tests/inputs/images/backpack1.png").build(); + + RecontextImageConfig recontextImageConfig = + RecontextImageConfig.builder().numberOfImages(1).outputMimeType("image/jpeg").build(); + + ArrayList productImages = new ArrayList<>(); + ProductImage productImage = ProductImage.builder().productImage(productImageBackpack).build(); + productImages.add(productImage); + + RecontextImageSource recontextImageSource = + RecontextImageSource.builder() + .prompt("On a school desk.") + .productImages(productImages) + .build(); + + CompletableFuture recontextImageResponseFuture = + client.async.models.recontextImage(modelId, recontextImageSource, recontextImageConfig); + + recontextImageResponseFuture + .thenAccept( + recontextImageResponse -> { + Image generatedImage = + recontextImageResponse.generatedImages().get().get(0).image().get(); + // Do something with generatedImage. + }) + .join(); + } + + private RecontextImageAsync() {} +} diff --git a/examples/src/main/java/com/google/genai/examples/RecontextImageProductRecontext.java b/examples/src/main/java/com/google/genai/examples/RecontextImageProductRecontext.java new file mode 100644 index 00000000000..ede04de06ff --- /dev/null +++ b/examples/src/main/java/com/google/genai/examples/RecontextImageProductRecontext.java @@ -0,0 +1,103 @@ +/* + * 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. + */ + +/** + * Usage: + * + *

1a. If you are using Vertex AI, setup ADC to get credentials: + * https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp + * + *

Then set Project, Location, and USE_VERTEXAI flag as environment variables: + * + *

export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT + * + *

export GOOGLE_CLOUD_LOCATION=YOUR_LOCATION + * + *

export GOOGLE_GENAI_USE_VERTEXAI=true + * + *

1b. If you are using Gemini Developer API, set an API key environment variable. You can find a + * list of available API keys here: https://aistudio.google.com/app/apikey + * + *

export GOOGLE_API_KEY=YOUR_API_KEY + * + *

2. Compile the java package and run the sample code. + * + *

mvn clean compile + * + *

mvn exec:java -Dexec.mainClass="com.google.genai.examples.RecontextImageProductRecontext" + * -Dexec.args="YOUR_MODEL_ID" + */ +package com.google.genai.examples; + +import com.google.genai.Client; +import com.google.genai.types.Image; +import com.google.genai.types.ProductImage; +import com.google.genai.types.RecontextImageConfig; +import com.google.genai.types.RecontextImageResponse; +import com.google.genai.types.RecontextImageSource; +import java.util.ArrayList; + +/** + * An example of using the Unified Gen AI Java SDK to recontextualize an image (product recontext). + */ +public final class RecontextImageProductRecontext { + public static void main(String[] args) { + String modelId = "imagen-product-recontext-preview-06-30"; + if (args.length != 0) { + modelId = args[0]; + } + + // Instantiate the client. The client by default uses the Gemini Developer API. It gets the API + // key from the environment variable `GOOGLE_API_KEY`. Vertex AI API can be used by setting the + // environment variables `GOOGLE_CLOUD_LOCATION` and `GOOGLE_CLOUD_PROJECT`, as well as setting + // `GOOGLE_GENAI_USE_VERTEXAI` to "true". + // + // Note: Some services are only available in a specific API backend (Gemini or Vertex), you will + // get a `UnsupportedOperationException` if you try to use a service that is not available in + // the backend you are using. + Client client = new Client(); + + if (client.vertexAI()) { + System.out.println("Using Vertex AI"); + } else { + System.out.println("Using Gemini Developer API"); + } + + Image productImageBackpack = + Image.builder().gcsUri("gs://genai-sdk-tests/inputs/images/backpack1.png").build(); + + RecontextImageConfig recontextImageConfig = + RecontextImageConfig.builder().numberOfImages(1).outputMimeType("image/jpeg").build(); + + ArrayList productImages = new ArrayList<>(); + ProductImage productImage = ProductImage.builder().productImage(productImageBackpack).build(); + productImages.add(productImage); + + RecontextImageSource recontextImageSource = + RecontextImageSource.builder() + .prompt("On a school desk.") + .productImages(productImages) + .build(); + + RecontextImageResponse recontextImageResponse = + client.models.recontextImage(modelId, recontextImageSource, recontextImageConfig); + + Image generatedImage = recontextImageResponse.generatedImages().get().get(0).image().get(); + // Do something with generatedImage. + } + + private RecontextImageProductRecontext() {} +} diff --git a/examples/src/main/java/com/google/genai/examples/RecontextImageVirtualTryOn.java b/examples/src/main/java/com/google/genai/examples/RecontextImageVirtualTryOn.java new file mode 100644 index 00000000000..c945d41c7ad --- /dev/null +++ b/examples/src/main/java/com/google/genai/examples/RecontextImageVirtualTryOn.java @@ -0,0 +1,104 @@ +/* + * 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. + */ + +/** + * Usage: + * + *

1a. If you are using Vertex AI, setup ADC to get credentials: + * https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp + * + *

Then set Project, Location, and USE_VERTEXAI flag as environment variables: + * + *

export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT + * + *

export GOOGLE_CLOUD_LOCATION=YOUR_LOCATION + * + *

export GOOGLE_GENAI_USE_VERTEXAI=true + * + *

1b. If you are using Gemini Developer API, set an API key environment variable. You can find a + * list of available API keys here: https://aistudio.google.com/app/apikey + * + *

export GOOGLE_API_KEY=YOUR_API_KEY + * + *

2. Compile the java package and run the sample code. + * + *

mvn clean compile + * + *

mvn exec:java -Dexec.mainClass="com.google.genai.examples.RecontextImageVirtualTryOn" + * -Dexec.args="YOUR_MODEL_ID" + */ +package com.google.genai.examples; + +import com.google.genai.Client; +import com.google.genai.types.Image; +import com.google.genai.types.ProductImage; +import com.google.genai.types.RecontextImageConfig; +import com.google.genai.types.RecontextImageResponse; +import com.google.genai.types.RecontextImageSource; +import java.util.ArrayList; + +/** An example of using the Unified Gen AI Java SDK to recontextualize an image (virtual try-on). */ +public final class RecontextImageVirtualTryOn { + public static void main(String[] args) { + String modelId = "virtual-try-on-exp-05-31"; + if (args.length != 0) { + modelId = args[0]; + } + + // Instantiate the client. The client by default uses the Gemini Developer API. It gets the API + // key from the environment variable `GOOGLE_API_KEY`. Vertex AI API can be used by setting the + // environment variables `GOOGLE_CLOUD_LOCATION` and `GOOGLE_CLOUD_PROJECT`, as well as setting + // `GOOGLE_GENAI_USE_VERTEXAI` to "true". + // + // Note: Some services are only available in a specific API backend (Gemini or Vertex), you will + // get a `UnsupportedOperationException` if you try to use a service that is not available in + // the backend you are using. + Client client = new Client(); + + if (client.vertexAI()) { + System.out.println("Using Vertex AI"); + } else { + System.out.println("Using Gemini Developer API"); + } + + Image productImagePants = + Image.builder().gcsUri("gs://genai-sdk-tests/inputs/images/pants.jpg").build(); + + Image personImage = + Image.builder().gcsUri("gs://genai-sdk-tests/inputs/images/man.jpg").build(); + + RecontextImageConfig recontextImageConfig = + RecontextImageConfig.builder().numberOfImages(1).outputMimeType("image/jpeg").build(); + + ArrayList productImages = new ArrayList<>(); + ProductImage productImage = ProductImage.builder().productImage(productImagePants).build(); + productImages.add(productImage); + + RecontextImageSource recontextImageSource = + RecontextImageSource.builder() + .personImage(personImage) + .productImages(productImages) + .build(); + + RecontextImageResponse recontextImageResponse = + client.models.recontextImage(modelId, recontextImageSource, recontextImageConfig); + + Image generatedImage = recontextImageResponse.generatedImages().get().get(0).image().get(); + // Do something with generatedImage. + } + + private RecontextImageVirtualTryOn() {} +} diff --git a/src/main/java/com/google/genai/AsyncModels.java b/src/main/java/com/google/genai/AsyncModels.java index 8502b25b5d3..e405c5f176c 100644 --- a/src/main/java/com/google/genai/AsyncModels.java +++ b/src/main/java/com/google/genai/AsyncModels.java @@ -42,6 +42,9 @@ import com.google.genai.types.Image; import com.google.genai.types.ListModelsConfig; import com.google.genai.types.Model; +import com.google.genai.types.RecontextImageConfig; +import com.google.genai.types.RecontextImageResponse; +import com.google.genai.types.RecontextImageSource; import com.google.genai.types.ReferenceImage; import com.google.genai.types.UpdateModelConfig; import com.google.genai.types.UpscaleImageConfig; @@ -59,6 +62,31 @@ public AsyncModels(ApiClient apiClient) { this.models = new Models(apiClient); } + /** + * Asynchronously recontextualizes an image. + * + *

There are two types of recontextualization currently supported: 1) Imagen Product Recontext + * - Generate images of products in new scenes and contexts. 2) Virtual Try-On: Generate images of + * persons modeling fashion products. + * + * @param model the name of the GenAI model to use for image recontext + * @param source a {@link com.google.genai.types.RecontextImageSource} An object containing the + * source inputs (prompt, personImage, productImages) for image recontext. prompt is optional + * for product recontext and disallowed for virtual try-on. personImage is required for + * virtual try-on, disallowed for product recontext. productImages is required for both + * product recontext and virtual try-on. Only one product image is supported for virtual + * try-on, and up to 3 product images (different angles of the same product) are supported for + * product recontext. + * @param config a {@link com.google.genai.types.RecontextImageConfig} instance that specifies the + * optional configurations + * @return a {@link com.google.genai.types.RecontextImageResponse} instance that contains the + * generated images. + */ + public CompletableFuture recontextImage( + String model, RecontextImageSource source, RecontextImageConfig config) { + return CompletableFuture.supplyAsync(() -> models.recontextImage(model, source, config)); + } + /** * Asynchronously fetches information about a model by name. * diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index f12a7a9046d..2081aea0298 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -62,6 +62,10 @@ import com.google.genai.types.ListModelsResponse; import com.google.genai.types.Model; import com.google.genai.types.Part; +import com.google.genai.types.RecontextImageConfig; +import com.google.genai.types.RecontextImageParameters; +import com.google.genai.types.RecontextImageResponse; +import com.google.genai.types.RecontextImageSource; import com.google.genai.types.ReferenceImage; import com.google.genai.types.ReferenceImageAPI; import com.google.genai.types.SafetyAttributes; @@ -3518,6 +3522,162 @@ ObjectNode upscaleImageAPIParametersToVertex( return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode productImageToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"productImage"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"image"}, + imageToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"productImage"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode recontextImageSourceToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"prompt"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"instances[0]", "prompt"}, + Common.getValueByPath(fromObject, new String[] {"prompt"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"personImage"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"instances[0]", "personImage", "image"}, + imageToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"personImage"})), + toObject)); + } + + if (Common.getValueByPath(fromObject, new String[] {"productImages"}) != null) { + ArrayNode keyArray = + (ArrayNode) Common.getValueByPath(fromObject, new String[] {"productImages"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(productImageToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(parentObject, new String[] {"instances[0]", "productImages"}, result); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode recontextImageConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"numberOfImages"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "sampleCount"}, + Common.getValueByPath(fromObject, new String[] {"numberOfImages"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"baseSteps"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "editConfig", "baseSteps"}, + Common.getValueByPath(fromObject, new String[] {"baseSteps"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"outputGcsUri"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "storageUri"}, + Common.getValueByPath(fromObject, new String[] {"outputGcsUri"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"seed"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "seed"}, + Common.getValueByPath(fromObject, new String[] {"seed"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"safetyFilterLevel"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "safetySetting"}, + Common.getValueByPath(fromObject, new String[] {"safetyFilterLevel"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"personGeneration"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "personGeneration"}, + Common.getValueByPath(fromObject, new String[] {"personGeneration"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"outputMimeType"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "outputOptions", "mimeType"}, + Common.getValueByPath(fromObject, new String[] {"outputMimeType"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"outputCompressionQuality"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "outputOptions", "compressionQuality"}, + Common.getValueByPath(fromObject, new String[] {"outputCompressionQuality"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"enhancePrompt"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "enhancePrompt"}, + Common.getValueByPath(fromObject, new String[] {"enhancePrompt"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode recontextImageParametersToVertex( + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "model"}, + Transformers.tModel( + this.apiClient, Common.getValueByPath(fromObject, new String[] {"model"}))); + } + + if (Common.getValueByPath(fromObject, new String[] {"source"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + recontextImageSourceToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"source"})), + toObject)); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + recontextImageConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode getModelParametersToVertex( ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { @@ -5427,6 +5587,24 @@ ObjectNode upscaleImageResponseFromVertex(JsonNode fromObject, ObjectNode parent return toObject; } + @ExcludeFromGeneratedCoverageReport + ObjectNode recontextImageResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"predictions"}) != null) { + ArrayNode keyArray = + (ArrayNode) Common.getValueByPath(fromObject, new String[] {"predictions"}); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"generatedImages"}, result); + } + + return toObject; + } + @ExcludeFromGeneratedCoverageReport ObjectNode endpointFromVertex(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); @@ -6173,6 +6351,89 @@ UpscaleImageResponse privateUpscaleImage( } } + /** + * Recontextualizes an image. + * + *

There are two types of recontextualization currently supported: 1) Imagen Product Recontext + * - Generate images of products in new scenes and contexts. 2) Virtual Try-On: Generate images of + * persons modeling fashion products. + * + * @param model the name of the GenAI model to use for image recontext + * @param source a {@link com.google.genai.types.RecontextImageSource} An object containing the + * source inputs (prompt, personImage, productImages) for image recontext. prompt is optional + * for product recontext and disallowed for virtual try-on. personImage is required for + * virtual try-on, disallowed for product recontext. productImages is required for both + * product recontext and virtual try-on. Only one product image is supported for virtual + * try-on, and up to 3 product images (different angles of the same product) are supported for + * product recontext. + * @param config a {@link com.google.genai.types.RecontextImageConfig} instance that specifies the + * optional configurations + * @return a {@link com.google.genai.types.RecontextImageResponse} instance that contains the + * generated images. + */ + public RecontextImageResponse recontextImage( + String model, RecontextImageSource source, RecontextImageConfig config) { + + RecontextImageParameters.Builder parameterBuilder = RecontextImageParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(source)) { + parameterBuilder.source(source); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = recontextImageParametersToVertex(this.apiClient, parameterNode, null); + path = Common.formatMap("{model}:predict", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + body.remove("config"); + + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + try (ApiResponse response = + this.apiClient.request( + "post", path, JsonSerializable.toJsonString(body), requestHttpOptions)) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + if (this.apiClient.vertexAI()) { + responseNode = recontextImageResponseFromVertex(responseNode, null); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + return JsonSerializable.fromJsonNode(responseNode, RecontextImageResponse.class); + } + } + /** * Fetches information about a model by name. * diff --git a/src/main/java/com/google/genai/types/ProductImage.java b/src/main/java/com/google/genai/types/ProductImage.java new file mode 100644 index 00000000000..de08c89857e --- /dev/null +++ b/src/main/java/com/google/genai/types/ProductImage.java @@ -0,0 +1,77 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** An image of the product. */ +@AutoValue +@JsonDeserialize(builder = ProductImage.Builder.class) +public abstract class ProductImage extends JsonSerializable { + /** An image of the product to be recontextualized. */ + @JsonProperty("productImage") + public abstract Optional productImage(); + + /** Instantiates a builder for ProductImage. */ + public static Builder builder() { + return new AutoValue_ProductImage.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ProductImage. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ProductImage.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ProductImage.Builder(); + } + + /** + * Setter for productImage. + * + *

productImage: An image of the product to be recontextualized. + */ + @JsonProperty("productImage") + public abstract Builder productImage(Image productImage); + + /** + * Setter for productImage builder. + * + *

productImage: An image of the product to be recontextualized. + */ + public Builder productImage(Image.Builder productImageBuilder) { + return productImage(productImageBuilder.build()); + } + + public abstract ProductImage build(); + } + + /** Deserializes a JSON string to a ProductImage object. */ + public static ProductImage fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ProductImage.class); + } +} diff --git a/src/main/java/com/google/genai/types/RecontextImageConfig.java b/src/main/java/com/google/genai/types/RecontextImageConfig.java new file mode 100644 index 00000000000..d7bd51e0e67 --- /dev/null +++ b/src/main/java/com/google/genai/types/RecontextImageConfig.java @@ -0,0 +1,231 @@ +/* + * 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.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.Optional; + +/** Configuration for recontextualizing an image. */ +@AutoValue +@JsonDeserialize(builder = RecontextImageConfig.Builder.class) +public abstract class RecontextImageConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Number of images to generate. */ + @JsonProperty("numberOfImages") + public abstract Optional numberOfImages(); + + /** + * The number of sampling steps. A higher value has better image quality, while a lower value has + * better latency. + */ + @JsonProperty("baseSteps") + public abstract Optional baseSteps(); + + /** Cloud Storage URI used to store the generated images. */ + @JsonProperty("outputGcsUri") + public abstract Optional outputGcsUri(); + + /** Random seed for image generation. */ + @JsonProperty("seed") + public abstract Optional seed(); + + /** Filter level for safety filtering. */ + @JsonProperty("safetyFilterLevel") + public abstract Optional safetyFilterLevel(); + + /** Whether allow to generate person images, and restrict to specific ages. */ + @JsonProperty("personGeneration") + public abstract Optional personGeneration(); + + /** MIME type of the generated image. */ + @JsonProperty("outputMimeType") + public abstract Optional outputMimeType(); + + /** Compression quality of the generated image (for ``image/jpeg`` only). */ + @JsonProperty("outputCompressionQuality") + public abstract Optional outputCompressionQuality(); + + /** Whether to use the prompt rewriting logic. */ + @JsonProperty("enhancePrompt") + public abstract Optional enhancePrompt(); + + /** Instantiates a builder for RecontextImageConfig. */ + public static Builder builder() { + return new AutoValue_RecontextImageConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RecontextImageConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RecontextImageConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RecontextImageConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + /** + * Setter for httpOptions builder. + * + *

httpOptions: Used to override HTTP request options. + */ + public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { + return httpOptions(httpOptionsBuilder.build()); + } + + /** + * Setter for numberOfImages. + * + *

numberOfImages: Number of images to generate. + */ + @JsonProperty("numberOfImages") + public abstract Builder numberOfImages(Integer numberOfImages); + + /** + * Setter for baseSteps. + * + *

baseSteps: The number of sampling steps. A higher value has better image quality, while a + * lower value has better latency. + */ + @JsonProperty("baseSteps") + public abstract Builder baseSteps(Integer baseSteps); + + /** + * Setter for outputGcsUri. + * + *

outputGcsUri: Cloud Storage URI used to store the generated images. + */ + @JsonProperty("outputGcsUri") + public abstract Builder outputGcsUri(String outputGcsUri); + + /** + * Setter for seed. + * + *

seed: Random seed for image generation. + */ + @JsonProperty("seed") + public abstract Builder seed(Integer seed); + + /** + * Setter for safetyFilterLevel. + * + *

safetyFilterLevel: Filter level for safety filtering. + */ + @JsonProperty("safetyFilterLevel") + public abstract Builder safetyFilterLevel(SafetyFilterLevel safetyFilterLevel); + + /** + * Setter for safetyFilterLevel given a known enum. + * + *

safetyFilterLevel: Filter level for safety filtering. + */ + @CanIgnoreReturnValue + public Builder safetyFilterLevel(SafetyFilterLevel.Known knownType) { + return safetyFilterLevel(new SafetyFilterLevel(knownType)); + } + + /** + * Setter for safetyFilterLevel given a string. + * + *

safetyFilterLevel: Filter level for safety filtering. + */ + @CanIgnoreReturnValue + public Builder safetyFilterLevel(String safetyFilterLevel) { + return safetyFilterLevel(new SafetyFilterLevel(safetyFilterLevel)); + } + + /** + * Setter for personGeneration. + * + *

personGeneration: Whether allow to generate person images, and restrict to specific ages. + */ + @JsonProperty("personGeneration") + public abstract Builder personGeneration(PersonGeneration personGeneration); + + /** + * Setter for personGeneration given a known enum. + * + *

personGeneration: Whether allow to generate person images, and restrict to specific ages. + */ + @CanIgnoreReturnValue + public Builder personGeneration(PersonGeneration.Known knownType) { + return personGeneration(new PersonGeneration(knownType)); + } + + /** + * Setter for personGeneration given a string. + * + *

personGeneration: Whether allow to generate person images, and restrict to specific ages. + */ + @CanIgnoreReturnValue + public Builder personGeneration(String personGeneration) { + return personGeneration(new PersonGeneration(personGeneration)); + } + + /** + * Setter for outputMimeType. + * + *

outputMimeType: MIME type of the generated image. + */ + @JsonProperty("outputMimeType") + public abstract Builder outputMimeType(String outputMimeType); + + /** + * Setter for outputCompressionQuality. + * + *

outputCompressionQuality: Compression quality of the generated image (for ``image/jpeg`` + * only). + */ + @JsonProperty("outputCompressionQuality") + public abstract Builder outputCompressionQuality(Integer outputCompressionQuality); + + /** + * Setter for enhancePrompt. + * + *

enhancePrompt: Whether to use the prompt rewriting logic. + */ + @JsonProperty("enhancePrompt") + public abstract Builder enhancePrompt(boolean enhancePrompt); + + public abstract RecontextImageConfig build(); + } + + /** Deserializes a JSON string to a RecontextImageConfig object. */ + public static RecontextImageConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RecontextImageConfig.class); + } +} diff --git a/src/main/java/com/google/genai/types/RecontextImageParameters.java b/src/main/java/com/google/genai/types/RecontextImageParameters.java new file mode 100644 index 00000000000..03d8c95f904 --- /dev/null +++ b/src/main/java/com/google/genai/types/RecontextImageParameters.java @@ -0,0 +1,116 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The parameters for recontextualizing an image. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = RecontextImageParameters.Builder.class) +public abstract class RecontextImageParameters extends JsonSerializable { + /** + * ID of the model to use. For a list of models, see `Google models + * `_. + */ + @JsonProperty("model") + public abstract Optional model(); + + /** A set of source input(s) for image recontextualization. */ + @JsonProperty("source") + public abstract Optional source(); + + /** Configuration for image recontextualization. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for RecontextImageParameters. */ + public static Builder builder() { + return new AutoValue_RecontextImageParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RecontextImageParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RecontextImageParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RecontextImageParameters.Builder(); + } + + /** + * Setter for model. + * + *

model: ID of the model to use. For a list of models, see `Google models + * `_. + */ + @JsonProperty("model") + public abstract Builder model(String model); + + /** + * Setter for source. + * + *

source: A set of source input(s) for image recontextualization. + */ + @JsonProperty("source") + public abstract Builder source(RecontextImageSource source); + + /** + * Setter for source builder. + * + *

source: A set of source input(s) for image recontextualization. + */ + public Builder source(RecontextImageSource.Builder sourceBuilder) { + return source(sourceBuilder.build()); + } + + /** + * Setter for config. + * + *

config: Configuration for image recontextualization. + */ + @JsonProperty("config") + public abstract Builder config(RecontextImageConfig config); + + /** + * Setter for config builder. + * + *

config: Configuration for image recontextualization. + */ + public Builder config(RecontextImageConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + public abstract RecontextImageParameters build(); + } + + /** Deserializes a JSON string to a RecontextImageParameters object. */ + public static RecontextImageParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RecontextImageParameters.class); + } +} diff --git a/src/main/java/com/google/genai/types/RecontextImageResponse.java b/src/main/java/com/google/genai/types/RecontextImageResponse.java new file mode 100644 index 00000000000..dab46d351e2 --- /dev/null +++ b/src/main/java/com/google/genai/types/RecontextImageResponse.java @@ -0,0 +1,93 @@ +/* + * 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.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The output images response. */ +@AutoValue +@JsonDeserialize(builder = RecontextImageResponse.Builder.class) +public abstract class RecontextImageResponse extends JsonSerializable { + /** List of generated images. */ + @JsonProperty("generatedImages") + public abstract Optional> generatedImages(); + + /** Instantiates a builder for RecontextImageResponse. */ + public static Builder builder() { + return new AutoValue_RecontextImageResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RecontextImageResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RecontextImageResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RecontextImageResponse.Builder(); + } + + /** + * Setter for generatedImages. + * + *

generatedImages: List of generated images. + */ + @JsonProperty("generatedImages") + public abstract Builder generatedImages(List generatedImages); + + /** + * Setter for generatedImages. + * + *

generatedImages: List of generated images. + */ + public Builder generatedImages(GeneratedImage... generatedImages) { + return generatedImages(Arrays.asList(generatedImages)); + } + + /** + * Setter for generatedImages builder. + * + *

generatedImages: List of generated images. + */ + public Builder generatedImages(GeneratedImage.Builder... generatedImagesBuilders) { + return generatedImages( + Arrays.asList(generatedImagesBuilders).stream() + .map(GeneratedImage.Builder::build) + .collect(toImmutableList())); + } + + public abstract RecontextImageResponse build(); + } + + /** Deserializes a JSON string to a RecontextImageResponse object. */ + public static RecontextImageResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RecontextImageResponse.class); + } +} diff --git a/src/main/java/com/google/genai/types/RecontextImageSource.java b/src/main/java/com/google/genai/types/RecontextImageSource.java new file mode 100644 index 00000000000..5e48c4d48b7 --- /dev/null +++ b/src/main/java/com/google/genai/types/RecontextImageSource.java @@ -0,0 +1,130 @@ +/* + * 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.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A set of source input(s) for image recontextualization. */ +@AutoValue +@JsonDeserialize(builder = RecontextImageSource.Builder.class) +public abstract class RecontextImageSource extends JsonSerializable { + /** + * A text prompt for guiding the model during image recontextualization. Not supported for Virtual + * Try-On. + */ + @JsonProperty("prompt") + public abstract Optional prompt(); + + /** Image of the person or subject who will be wearing the product(s). */ + @JsonProperty("personImage") + public abstract Optional personImage(); + + /** A list of product images. */ + @JsonProperty("productImages") + public abstract Optional> productImages(); + + /** Instantiates a builder for RecontextImageSource. */ + public static Builder builder() { + return new AutoValue_RecontextImageSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RecontextImageSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RecontextImageSource.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RecontextImageSource.Builder(); + } + + /** + * Setter for prompt. + * + *

prompt: A text prompt for guiding the model during image recontextualization. Not + * supported for Virtual Try-On. + */ + @JsonProperty("prompt") + public abstract Builder prompt(String prompt); + + /** + * Setter for personImage. + * + *

personImage: Image of the person or subject who will be wearing the product(s). + */ + @JsonProperty("personImage") + public abstract Builder personImage(Image personImage); + + /** + * Setter for personImage builder. + * + *

personImage: Image of the person or subject who will be wearing the product(s). + */ + public Builder personImage(Image.Builder personImageBuilder) { + return personImage(personImageBuilder.build()); + } + + /** + * Setter for productImages. + * + *

productImages: A list of product images. + */ + @JsonProperty("productImages") + public abstract Builder productImages(List productImages); + + /** + * Setter for productImages. + * + *

productImages: A list of product images. + */ + public Builder productImages(ProductImage... productImages) { + return productImages(Arrays.asList(productImages)); + } + + /** + * Setter for productImages builder. + * + *

productImages: A list of product images. + */ + public Builder productImages(ProductImage.Builder... productImagesBuilders) { + return productImages( + Arrays.asList(productImagesBuilders).stream() + .map(ProductImage.Builder::build) + .collect(toImmutableList())); + } + + public abstract RecontextImageSource build(); + } + + /** Deserializes a JSON string to a RecontextImageSource object. */ + public static RecontextImageSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RecontextImageSource.class); + } +} From 4912ff421d6d3bc40edd70a939f71f5f33f58597 Mon Sep 17 00:00:00 2001 From: Kaituo Huang Date: Thu, 31 Jul 2025 16:30:26 -0700 Subject: [PATCH 009/178] feat: enable responseId for Gemini Developer API remove thinking tests in v1alpha, thinking is GA now PiperOrigin-RevId: 789512508 --- src/main/java/com/google/genai/Batches.java | 7 +++++ src/main/java/com/google/genai/Models.java | 21 ++++++++++----- .../genai/types/GenerateContentResponse.java | 27 ++++++++++--------- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/google/genai/Batches.java b/src/main/java/com/google/genai/Batches.java index a93e4fbd0ef..5e0183b6f3e 100644 --- a/src/main/java/com/google/genai/Batches.java +++ b/src/main/java/com/google/genai/Batches.java @@ -1889,6 +1889,13 @@ ObjectNode generateContentResponseFromMldev(JsonNode fromObject, ObjectNode pare Common.getValueByPath(fromObject, new String[] {"promptFeedback"})); } + if (Common.getValueByPath(fromObject, new String[] {"responseId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"responseId"}, + Common.getValueByPath(fromObject, new String[] {"responseId"})); + } + if (Common.getValueByPath(fromObject, new String[] {"usageMetadata"}) != null) { Common.setValueByPath( toObject, diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 2081aea0298..962c133a470 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -4509,6 +4509,13 @@ ObjectNode generateContentResponseFromMldev(JsonNode fromObject, ObjectNode pare Common.getValueByPath(fromObject, new String[] {"promptFeedback"})); } + if (Common.getValueByPath(fromObject, new String[] {"responseId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"responseId"}, + Common.getValueByPath(fromObject, new String[] {"responseId"})); + } + if (Common.getValueByPath(fromObject, new String[] {"usageMetadata"}) != null) { Common.setValueByPath( toObject, @@ -5305,13 +5312,6 @@ ObjectNode generateContentResponseFromVertex(JsonNode fromObject, ObjectNode par Common.getValueByPath(fromObject, new String[] {"createTime"})); } - if (Common.getValueByPath(fromObject, new String[] {"responseId"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"responseId"}, - Common.getValueByPath(fromObject, new String[] {"responseId"})); - } - if (Common.getValueByPath(fromObject, new String[] {"modelVersion"}) != null) { Common.setValueByPath( toObject, @@ -5326,6 +5326,13 @@ ObjectNode generateContentResponseFromVertex(JsonNode fromObject, ObjectNode par Common.getValueByPath(fromObject, new String[] {"promptFeedback"})); } + if (Common.getValueByPath(fromObject, new String[] {"responseId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"responseId"}, + Common.getValueByPath(fromObject, new String[] {"responseId"})); + } + if (Common.getValueByPath(fromObject, new String[] {"usageMetadata"}) != null) { Common.setValueByPath( toObject, diff --git a/src/main/java/com/google/genai/types/GenerateContentResponse.java b/src/main/java/com/google/genai/types/GenerateContentResponse.java index c00a72a4b02..946fda87597 100644 --- a/src/main/java/com/google/genai/types/GenerateContentResponse.java +++ b/src/main/java/com/google/genai/types/GenerateContentResponse.java @@ -53,10 +53,6 @@ public abstract class GenerateContentResponse extends JsonSerializable { @JsonProperty("createTime") public abstract Optional createTime(); - /** Identifier for each response. */ - @JsonProperty("responseId") - public abstract Optional responseId(); - /** The history of automatic function calling. */ @JsonProperty("automaticFunctionCallingHistory") public abstract Optional> automaticFunctionCallingHistory(); @@ -72,6 +68,12 @@ public abstract class GenerateContentResponse extends JsonSerializable { @JsonProperty("promptFeedback") public abstract Optional promptFeedback(); + /** + * Output only. response_id is used to identify each response. It is the encoding of the event_id. + */ + @JsonProperty("responseId") + public abstract Optional responseId(); + /** Usage metadata about the response(s). */ @JsonProperty("usageMetadata") public abstract Optional usageMetadata(); @@ -147,14 +149,6 @@ public Builder candidates(Candidate.Builder... candidatesBuilders) { @JsonProperty("createTime") public abstract Builder createTime(Instant createTime); - /** - * Setter for responseId. - * - *

responseId: Identifier for each response. - */ - @JsonProperty("responseId") - public abstract Builder responseId(String responseId); - /** * Setter for automaticFunctionCallingHistory. * @@ -216,6 +210,15 @@ public Builder promptFeedback( return promptFeedback(promptFeedbackBuilder.build()); } + /** + * Setter for responseId. + * + *

responseId: Output only. response_id is used to identify each response. It is the encoding + * of the event_id. + */ + @JsonProperty("responseId") + public abstract Builder responseId(String responseId); + /** * Setter for usageMetadata. * From cc0a0aa28cae618acf617ab92819df78d80afea5 Mon Sep 17 00:00:00 2001 From: Jaycee Li Date: Fri, 1 Aug 2025 10:17:40 -0700 Subject: [PATCH 010/178] docs: Add Imagen and Veo to README PiperOrigin-RevId: 789807106 --- README.md | 268 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 268 insertions(+) diff --git a/README.md b/README.md index 41deec6b25c..864cb1ded5b 100644 --- a/README.md +++ b/README.md @@ -545,6 +545,274 @@ public class EmbedContent { } ``` +### Imagen + +Imagen is a text-to-image GenAI service. + +#### Generate Images + +The `generateImages` method helps you create high-quality, unique images given a +text prompt. + +```java +package ; + +import com.google.genai.Client; +import com.google.genai.types.GenerateImagesConfig; +import com.google.genai.types.GenerateImagesResponse; +import com.google.genai.types.Image; + +public class GenerateImages { + public static void main(String[] args) { + Client client = new Client(); + + GenerateImagesConfig config = + GenerateImagesConfig.builder() + .numberOfImages(1) + .outputMimeType("image/jpeg") + .includeSafetyAttributes(true) + .build(); + + GenerateImagesResponse response = + client.models.generateImages( + "imagen-3.0-generate-002", "Robot holding a red skateboard", config); + + response.generatedImages().ifPresent( + images -> { + System.out.println("Generated " + images.size() + " images."); + Image image = images.get(0).image().orElse(null); + // Do something with the image. + } + ); + } +} +``` + +#### Upscale Image + +The `upscaleImage` method allows you to upscale an image. This feature is only +supported in Vertex AI. + +```java +package ; + +import com.google.genai.Client; +import com.google.genai.types.Image; +import com.google.genai.types.UpscaleImageConfig; +import com.google.genai.types.UpscaleImageResponse; + +public class UpscaleImage { + public static void main(String[] args) { + Client client = Client.builder().vertexAI(true).build(); + + Image image = Image.fromFile("path/to/your/image"); + + UpscaleImageConfig config = + UpscaleImageConfig.builder() + .outputMimeType("image/jpeg") + .enhanceInputImage(true) + .imagePreservationFactor(0.6f) + .build(); + + UpscaleImageResponse response = + client.models.upscaleImage("imagen-3.0-generate-002", image, "x2", config); + + response.generatedImages().ifPresent( + images -> { + Image upscaledImage = images.get(0).image().orElse(null); + // Do something with the upscaled image. + } + ); + } +} +``` + +#### Edit Image + +The `editImage` method lets you edit an image. You can input reference images +(ex. mask reference for inpainting, or style reference for style transfer) in +addition to a text prompt to guide the editing. + +This feature uses a different model than `generateImages` and `upscaleImage`. It +is only supported in Vertex AI. + +```java +package ; + +import com.google.genai.Client; +import com.google.genai.types.EditImageConfig; +import com.google.genai.types.EditImageResponse; +import com.google.genai.types.EditMode; +import com.google.genai.types.Image; +import com.google.genai.types.MaskReferenceConfig; +import com.google.genai.types.MaskReferenceImage; +import com.google.genai.types.MaskReferenceMode; +import com.google.genai.types.RawReferenceImage; +import com.google.genai.types.ReferenceImage; +import java.util.ArrayList; + +public class EditImage { + public static void main(String[] args) { + Client client = Client.builder().vertexAI(true).build(); + + Image image = Image.fromFile("path/to/your/image"); + + // Edit image with a mask. + EditImageConfig config = + EditImageConfig.builder() + .editMode(EditMode.Known.EDIT_MODE_INPAINT_INSERTION) + .numberOfImages(1) + .outputMimeType("image/jpeg") + .build(); + + ArrayList referenceImages = new ArrayList<>(); + RawReferenceImage rawReferenceImage = + RawReferenceImage.builder().referenceImage(image).referenceId(1).build(); + referenceImages.add(rawReferenceImage); + + MaskReferenceImage maskReferenceImage = + MaskReferenceImage.builder() + .referenceId(2) + .config( + MaskReferenceConfig.builder() + .maskMode(MaskReferenceMode.Known.MASK_MODE_BACKGROUND) + .maskDilation(0.0f)) + .build(); + referenceImages.add(maskReferenceImage); + + EditImageResponse response = + client.models.editImage( + "imagen-3.0-capability-001", "Sunlight and clear sky", referenceImages, config); + + response.generatedImages().ifPresent( + images -> { + Image editedImage = images.get(0).image().orElse(null); + // Do something with the edited image. + } + ); + } +} +``` + +### Veo + +Veo is a video generation GenAI service. + +#### Generate Videos (Text to Video) + +```java +package ; + +import com.google.genai.Client; +import com.google.genai.types.GenerateVideosConfig; +import com.google.genai.types.GenerateVideosOperation; +import com.google.genai.types.Video; + +public class GenerateVideosWithText { + public static void main(String[] args) { + Client client = new Client(); + + GenerateVideosConfig config = + GenerateVideosConfig.builder() + .numberOfVideos(1) + .enhancePrompt(true) + .durationSeconds(5) + .build(); + + // generateVideos returns an operation + GenerateVideosOperation operation = + client.models.generateVideos( + "veo-2.0-generate-001", "A neon hologram of a cat driving at top speed", null, config); + + // When the operation hasn't been finished, operation.done() is empty + while (!operation.done().isPresent()) { + try { + System.out.println("Waiting for operation to complete..."); + Thread.sleep(10000); + // Sleep for 10 seconds and check the operation again + operation = client.operations.getVideosOperation(operation, null); + } catch (InterruptedException e) { + System.out.println("Thread was interrupted while sleeping."); + Thread.currentThread().interrupt(); + } + } + + operation.response().ifPresent( + response -> { + response.generatedVideos().ifPresent( + videos -> { + System.out.println("Generated " + videos.size() + " videos."); + Video video = videos.get(0).video().orElse(null); + // Do something with the generated video + } + ); + } + ); + } +} +``` + +#### Generate Videos (Image to Video) + +```java +package ; + +import com.google.genai.Client; +import com.google.genai.types.GenerateVideosConfig; +import com.google.genai.types.GenerateVideosOperation; +import com.google.genai.types.Image; +import com.google.genai.types.Video; + +public class GenerateVideosWithImage { + public static void main(String[] args) { + Client client = new Client(); + + Image image = Image.fromFile("path/to/your/image"); + + GenerateVideosConfig config = + GenerateVideosConfig.builder() + .numberOfVideos(1) + .enhancePrompt(true) + .durationSeconds(5) + .build(); + + // generateVideos returns an operation + GenerateVideosOperation operation = + client.models.generateVideos( + "veo-2.0-generate-001", + "Night sky", + image, + config); + + // When the operation hasn't been finished, operation.done() is empty + while (!operation.done().isPresent()) { + try { + System.out.println("Waiting for operation to complete..."); + Thread.sleep(10000); + // Sleep for 10 seconds and check the operation again + operation = client.operations.getVideosOperation(operation, null); + } catch (InterruptedException e) { + System.out.println("Thread was interrupted while sleeping."); + Thread.currentThread().interrupt(); + } + } + + operation.response().ifPresent( + response -> { + response.generatedVideos().ifPresent( + videos -> { + System.out.println("Generated " + videos.size() + " videos."); + Video video = videos.get(0).video().orElse(null); + // Do something with the generated video + } + ); + } + ); + } +} +``` + + ## Versioning This library follows [Semantic Versioning](http://semver.org/). From 036bac89fda15022ec4d9c5c73ba81ad0a6cc9be Mon Sep 17 00:00:00 2001 From: Qiao Wang Date: Fri, 1 Aug 2025 11:51:03 -0700 Subject: [PATCH 011/178] feat: support extraBody in HttpOptions class PiperOrigin-RevId: 789841733 --- .../genai/examples/HttpOptionsExtraBody.java | 104 ++++++++ src/main/java/com/google/genai/ApiClient.java | 68 ++++- .../com/google/genai/types/HttpOptions.java | 19 ++ .../com/google/genai/HttpApiClientTest.java | 232 ++++++++++++++++++ 4 files changed, 422 insertions(+), 1 deletion(-) create mode 100644 examples/src/main/java/com/google/genai/examples/HttpOptionsExtraBody.java diff --git a/examples/src/main/java/com/google/genai/examples/HttpOptionsExtraBody.java b/examples/src/main/java/com/google/genai/examples/HttpOptionsExtraBody.java new file mode 100644 index 00000000000..8a531e1b62e --- /dev/null +++ b/examples/src/main/java/com/google/genai/examples/HttpOptionsExtraBody.java @@ -0,0 +1,104 @@ +/* + * 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. + */ + +/** + * Usage: + * + *

1a. If you are using Vertex AI, setup ADC to get credentials: + * https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp + * + *

Then set Project, Location, and USE_VERTEXAI flag as environment variables: + * + *

export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT + * + *

export GOOGLE_CLOUD_LOCATION=YOUR_LOCATION + * + *

export GOOGLE_GENAI_USE_VERTEXAI=true + * + *

1b. If you are using Gemini Developer API, set an API key environment variable. You can find a + * list of available API keys here: https://aistudio.google.com/app/apikey + * + *

export GOOGLE_API_KEY=YOUR_API_KEY + * + *

2. Compile the java package and run the sample code. + * + *

mvn clean compile exec:java -Dexec.mainClass="com.google.genai.examples.HttpOptionsExtraBody" + * -Dexec.args="YOUR_MODEL_ID" + */ +package com.google.genai.examples; + +import com.google.genai.Client; +import com.google.genai.types.HttpOptions; +import com.google.genai.types.GenerateContentConfig; +import com.google.genai.types.GenerateContentResponse; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +/** + * An example of using HttpOption extraBody to inject additional parameters to http request body. + */ +public final class HttpOptionsExtraBody { + public static void main(String[] args) { + String modelId = "gemini-2.0-flash-001"; + if (args.length != 0) { + modelId = args[0]; + } + + // Instantiate the client. The client by default uses the Gemini Developer API. + // It gets the API + // key from the environment variable `GOOGLE_API_KEY`. Vertex AI API can be used + // by setting the + // environment variables `GOOGLE_CLOUD_LOCATION` and `GOOGLE_CLOUD_PROJECT`, as + // well as setting + // `GOOGLE_GENAI_USE_VERTEXAI` to "true". + // + // Note: Some services are only available in a specific API backend (Gemini or + // Vertex), you will + // get a `UnsupportedOperationException` if you try to use a service that is not + // available in + // the backend you are using. + Client client = new Client(); + + if (client.vertexAI()) { + System.out.println("Using Vertex AI"); + } else { + System.out.println("Using Gemini Developer API"); + } + + GenerateContentResponse response = + client.models.generateContent( + modelId, + "What is your name?", + GenerateContentConfig.builder() + .httpOptions( + HttpOptions.builder() + .extraBody( + ImmutableMap.of( + "systemInstruction", + ImmutableMap.of( + "parts", + ImmutableList.of( + ImmutableMap.of("text", "You are a chatbot."))))) + .build()) + .build()); + + System.out.println( + "GenerateContent prompt token count: " + response.usageMetadata().get().promptTokenCount()); + } + + private HttpOptionsExtraBody() {} +} diff --git a/src/main/java/com/google/genai/ApiClient.java b/src/main/java/com/google/genai/ApiClient.java index 48d5f3c7878..eb7049d4b62 100644 --- a/src/main/java/com/google/genai/ApiClient.java +++ b/src/main/java/com/google/genai/ApiClient.java @@ -19,6 +19,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.ImmutableMap.toImmutableMap; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.auth.oauth2.GoogleCredentials; import com.google.common.base.Ascii; import com.google.common.collect.ImmutableMap; @@ -29,6 +31,7 @@ import com.google.genai.types.HttpOptions; import java.io.IOException; import java.time.Duration; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.logging.Logger; @@ -40,7 +43,6 @@ import okhttp3.RequestBody; import org.jspecify.annotations.Nullable; - /** Interface for an API client which issues HTTP requests to the GenAI APIs. */ abstract class ApiClient { @@ -236,6 +238,7 @@ private OkHttpClient createHttpClient( } /** Builds a HTTP request given the http method, path, and request json string. */ + @SuppressWarnings("unchecked") protected Request buildRequest( String httpMethod, String path, @@ -280,12 +283,31 @@ protected Request buildRequest( throw new IllegalArgumentException("Unsupported HTTP method: " + capitalizedHttpMethod); } + ObjectMapper objectMapper = new ObjectMapper(); RequestBody body; if (METHODS_WITH_BODY.contains(capitalizedHttpMethod)) { body = RequestBody.create(requestJson, MediaType.parse("application/json")); } else { body = null; } + + if (mergedHttpOptions.extraBody().isPresent() && body != null) { + try { + Map requestBodyMap = objectMapper.readValue(requestJson, Map.class); + mergeMaps(requestBodyMap, mergedHttpOptions.extraBody().get()); + requestJson = objectMapper.writeValueAsString(requestBodyMap); + body = RequestBody.create(requestJson, MediaType.parse("application/json")); + } catch (JsonProcessingException e) { + logger.warning("Failed to merge extraBody into request body: " + e.getMessage()); + // If merging fails, proceed with the original request body + body = RequestBody.create(requestJson, MediaType.parse("application/json")); + } + } else if (mergedHttpOptions.extraBody().isPresent()) { + logger.warning( + "HttpOptions.extraBody is set, but the HTTP method does not support a request body. " + + "The extraBody will be ignored."); + } + Request.Builder requestBuilder = new Request.Builder().url(requestUrl).method(capitalizedHttpMethod, body); @@ -382,6 +404,47 @@ OkHttpClient httpClient() { return httpClient; } + /** + * Merges two maps recursively. If a key exists in both maps, the value from `source` overwrites + * the value in `target`. If the value is a list, then update the whole list. A warning is logged + * if the types of the values for the same key are different. + * + * @param target The target map to merge into. + * @param source The source map to merge from. + */ + @SuppressWarnings("unchecked") + private void mergeMaps(Map target, Map source) { + for (Map.Entry entry : source.entrySet()) { + String key = entry.getKey(); + Object sourceValue = entry.getValue(); + + if (target.containsKey(key)) { + Object targetValue = target.get(key); + + if (targetValue instanceof Map && sourceValue instanceof Map) { + // Both values are maps, recursively merge them + mergeMaps((Map) targetValue, (Map) sourceValue); + } else if (targetValue instanceof List && sourceValue instanceof List) { + // Both values are lists, replace the target list with the source list + target.put(key, sourceValue); + } else { + // Values are not both maps or both lists, check if they have the same type + if (targetValue.getClass() != sourceValue.getClass()) { + logger.warning( + String.format( + "Type mismatch for key '%s'. Original type: %s, new type: %s. Overwriting" + + " with the new value.", + key, targetValue.getClass().getName(), sourceValue.getClass().getName())); + } + target.put(key, sourceValue); + } + } else { + // Key does not exist in target, add it + target.put(key, sourceValue); + } + } + } + private Optional> getTimeoutHeader(HttpOptions httpOptionsToApply) { if (httpOptionsToApply.timeout().isPresent()) { int timeoutInSeconds = (int) Math.ceil((double) httpOptionsToApply.timeout().get() / 1000.0); @@ -426,6 +489,9 @@ HttpOptions mergeHttpOptions(HttpOptions httpOptionsToApply) { toImmutableMap(Map.Entry::getKey, Map.Entry::getValue, (val1, val2) -> val2)); mergedHttpOptionsBuilder.headers(mergedHeaders); } + if (httpOptionsToApply.extraBody().isPresent()) { + mergedHttpOptionsBuilder.extraBody(httpOptionsToApply.extraBody().get()); + } return mergedHttpOptionsBuilder.build(); } diff --git a/src/main/java/com/google/genai/types/HttpOptions.java b/src/main/java/com/google/genai/types/HttpOptions.java index 46326f2778f..ed51e7d7874 100644 --- a/src/main/java/com/google/genai/types/HttpOptions.java +++ b/src/main/java/com/google/genai/types/HttpOptions.java @@ -46,6 +46,14 @@ public abstract class HttpOptions extends JsonSerializable { @JsonProperty("timeout") public abstract Optional timeout(); + /** + * Extra parameters to add to the request body. The structure must match the backend API's request + * structure. - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest + * - GeminiAPI backend API docs: https://ai.google.dev/api/rest + */ + @JsonProperty("extraBody") + public abstract Optional> extraBody(); + /** Instantiates a builder for HttpOptions. */ public static Builder builder() { return new AutoValue_HttpOptions.Builder(); @@ -95,6 +103,17 @@ private static Builder create() { @JsonProperty("timeout") public abstract Builder timeout(Integer timeout); + /** + * Setter for extraBody. + * + *

extraBody: Extra parameters to add to the request body. The structure must match the + * backend API's request structure. - VertexAI backend API docs: + * https://cloud.google.com/vertex-ai/docs/reference/rest - GeminiAPI backend API docs: + * https://ai.google.dev/api/rest + */ + @JsonProperty("extraBody") + public abstract Builder extraBody(Map extraBody); + public abstract HttpOptions build(); } diff --git a/src/test/java/com/google/genai/HttpApiClientTest.java b/src/test/java/com/google/genai/HttpApiClientTest.java index 9a065cb909a..e6d974be779 100644 --- a/src/test/java/com/google/genai/HttpApiClientTest.java +++ b/src/test/java/com/google/genai/HttpApiClientTest.java @@ -16,6 +16,7 @@ package com.google.genai; +import com.fasterxml.jackson.core.type.TypeReference; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.common.collect.ImmutableMap; @@ -59,6 +62,8 @@ import org.mockito.Mock; import org.mockito.MockedStatic; import org.mockito.Mockito; +import java.io.IOException; +import java.util.Map; @ExtendWith(EnvironmentVariablesMockingExtension.class) public class HttpApiClientTest { @@ -214,6 +219,233 @@ public void testRequestWithHttpOptions() throws Exception { assertEquals("header", capturedRequest.header("test")); } + @Test + public void testRequestWithHttpOptions_extraBody_addNewKey() throws Exception { + // Arrange + HttpApiClient client = + new HttpApiClient(Optional.of(API_KEY), Optional.empty(), Optional.empty()); + setMockClient(client); + HttpOptions httpOptions = + HttpOptions.builder().extraBody(ImmutableMap.of("newKey", "newValue")).build(); + + // Act + client.request("POST", TEST_PATH, TEST_REQUEST_JSON, Optional.of(httpOptions)); + + // Assert + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Request.class); + verify(mockHttpClient).newCall(requestCaptor.capture()); + Request capturedRequest = requestCaptor.getValue(); + + RequestBody body = capturedRequest.body(); + assertNotNull(body); + final Buffer buffer = new Buffer(); + body.writeTo(buffer); + String requestBody = buffer.readUtf8(); + + Map expectedMap = + ImmutableMap.of("test", "request-json", "newKey", "newValue"); + ObjectMapper mapper = new ObjectMapper(); + Map actualMap = mapper.readValue(requestBody, new TypeReference>() {}); + + assertEquals(expectedMap, actualMap); + } + + @Test + public void testRequestWithHttpOptions_extraBody_overwriteKey() throws Exception { + // Arrange + HttpApiClient client = + new HttpApiClient(Optional.of(API_KEY), Optional.empty(), Optional.empty()); + setMockClient(client); + HttpOptions httpOptions = + HttpOptions.builder().extraBody(ImmutableMap.of("test", "overwritten")).build(); + + // Act + client.request("POST", TEST_PATH, TEST_REQUEST_JSON, Optional.of(httpOptions)); + + // Assert + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Request.class); + verify(mockHttpClient).newCall(requestCaptor.capture()); + Request capturedRequest = requestCaptor.getValue(); + + RequestBody body = capturedRequest.body(); + assertNotNull(body); + final Buffer buffer = new Buffer(); + body.writeTo(buffer); + String requestBody = buffer.readUtf8(); + + Map expectedMap = ImmutableMap.of("test", "overwritten"); + ObjectMapper mapper = new ObjectMapper(); + Map actualMap = mapper.readValue(requestBody, new TypeReference>() {}); + + assertEquals(expectedMap, actualMap); + } + + @Test + public void testRequestWithHttpOptions_extraBody_recursiveMerge() throws Exception { + // Arrange + HttpApiClient client = + new HttpApiClient(Optional.of(API_KEY), Optional.empty(), Optional.empty()); + setMockClient(client); + String initialJson = "{\"nested\": {\"key1\": \"value1\"}, \"key_to_keep\": \"v_keep\"}"; + HttpOptions httpOptions = + HttpOptions.builder() + .extraBody(ImmutableMap.of("nested", ImmutableMap.of("key2", "value2"))) + .build(); + + // Act + client.request("POST", TEST_PATH, initialJson, Optional.of(httpOptions)); + + // Assert + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Request.class); + verify(mockHttpClient).newCall(requestCaptor.capture()); + Request capturedRequest = requestCaptor.getValue(); + + RequestBody body = capturedRequest.body(); + assertNotNull(body); + final Buffer buffer = new Buffer(); + body.writeTo(buffer); + String requestBody = buffer.readUtf8(); + + Map expectedMap = + ImmutableMap.of( + "nested", ImmutableMap.of("key1", "value1", "key2", "value2"), + "key_to_keep", + "v_keep"); + ObjectMapper mapper = new ObjectMapper(); + Map actualMap = mapper.readValue(requestBody, new TypeReference>() {}); + assertEquals(expectedMap, actualMap); + } + + @Test + public void testRequestWithHttpOptions_extraBody_overwriteList() throws Exception { + // Arrange + HttpApiClient client = + new HttpApiClient(Optional.of(API_KEY), Optional.empty(), Optional.empty()); + setMockClient(client); + String initialJson = "{\"list\": [1, 2]}"; + HttpOptions httpOptions = + HttpOptions.builder() + .extraBody(ImmutableMap.of("list", com.google.common.collect.ImmutableList.of(3, 4))) + .build(); + + // Act + client.request("POST", TEST_PATH, initialJson, Optional.of(httpOptions)); + + // Assert + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Request.class); + verify(mockHttpClient).newCall(requestCaptor.capture()); + Request capturedRequest = requestCaptor.getValue(); + + RequestBody body = capturedRequest.body(); + assertNotNull(body); + final Buffer buffer = new Buffer(); + body.writeTo(buffer); + String requestBody = buffer.readUtf8(); + + Map expectedMap = + ImmutableMap.of("list", com.google.common.collect.ImmutableList.of(3, 4)); + ObjectMapper mapper = new ObjectMapper(); + Map actualMap = mapper.readValue(requestBody, new TypeReference>() {}); + assertEquals(expectedMap, actualMap); + } + + @Test + public void testRequestWithHttpOptions_extraBody_overwriteWithDifferentType() throws Exception { + // Arrange + HttpApiClient client = + new HttpApiClient(Optional.of(API_KEY), Optional.empty(), Optional.empty()); + setMockClient(client); + String initialJson = "{\"key\": \"string_value\"}"; + HttpOptions httpOptions = HttpOptions.builder().extraBody(ImmutableMap.of("key", 123)).build(); + + // Act + client.request("POST", TEST_PATH, initialJson, Optional.of(httpOptions)); + + // Assert + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Request.class); + verify(mockHttpClient).newCall(requestCaptor.capture()); + Request capturedRequest = requestCaptor.getValue(); + + RequestBody body = capturedRequest.body(); + assertNotNull(body); + final Buffer buffer = new Buffer(); + body.writeTo(buffer); + String requestBody = buffer.readUtf8(); + + Map expectedMap = ImmutableMap.of("key", 123); + ObjectMapper mapper = new ObjectMapper(); + Map actualMap = mapper.readValue(requestBody, new TypeReference>() {}); + + assertEquals(expectedMap, actualMap); + } + + @Test + public void testRequestWithHttpOptions_extraBody_complexMerge() throws Exception { + // Arrange + HttpApiClient client = + new HttpApiClient(Optional.of(API_KEY), Optional.empty(), Optional.empty()); + setMockClient(client); + String initialJson = + "{\"a\": 1, \"b\": {\"c\": 2, \"d\": [\"x\", \"y\"]}, \"e\": \"original\"}"; + HttpOptions httpOptions = + HttpOptions.builder() + .extraBody( + ImmutableMap.of( + "b", + ImmutableMap.of( + "d", com.google.common.collect.ImmutableList.of("z"), "f", "new_f"), + "e", + "overwritten")) + .build(); + + // Act + client.request("POST", TEST_PATH, initialJson, Optional.of(httpOptions)); + + // Assert + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Request.class); + verify(mockHttpClient).newCall(requestCaptor.capture()); + Request capturedRequest = requestCaptor.getValue(); + + RequestBody body = capturedRequest.body(); + assertNotNull(body); + final Buffer buffer = new Buffer(); + body.writeTo(buffer); + String requestBody = buffer.readUtf8(); + + Map expectedMap = + ImmutableMap.of( + "a", + 1, + "b", + ImmutableMap.of( + "c", 2, "d", com.google.common.collect.ImmutableList.of("z"), "f", "new_f"), + "e", + "overwritten"); + ObjectMapper mapper = new ObjectMapper(); + Map actualMap = mapper.readValue(requestBody, new TypeReference>() {}); + assertEquals(expectedMap, actualMap); + } + + @Test + public void testRequestWithHttpOptions_extraBody_getNoBody() throws Exception { + // Arrange + HttpApiClient client = + new HttpApiClient(Optional.of(API_KEY), Optional.empty(), Optional.empty()); + setMockClient(client); + HttpOptions httpOptions = + HttpOptions.builder().extraBody(ImmutableMap.of("newKey", "newValue")).build(); + + // Act + client.request("GET", TEST_PATH, "", Optional.of(httpOptions)); + + // Assert + ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Request.class); + verify(mockHttpClient).newCall(requestCaptor.capture()); + Request capturedRequest = requestCaptor.getValue(); + + assertNull(capturedRequest.body()); + } + @Test public void testRequestWithInvalidHttpMethod() throws Exception { // Arrange From c50c755c08efbed5a62e1006890b1d0bd9956702 Mon Sep 17 00:00:00 2001 From: Matthew Tang Date: Fri, 1 Aug 2025 16:25:52 -0700 Subject: [PATCH 012/178] feat: Add image_size field for Gemini Developer API Imagen 4 generation PiperOrigin-RevId: 789937547 --- src/main/java/com/google/genai/Models.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 962c133a470..2cc5007c2b7 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -1313,8 +1313,11 @@ ObjectNode generateImagesConfigToMldev(JsonNode fromObject, ObjectNode parentObj throw new IllegalArgumentException("addWatermark parameter is not supported in Gemini API."); } - if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"imageSize"}))) { - throw new IllegalArgumentException("imageSize parameter is not supported in Gemini API."); + if (Common.getValueByPath(fromObject, new String[] {"imageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "sampleImageSize"}, + Common.getValueByPath(fromObject, new String[] {"imageSize"})); } if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"enhancePrompt"}))) { From cb27222a7f7cdf442a7d6b61496709f7cf084a91 Mon Sep 17 00:00:00 2001 From: Annie Luc Date: Wed, 6 Aug 2025 12:20:17 -0700 Subject: [PATCH 013/178] feat: Support new enum types for UrlRetrievalStatus PiperOrigin-RevId: 791793857 --- .../java/com/google/genai/types/UrlRetrievalStatus.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/genai/types/UrlRetrievalStatus.java b/src/main/java/com/google/genai/types/UrlRetrievalStatus.java index 4e59731ae48..0b0a831f476 100644 --- a/src/main/java/com/google/genai/types/UrlRetrievalStatus.java +++ b/src/main/java/com/google/genai/types/UrlRetrievalStatus.java @@ -35,7 +35,13 @@ public enum Known { URL_RETRIEVAL_STATUS_SUCCESS, /** Url retrieval is failed due to error. */ - URL_RETRIEVAL_STATUS_ERROR + URL_RETRIEVAL_STATUS_ERROR, + + /** Url retrieval is failed because the content is behind paywall. */ + URL_RETRIEVAL_STATUS_PAYWALL, + + /** Url retrieval is failed because the content is unsafe. */ + URL_RETRIEVAL_STATUS_UNSAFE } private Known urlRetrievalStatusEnum; From 1c7b26aa7a12ba50d60c288ce95818dc50dcdc6d Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 16:41:20 -0700 Subject: [PATCH 014/178] chore(main): release 1.11.0 (#444) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 27 +++++++++++++++++++ README.md | 2 +- examples/pom.xml | 4 +-- pom.xml | 2 +- src/main/java/com/google/genai/ApiClient.java | 2 +- versions.txt | 2 +- 7 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index eb4e0dba726..caf1487126e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.10.0" + ".": "1.11.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a770a7362d1..d5221c95990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## [1.11.0](https://github.com/googleapis/java-genai/compare/v1.10.0...v1.11.0) (2025-08-06) + + +### Features + +* Add image_size field for Gemini Developer API Imagen 4 generation ([c50c755](https://github.com/googleapis/java-genai/commit/c50c755c08efbed5a62e1006890b1d0bd9956702)) +* allow methods in batch to return headers in sdk_http_response by default ([f937dd1](https://github.com/googleapis/java-genai/commit/f937dd1752e8a774e06d9afc6953211bd569fc35)) +* allow methods in models to return headers in sdk_http_response by default. ([7415e88](https://github.com/googleapis/java-genai/commit/7415e88f7520c695afc63f937b8b547c2877f4f6)) +* allow methods in tuning to return headers in sdk_http_response by default ([1b1205b](https://github.com/googleapis/java-genai/commit/1b1205b052a6d1d6782c6cdc190afdb48113ee9c)) +* enable responseId for Gemini Developer API ([4912ff4](https://github.com/googleapis/java-genai/commit/4912ff421d6d3bc40edd70a939f71f5f33f58597)) +* support extraBody in HttpOptions class ([036bac8](https://github.com/googleapis/java-genai/commit/036bac89fda15022ec4d9c5c73ba81ad0a6cc9be)) +* Support image recontext on Vertex ([e7de8c8](https://github.com/googleapis/java-genai/commit/e7de8c83bbd2e7e37c2198c3501e2d5bee58c0a2)) +* Support new enum types for UrlRetrievalStatus ([cb27222](https://github.com/googleapis/java-genai/commit/cb27222a7f7cdf442a7d6b61496709f7cf084a91)) +* support response headers in Go for all methods. ([222b41e](https://github.com/googleapis/java-genai/commit/222b41e196afc13775cc22292a58567d7b4859fa)) + + +### Bug Fixes + +* Remove duplicate JavaTimeModule in JsonSerializable ([a7dbd4c](https://github.com/googleapis/java-genai/commit/a7dbd4c527456f20aa5d154bde14f74f6e66d174)) + + +### Documentation + +* Add Imagen and Veo to README ([cc0a0aa](https://github.com/googleapis/java-genai/commit/cc0a0aa28cae618acf617ab92819df78d80afea5)) +* Add latest models features in README ([a2eccaf](https://github.com/googleapis/java-genai/commit/a2eccafae5c6c9b82341a148b572bf9bc80f241b)) +* mark Client as thread safe and Chat as not thread safe ([be3e50e](https://github.com/googleapis/java-genai/commit/be3e50e4217780329c0636fd7f8a1b743e7f9597)) + ## [1.10.0](https://github.com/googleapis/java-genai/compare/v1.9.0...v1.10.0) (2025-07-23) diff --git a/README.md b/README.md index 864cb1ded5b..a6ecd160f19 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you're using Maven, add the following to your dependencies: com.google.genai google-genai - 1.10.0 + 1.11.0 ``` diff --git a/examples/pom.xml b/examples/pom.xml index aa3685b77c3..371222548cf 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ com.google.genai.examples google-genai-examples - 1.11.0-SNAPSHOT + 1.11.0 google-genai-examples @@ -13,7 +13,7 @@ 1.8 1.8 - 1.11.0-SNAPSHOT + 1.11.0 diff --git a/pom.xml b/pom.xml index aef2e2b8d25..8a9d4d56566 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.google.genai google-genai google-genai - 1.11.0-SNAPSHOT + 1.11.0 jar Java idiomatic SDK for the Gemini Developer APIs and Vertex AI APIs. diff --git a/src/main/java/com/google/genai/ApiClient.java b/src/main/java/com/google/genai/ApiClient.java index eb7049d4b62..b21bbce16d0 100644 --- a/src/main/java/com/google/genai/ApiClient.java +++ b/src/main/java/com/google/genai/ApiClient.java @@ -47,7 +47,7 @@ abstract class ApiClient { // {x-version-update-start:google-genai:released} - private static final String SDK_VERSION = "1.10.0"; + private static final String SDK_VERSION = "1.11.0"; // {x-version-update-end:google-genai:released} private static final Logger logger = Logger.getLogger(ApiClient.class.getName()); diff --git a/versions.txt b/versions.txt index 91058d0cec9..19877f6dca6 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-genai:1.10.0:1.11.0-SNAPSHOT +google-genai:1.11.0:1.11.0 From 1b803175fa00f431bad960d969e5b2e76f0f91f4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 18:05:05 -0700 Subject: [PATCH 015/178] chore(main): release 1.12.0-SNAPSHOT (#470) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- examples/pom.xml | 4 ++-- pom.xml | 2 +- versions.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/pom.xml b/examples/pom.xml index 371222548cf..668efc7f7f1 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ com.google.genai.examples google-genai-examples - 1.11.0 + 1.12.0-SNAPSHOT google-genai-examples @@ -13,7 +13,7 @@ 1.8 1.8 - 1.11.0 + 1.12.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 8a9d4d56566..6aec20651eb 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.google.genai google-genai google-genai - 1.11.0 + 1.12.0-SNAPSHOT jar Java idiomatic SDK for the Gemini Developer APIs and Vertex AI APIs. diff --git a/versions.txt b/versions.txt index 19877f6dca6..57695e74f99 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-genai:1.11.0:1.11.0 +google-genai:1.11.0:1.12.0-SNAPSHOT From 2e180cc829783cca421adf4c8890f10ac3412be9 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:05:59 -0700 Subject: [PATCH 016/178] Copybara import of the project: -- 62786df9b657c538691db3243dcf9f581a9778ad by release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>: chore(main): release 1.11.0 COPYBARA_INTEGRATE_REVIEW=https://github.com/googleapis/java-genai/pull/444 from googleapis:release-please--branches--main 62786df9b657c538691db3243dcf9f581a9778ad PiperOrigin-RevId: 791901761 --- examples/pom.xml | 4 ++-- pom.xml | 2 +- versions.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/pom.xml b/examples/pom.xml index 668efc7f7f1..371222548cf 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ com.google.genai.examples google-genai-examples - 1.12.0-SNAPSHOT + 1.11.0 google-genai-examples @@ -13,7 +13,7 @@ 1.8 1.8 - 1.12.0-SNAPSHOT + 1.11.0 diff --git a/pom.xml b/pom.xml index 6aec20651eb..8a9d4d56566 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.google.genai google-genai google-genai - 1.12.0-SNAPSHOT + 1.11.0 jar Java idiomatic SDK for the Gemini Developer APIs and Vertex AI APIs. diff --git a/versions.txt b/versions.txt index 57695e74f99..19877f6dca6 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-genai:1.11.0:1.12.0-SNAPSHOT +google-genai:1.11.0:1.11.0 From 393045a986db3c77fbf816ee32ed2de2c24e387f Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Thu, 7 Aug 2025 09:45:52 -0700 Subject: [PATCH 017/178] No public description PiperOrigin-RevId: 792198742 --- examples/pom.xml | 4 ++-- pom.xml | 2 +- versions.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/pom.xml b/examples/pom.xml index 371222548cf..668efc7f7f1 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ com.google.genai.examples google-genai-examples - 1.11.0 + 1.12.0-SNAPSHOT google-genai-examples @@ -13,7 +13,7 @@ 1.8 1.8 - 1.11.0 + 1.12.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 8a9d4d56566..6aec20651eb 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.google.genai google-genai google-genai - 1.11.0 + 1.12.0-SNAPSHOT jar Java idiomatic SDK for the Gemini Developer APIs and Vertex AI APIs. diff --git a/versions.txt b/versions.txt index 19877f6dca6..57695e74f99 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-genai:1.11.0:1.11.0 +google-genai:1.11.0:1.12.0-SNAPSHOT From c498c8b0cb84fa6ba39062493c2bd88b2a06a862 Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Thu, 7 Aug 2025 10:31:23 -0700 Subject: [PATCH 018/178] docs: Remove no-op PRs from changelog. PiperOrigin-RevId: 792217789 --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5221c95990..249f16ae153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,6 @@ ### Features * Add image_size field for Gemini Developer API Imagen 4 generation ([c50c755](https://github.com/googleapis/java-genai/commit/c50c755c08efbed5a62e1006890b1d0bd9956702)) -* allow methods in batch to return headers in sdk_http_response by default ([f937dd1](https://github.com/googleapis/java-genai/commit/f937dd1752e8a774e06d9afc6953211bd569fc35)) -* allow methods in models to return headers in sdk_http_response by default. ([7415e88](https://github.com/googleapis/java-genai/commit/7415e88f7520c695afc63f937b8b547c2877f4f6)) -* allow methods in tuning to return headers in sdk_http_response by default ([1b1205b](https://github.com/googleapis/java-genai/commit/1b1205b052a6d1d6782c6cdc190afdb48113ee9c)) * enable responseId for Gemini Developer API ([4912ff4](https://github.com/googleapis/java-genai/commit/4912ff421d6d3bc40edd70a939f71f5f33f58597)) * support extraBody in HttpOptions class ([036bac8](https://github.com/googleapis/java-genai/commit/036bac89fda15022ec4d9c5c73ba81ad0a6cc9be)) * Support image recontext on Vertex ([e7de8c8](https://github.com/googleapis/java-genai/commit/e7de8c83bbd2e7e37c2198c3501e2d5bee58c0a2)) From b2472b3467a171743422072827bf92780b127d42 Mon Sep 17 00:00:00 2001 From: Sara Robinson Date: Thu, 7 Aug 2025 12:57:52 -0700 Subject: [PATCH 019/178] chore: Add new types from discovery doc PiperOrigin-RevId: 792274865 --- src/main/java/com/google/genai/Batches.java | 7 - src/main/java/com/google/genai/Caches.java | 14 -- .../java/com/google/genai/LiveConverters.java | 14 -- src/main/java/com/google/genai/Models.java | 14 -- .../com/google/genai/TokensConverters.java | 7 - src/main/java/com/google/genai/Tunings.java | 70 ++++++ .../genai/types/GeminiPreferenceExample.java | 126 ++++++++++ .../GeminiPreferenceExampleCompletion.java | 92 +++++++ .../types/GenerationConfigThinkingConfig.java | 8 +- .../google/genai/types/GroundingChunk.java | 21 ++ .../genai/types/GroundingChunkMaps.java | 135 +++++++++++ .../GroundingChunkMapsPlaceAnswerSources.java | 112 +++++++++ ...psPlaceAnswerSourcesAuthorAttribution.java | 99 ++++++++ ...nkMapsPlaceAnswerSourcesReviewSnippet.java | 140 +++++++++++ .../google/genai/types/GroundingMetadata.java | 18 ++ .../com/google/genai/types/PreTunedModel.java | 102 ++++++++ .../PreferenceOptimizationDataStats.java | 227 ++++++++++++++++++ ...PreferenceOptimizationHyperParameters.java | 134 +++++++++++ .../types/PreferenceOptimizationSpec.java | 110 +++++++++ .../types/SupervisedHyperParameters.java | 33 ++- .../genai/types/SupervisedTuningSpec.java | 33 +++ .../java/com/google/genai/types/Tool.java | 26 -- .../com/google/genai/types/TunedModel.java | 10 +- .../google/genai/types/TuningDataStats.java | 23 ++ .../com/google/genai/types/TuningJob.java | 103 ++++++++ .../com/google/genai/types/TuningMode.java | 107 +++++++++ .../com/google/genai/types/TuningTask.java | 107 +++++++++ .../genai/types/VeoHyperParameters.java | 119 +++++++++ .../com/google/genai/types/VeoTuningSpec.java | 111 +++++++++ 29 files changed, 2030 insertions(+), 92 deletions(-) create mode 100644 src/main/java/com/google/genai/types/GeminiPreferenceExample.java create mode 100644 src/main/java/com/google/genai/types/GeminiPreferenceExampleCompletion.java create mode 100644 src/main/java/com/google/genai/types/GroundingChunkMaps.java create mode 100644 src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSources.java create mode 100644 src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.java create mode 100644 src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java create mode 100644 src/main/java/com/google/genai/types/PreTunedModel.java create mode 100644 src/main/java/com/google/genai/types/PreferenceOptimizationDataStats.java create mode 100644 src/main/java/com/google/genai/types/PreferenceOptimizationHyperParameters.java create mode 100644 src/main/java/com/google/genai/types/PreferenceOptimizationSpec.java create mode 100644 src/main/java/com/google/genai/types/TuningMode.java create mode 100644 src/main/java/com/google/genai/types/TuningTask.java create mode 100644 src/main/java/com/google/genai/types/VeoHyperParameters.java create mode 100644 src/main/java/com/google/genai/types/VeoTuningSpec.java diff --git a/src/main/java/com/google/genai/Batches.java b/src/main/java/com/google/genai/Batches.java index 5e0183b6f3e..56f01b82df8 100644 --- a/src/main/java/com/google/genai/Batches.java +++ b/src/main/java/com/google/genai/Batches.java @@ -620,13 +620,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - return toObject; } diff --git a/src/main/java/com/google/genai/Caches.java b/src/main/java/com/google/genai/Caches.java index f7e807b750a..f0aca32bf46 100644 --- a/src/main/java/com/google/genai/Caches.java +++ b/src/main/java/com/google/genai/Caches.java @@ -435,13 +435,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - return toObject; } @@ -1248,13 +1241,6 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - return toObject; } diff --git a/src/main/java/com/google/genai/LiveConverters.java b/src/main/java/com/google/genai/LiveConverters.java index 2979be9fd8c..4874818da82 100644 --- a/src/main/java/com/google/genai/LiveConverters.java +++ b/src/main/java/com/google/genai/LiveConverters.java @@ -514,13 +514,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - return toObject; } @@ -1771,13 +1764,6 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - return toObject; } diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 2cc5007c2b7..436399c72d6 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -666,13 +666,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - return toObject; } @@ -2415,13 +2408,6 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - return toObject; } diff --git a/src/main/java/com/google/genai/TokensConverters.java b/src/main/java/com/google/genai/TokensConverters.java index d08f9ed8e5e..1396d8a34ad 100644 --- a/src/main/java/com/google/genai/TokensConverters.java +++ b/src/main/java/com/google/genai/TokensConverters.java @@ -514,13 +514,6 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"codeExecution"})); } - if (Common.getValueByPath(fromObject, new String[] {"computerUse"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"computerUse"}, - Common.getValueByPath(fromObject, new String[] {"computerUse"})); - } - return toObject; } diff --git a/src/main/java/com/google/genai/Tunings.java b/src/main/java/com/google/genai/Tunings.java index 364c77d2a14..f86b91f4371 100644 --- a/src/main/java/com/google/genai/Tunings.java +++ b/src/main/java/com/google/genai/Tunings.java @@ -549,6 +549,13 @@ ObjectNode tuningJobFromMldev(JsonNode fromObject, ObjectNode parentObject) { toObject)); } + if (Common.getValueByPath(fromObject, new String[] {"customBaseModel"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"customBaseModel"}, + Common.getValueByPath(fromObject, new String[] {"customBaseModel"})); + } + if (Common.getValueByPath(fromObject, new String[] {"distillationSpec"}) != null) { Common.setValueByPath( toObject, @@ -570,6 +577,13 @@ ObjectNode tuningJobFromMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"labels"})); } + if (Common.getValueByPath(fromObject, new String[] {"outputUri"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"outputUri"}, + Common.getValueByPath(fromObject, new String[] {"outputUri"})); + } + if (Common.getValueByPath(fromObject, new String[] {"pipelineJob"}) != null) { Common.setValueByPath( toObject, @@ -577,6 +591,20 @@ ObjectNode tuningJobFromMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"pipelineJob"})); } + if (Common.getValueByPath(fromObject, new String[] {"preTunedModel"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"preTunedModel"}, + Common.getValueByPath(fromObject, new String[] {"preTunedModel"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"preferenceOptimizationSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"preferenceOptimizationSpec"}, + Common.getValueByPath(fromObject, new String[] {"preferenceOptimizationSpec"})); + } + if (Common.getValueByPath(fromObject, new String[] {"satisfiesPzi"}) != null) { Common.setValueByPath( toObject, @@ -605,6 +633,13 @@ ObjectNode tuningJobFromMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"tunedModelDisplayName"})); } + if (Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"veoTuningSpec"}, + Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"})); + } + return toObject; } @@ -840,6 +875,13 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"partnerModelTuningSpec"})); } + if (Common.getValueByPath(fromObject, new String[] {"customBaseModel"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"customBaseModel"}, + Common.getValueByPath(fromObject, new String[] {"customBaseModel"})); + } + if (Common.getValueByPath(fromObject, new String[] {"distillationSpec"}) != null) { Common.setValueByPath( toObject, @@ -861,6 +903,13 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"labels"})); } + if (Common.getValueByPath(fromObject, new String[] {"outputUri"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"outputUri"}, + Common.getValueByPath(fromObject, new String[] {"outputUri"})); + } + if (Common.getValueByPath(fromObject, new String[] {"pipelineJob"}) != null) { Common.setValueByPath( toObject, @@ -868,6 +917,20 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"pipelineJob"})); } + if (Common.getValueByPath(fromObject, new String[] {"preTunedModel"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"preTunedModel"}, + Common.getValueByPath(fromObject, new String[] {"preTunedModel"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"preferenceOptimizationSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"preferenceOptimizationSpec"}, + Common.getValueByPath(fromObject, new String[] {"preferenceOptimizationSpec"})); + } + if (Common.getValueByPath(fromObject, new String[] {"satisfiesPzi"}) != null) { Common.setValueByPath( toObject, @@ -896,6 +959,13 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"tunedModelDisplayName"})); } + if (Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"veoTuningSpec"}, + Common.getValueByPath(fromObject, new String[] {"veoTuningSpec"})); + } + return toObject; } diff --git a/src/main/java/com/google/genai/types/GeminiPreferenceExample.java b/src/main/java/com/google/genai/types/GeminiPreferenceExample.java new file mode 100644 index 00000000000..53d5e2cbd7c --- /dev/null +++ b/src/main/java/com/google/genai/types/GeminiPreferenceExample.java @@ -0,0 +1,126 @@ +/* + * 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.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Input example for preference optimization. */ +@AutoValue +@JsonDeserialize(builder = GeminiPreferenceExample.Builder.class) +public abstract class GeminiPreferenceExample extends JsonSerializable { + /** List of completions for a given prompt. */ + @JsonProperty("completions") + public abstract Optional> completions(); + + /** Multi-turn contents that represents the Prompt. */ + @JsonProperty("contents") + public abstract Optional> contents(); + + /** Instantiates a builder for GeminiPreferenceExample. */ + public static Builder builder() { + return new AutoValue_GeminiPreferenceExample.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GeminiPreferenceExample. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GeminiPreferenceExample.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GeminiPreferenceExample.Builder(); + } + + /** + * Setter for completions. + * + *

completions: List of completions for a given prompt. + */ + @JsonProperty("completions") + public abstract Builder completions(List completions); + + /** + * Setter for completions. + * + *

completions: List of completions for a given prompt. + */ + public Builder completions(GeminiPreferenceExampleCompletion... completions) { + return completions(Arrays.asList(completions)); + } + + /** + * Setter for completions builder. + * + *

completions: List of completions for a given prompt. + */ + public Builder completions(GeminiPreferenceExampleCompletion.Builder... completionsBuilders) { + return completions( + Arrays.asList(completionsBuilders).stream() + .map(GeminiPreferenceExampleCompletion.Builder::build) + .collect(toImmutableList())); + } + + /** + * Setter for contents. + * + *

contents: Multi-turn contents that represents the Prompt. + */ + @JsonProperty("contents") + public abstract Builder contents(List contents); + + /** + * Setter for contents. + * + *

contents: Multi-turn contents that represents the Prompt. + */ + public Builder contents(Content... contents) { + return contents(Arrays.asList(contents)); + } + + /** + * Setter for contents builder. + * + *

contents: Multi-turn contents that represents the Prompt. + */ + public Builder contents(Content.Builder... contentsBuilders) { + return contents( + Arrays.asList(contentsBuilders).stream() + .map(Content.Builder::build) + .collect(toImmutableList())); + } + + public abstract GeminiPreferenceExample build(); + } + + /** Deserializes a JSON string to a GeminiPreferenceExample object. */ + public static GeminiPreferenceExample fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GeminiPreferenceExample.class); + } +} diff --git a/src/main/java/com/google/genai/types/GeminiPreferenceExampleCompletion.java b/src/main/java/com/google/genai/types/GeminiPreferenceExampleCompletion.java new file mode 100644 index 00000000000..6f3ba60cd4e --- /dev/null +++ b/src/main/java/com/google/genai/types/GeminiPreferenceExampleCompletion.java @@ -0,0 +1,92 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Completion and its preference score. */ +@AutoValue +@JsonDeserialize(builder = GeminiPreferenceExampleCompletion.Builder.class) +public abstract class GeminiPreferenceExampleCompletion extends JsonSerializable { + /** Single turn completion for the given prompt. */ + @JsonProperty("completion") + public abstract Optional completion(); + + /** The score for the given completion. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for GeminiPreferenceExampleCompletion. */ + public static Builder builder() { + return new AutoValue_GeminiPreferenceExampleCompletion.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GeminiPreferenceExampleCompletion. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GeminiPreferenceExampleCompletion.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GeminiPreferenceExampleCompletion.Builder(); + } + + /** + * Setter for completion. + * + *

completion: Single turn completion for the given prompt. + */ + @JsonProperty("completion") + public abstract Builder completion(Content completion); + + /** + * Setter for completion builder. + * + *

completion: Single turn completion for the given prompt. + */ + public Builder completion(Content.Builder completionBuilder) { + return completion(completionBuilder.build()); + } + + /** + * Setter for score. + * + *

score: The score for the given completion. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + public abstract GeminiPreferenceExampleCompletion build(); + } + + /** Deserializes a JSON string to a GeminiPreferenceExampleCompletion object. */ + public static GeminiPreferenceExampleCompletion fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GeminiPreferenceExampleCompletion.class); + } +} diff --git a/src/main/java/com/google/genai/types/GenerationConfigThinkingConfig.java b/src/main/java/com/google/genai/types/GenerationConfigThinkingConfig.java index 115bf7cfb76..cd312b0197f 100644 --- a/src/main/java/com/google/genai/types/GenerationConfigThinkingConfig.java +++ b/src/main/java/com/google/genai/types/GenerationConfigThinkingConfig.java @@ -36,10 +36,7 @@ public abstract class GenerationConfigThinkingConfig extends JsonSerializable { @JsonProperty("includeThoughts") public abstract Optional includeThoughts(); - /** - * Optional. Indicates the thinking budget in tokens. This is only applied when enable_thinking is - * true. - */ + /** Optional. Indicates the thinking budget in tokens. */ @JsonProperty("thinkingBudget") public abstract Optional thinkingBudget(); @@ -74,8 +71,7 @@ private static Builder create() { /** * Setter for thinkingBudget. * - *

thinkingBudget: Optional. Indicates the thinking budget in tokens. This is only applied - * when enable_thinking is true. + *

thinkingBudget: Optional. Indicates the thinking budget in tokens. */ @JsonProperty("thinkingBudget") public abstract Builder thinkingBudget(Integer thinkingBudget); diff --git a/src/main/java/com/google/genai/types/GroundingChunk.java b/src/main/java/com/google/genai/types/GroundingChunk.java index 2e6a2aa4c41..64b7bd0dbac 100644 --- a/src/main/java/com/google/genai/types/GroundingChunk.java +++ b/src/main/java/com/google/genai/types/GroundingChunk.java @@ -29,6 +29,10 @@ @AutoValue @JsonDeserialize(builder = GroundingChunk.Builder.class) public abstract class GroundingChunk extends JsonSerializable { + /** Grounding chunk from Google Maps. */ + @JsonProperty("maps") + public abstract Optional maps(); + /** Grounding chunk from context retrieved by the retrieval tools. */ @JsonProperty("retrievedContext") public abstract Optional retrievedContext(); @@ -54,6 +58,23 @@ private static Builder create() { return new AutoValue_GroundingChunk.Builder(); } + /** + * Setter for maps. + * + *

maps: Grounding chunk from Google Maps. + */ + @JsonProperty("maps") + public abstract Builder maps(GroundingChunkMaps maps); + + /** + * Setter for maps builder. + * + *

maps: Grounding chunk from Google Maps. + */ + public Builder maps(GroundingChunkMaps.Builder mapsBuilder) { + return maps(mapsBuilder.build()); + } + /** * Setter for retrievedContext. * diff --git a/src/main/java/com/google/genai/types/GroundingChunkMaps.java b/src/main/java/com/google/genai/types/GroundingChunkMaps.java new file mode 100644 index 00000000000..57ae2172fc2 --- /dev/null +++ b/src/main/java/com/google/genai/types/GroundingChunkMaps.java @@ -0,0 +1,135 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Chunk from Google Maps. */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkMaps.Builder.class) +public abstract class GroundingChunkMaps extends JsonSerializable { + /** + * Sources used to generate the place answer. This includes review snippets and photos that were + * used to generate the answer, as well as uris to flag content. + */ + @JsonProperty("placeAnswerSources") + public abstract Optional placeAnswerSources(); + + /** + * This Place's resource name, in `places/{place_id}` format. Can be used to look up the Place. + */ + @JsonProperty("placeId") + public abstract Optional placeId(); + + /** Text of the chunk. */ + @JsonProperty("text") + public abstract Optional text(); + + /** Title of the chunk. */ + @JsonProperty("title") + public abstract Optional title(); + + /** URI reference of the chunk. */ + @JsonProperty("uri") + public abstract Optional uri(); + + /** Instantiates a builder for GroundingChunkMaps. */ + public static Builder builder() { + return new AutoValue_GroundingChunkMaps.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkMaps. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GroundingChunkMaps.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkMaps.Builder(); + } + + /** + * Setter for placeAnswerSources. + * + *

placeAnswerSources: Sources used to generate the place answer. This includes review + * snippets and photos that were used to generate the answer, as well as uris to flag content. + */ + @JsonProperty("placeAnswerSources") + public abstract Builder placeAnswerSources( + GroundingChunkMapsPlaceAnswerSources placeAnswerSources); + + /** + * Setter for placeAnswerSources builder. + * + *

placeAnswerSources: Sources used to generate the place answer. This includes review + * snippets and photos that were used to generate the answer, as well as uris to flag content. + */ + public Builder placeAnswerSources( + GroundingChunkMapsPlaceAnswerSources.Builder placeAnswerSourcesBuilder) { + return placeAnswerSources(placeAnswerSourcesBuilder.build()); + } + + /** + * Setter for placeId. + * + *

placeId: This Place's resource name, in `places/{place_id}` format. Can be used to look up + * the Place. + */ + @JsonProperty("placeId") + public abstract Builder placeId(String placeId); + + /** + * Setter for text. + * + *

text: Text of the chunk. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + /** + * Setter for title. + * + *

title: Title of the chunk. + */ + @JsonProperty("title") + public abstract Builder title(String title); + + /** + * Setter for uri. + * + *

uri: URI reference of the chunk. + */ + @JsonProperty("uri") + public abstract Builder uri(String uri); + + public abstract GroundingChunkMaps build(); + } + + /** Deserializes a JSON string to a GroundingChunkMaps object. */ + public static GroundingChunkMaps fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunkMaps.class); + } +} diff --git a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSources.java b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSources.java new file mode 100644 index 00000000000..6d08bdc6966 --- /dev/null +++ b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSources.java @@ -0,0 +1,112 @@ +/* + * 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.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Sources used to generate the place answer. */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkMapsPlaceAnswerSources.Builder.class) +public abstract class GroundingChunkMapsPlaceAnswerSources extends JsonSerializable { + /** A link where users can flag a problem with the generated answer. */ + @JsonProperty("flagContentUri") + public abstract Optional flagContentUri(); + + /** Snippets of reviews that are used to generate the answer. */ + @JsonProperty("reviewSnippets") + public abstract Optional> + reviewSnippets(); + + /** Instantiates a builder for GroundingChunkMapsPlaceAnswerSources. */ + public static Builder builder() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSources.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkMapsPlaceAnswerSources. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GroundingChunkMapsPlaceAnswerSources.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSources.Builder(); + } + + /** + * Setter for flagContentUri. + * + *

flagContentUri: A link where users can flag a problem with the generated answer. + */ + @JsonProperty("flagContentUri") + public abstract Builder flagContentUri(String flagContentUri); + + /** + * Setter for reviewSnippets. + * + *

reviewSnippets: Snippets of reviews that are used to generate the answer. + */ + @JsonProperty("reviewSnippets") + public abstract Builder reviewSnippets( + List reviewSnippets); + + /** + * Setter for reviewSnippets. + * + *

reviewSnippets: Snippets of reviews that are used to generate the answer. + */ + public Builder reviewSnippets( + GroundingChunkMapsPlaceAnswerSourcesReviewSnippet... reviewSnippets) { + return reviewSnippets(Arrays.asList(reviewSnippets)); + } + + /** + * Setter for reviewSnippets builder. + * + *

reviewSnippets: Snippets of reviews that are used to generate the answer. + */ + public Builder reviewSnippets( + GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder... reviewSnippetsBuilders) { + return reviewSnippets( + Arrays.asList(reviewSnippetsBuilders).stream() + .map(GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder::build) + .collect(toImmutableList())); + } + + public abstract GroundingChunkMapsPlaceAnswerSources build(); + } + + /** Deserializes a JSON string to a GroundingChunkMapsPlaceAnswerSources object. */ + public static GroundingChunkMapsPlaceAnswerSources fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GroundingChunkMapsPlaceAnswerSources.class); + } +} diff --git a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.java b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.java new file mode 100644 index 00000000000..de42b25f97e --- /dev/null +++ b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.java @@ -0,0 +1,99 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Author attribution for a photo or review. */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.Builder.class) +public abstract class GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution + extends JsonSerializable { + /** Name of the author of the Photo or Review. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Profile photo URI of the author of the Photo or Review. */ + @JsonProperty("photoUri") + public abstract Optional photoUri(); + + /** URI of the author of the Photo or Review. */ + @JsonProperty("uri") + public abstract Optional uri(); + + /** Instantiates a builder for GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution. */ + public static Builder builder() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.Builder(); + } + + /** + * Setter for displayName. + * + *

displayName: Name of the author of the Photo or Review. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + /** + * Setter for photoUri. + * + *

photoUri: Profile photo URI of the author of the Photo or Review. + */ + @JsonProperty("photoUri") + public abstract Builder photoUri(String photoUri); + + /** + * Setter for uri. + * + *

uri: URI of the author of the Photo or Review. + */ + @JsonProperty("uri") + public abstract Builder uri(String uri); + + public abstract GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution build(); + } + + /** + * Deserializes a JSON string to a GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution object. + */ + public static GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.class); + } +} diff --git a/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java new file mode 100644 index 00000000000..cff6477b8f5 --- /dev/null +++ b/src/main/java/com/google/genai/types/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.java @@ -0,0 +1,140 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Encapsulates a review snippet. */ +@AutoValue +@JsonDeserialize(builder = GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder.class) +public abstract class GroundingChunkMapsPlaceAnswerSourcesReviewSnippet extends JsonSerializable { + /** This review's author. */ + @JsonProperty("authorAttribution") + public abstract Optional + authorAttribution(); + + /** A link where users can flag a problem with the review. */ + @JsonProperty("flagContentUri") + public abstract Optional flagContentUri(); + + /** A link to show the review on Google Maps. */ + @JsonProperty("googleMapsUri") + public abstract Optional googleMapsUri(); + + /** + * A string of formatted recent time, expressing the review time relative to the current time in a + * form appropriate for the language and country. + */ + @JsonProperty("relativePublishTimeDescription") + public abstract Optional relativePublishTimeDescription(); + + /** + * A reference representing this place review which may be used to look up this place review + * again. + */ + @JsonProperty("review") + public abstract Optional review(); + + /** Instantiates a builder for GroundingChunkMapsPlaceAnswerSourcesReviewSnippet. */ + public static Builder builder() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GroundingChunkMapsPlaceAnswerSourcesReviewSnippet. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.builder()` + * for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.Builder(); + } + + /** + * Setter for authorAttribution. + * + *

authorAttribution: This review's author. + */ + @JsonProperty("authorAttribution") + public abstract Builder authorAttribution( + GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution authorAttribution); + + /** + * Setter for authorAttribution builder. + * + *

authorAttribution: This review's author. + */ + public Builder authorAttribution( + GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution.Builder authorAttributionBuilder) { + return authorAttribution(authorAttributionBuilder.build()); + } + + /** + * Setter for flagContentUri. + * + *

flagContentUri: A link where users can flag a problem with the review. + */ + @JsonProperty("flagContentUri") + public abstract Builder flagContentUri(String flagContentUri); + + /** + * Setter for googleMapsUri. + * + *

googleMapsUri: A link to show the review on Google Maps. + */ + @JsonProperty("googleMapsUri") + public abstract Builder googleMapsUri(String googleMapsUri); + + /** + * Setter for relativePublishTimeDescription. + * + *

relativePublishTimeDescription: A string of formatted recent time, expressing the review + * time relative to the current time in a form appropriate for the language and country. + */ + @JsonProperty("relativePublishTimeDescription") + public abstract Builder relativePublishTimeDescription(String relativePublishTimeDescription); + + /** + * Setter for review. + * + *

review: A reference representing this place review which may be used to look up this place + * review again. + */ + @JsonProperty("review") + public abstract Builder review(String review); + + public abstract GroundingChunkMapsPlaceAnswerSourcesReviewSnippet build(); + } + + /** Deserializes a JSON string to a GroundingChunkMapsPlaceAnswerSourcesReviewSnippet object. */ + public static GroundingChunkMapsPlaceAnswerSourcesReviewSnippet fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GroundingChunkMapsPlaceAnswerSourcesReviewSnippet.class); + } +} diff --git a/src/main/java/com/google/genai/types/GroundingMetadata.java b/src/main/java/com/google/genai/types/GroundingMetadata.java index 129c8b63523..99c6a1a41c7 100644 --- a/src/main/java/com/google/genai/types/GroundingMetadata.java +++ b/src/main/java/com/google/genai/types/GroundingMetadata.java @@ -33,6 +33,14 @@ @AutoValue @JsonDeserialize(builder = GroundingMetadata.Builder.class) public abstract class GroundingMetadata extends JsonSerializable { + /** + * Optional. Output only. Resource name of the Google Maps widget context token to be used with + * the PlacesContextElement widget to render contextual data. This is populated only for Google + * Maps grounding. + */ + @JsonProperty("googleMapsWidgetContextToken") + public abstract Optional googleMapsWidgetContextToken(); + /** List of supporting references retrieved from specified grounding source. */ @JsonProperty("groundingChunks") public abstract Optional> groundingChunks(); @@ -74,6 +82,16 @@ private static Builder create() { return new AutoValue_GroundingMetadata.Builder(); } + /** + * Setter for googleMapsWidgetContextToken. + * + *

googleMapsWidgetContextToken: Optional. Output only. Resource name of the Google Maps + * widget context token to be used with the PlacesContextElement widget to render contextual + * data. This is populated only for Google Maps grounding. + */ + @JsonProperty("googleMapsWidgetContextToken") + public abstract Builder googleMapsWidgetContextToken(String googleMapsWidgetContextToken); + /** * Setter for groundingChunks. * diff --git a/src/main/java/com/google/genai/types/PreTunedModel.java b/src/main/java/com/google/genai/types/PreTunedModel.java new file mode 100644 index 00000000000..1b456697c5f --- /dev/null +++ b/src/main/java/com/google/genai/types/PreTunedModel.java @@ -0,0 +1,102 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A pre-tuned model for continuous tuning. */ +@AutoValue +@JsonDeserialize(builder = PreTunedModel.Builder.class) +public abstract class PreTunedModel extends JsonSerializable { + /** Output only. The name of the base model this PreTunedModel was tuned from. */ + @JsonProperty("baseModel") + public abstract Optional baseModel(); + + /** Optional. The source checkpoint id. If not specified, the default checkpoint will be used. */ + @JsonProperty("checkpointId") + public abstract Optional checkpointId(); + + /** + * The resource name of the Model. E.g., a model resource name with a specified version id or + * alias: `projects/{project}/locations/{location}/models/{model}@{version_id}` + * `projects/{project}/locations/{location}/models/{model}@{alias}` Or, omit the version id to use + * the default version: `projects/{project}/locations/{location}/models/{model}` + */ + @JsonProperty("tunedModelName") + public abstract Optional tunedModelName(); + + /** Instantiates a builder for PreTunedModel. */ + public static Builder builder() { + return new AutoValue_PreTunedModel.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PreTunedModel. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PreTunedModel.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PreTunedModel.Builder(); + } + + /** + * Setter for baseModel. + * + *

baseModel: Output only. The name of the base model this PreTunedModel was tuned from. + */ + @JsonProperty("baseModel") + public abstract Builder baseModel(String baseModel); + + /** + * Setter for checkpointId. + * + *

checkpointId: Optional. The source checkpoint id. If not specified, the default checkpoint + * will be used. + */ + @JsonProperty("checkpointId") + public abstract Builder checkpointId(String checkpointId); + + /** + * Setter for tunedModelName. + * + *

tunedModelName: The resource name of the Model. E.g., a model resource name with a + * specified version id or alias: + * `projects/{project}/locations/{location}/models/{model}@{version_id}` + * `projects/{project}/locations/{location}/models/{model}@{alias}` Or, omit the version id to + * use the default version: `projects/{project}/locations/{location}/models/{model}` + */ + @JsonProperty("tunedModelName") + public abstract Builder tunedModelName(String tunedModelName); + + public abstract PreTunedModel build(); + } + + /** Deserializes a JSON string to a PreTunedModel object. */ + public static PreTunedModel fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PreTunedModel.class); + } +} diff --git a/src/main/java/com/google/genai/types/PreferenceOptimizationDataStats.java b/src/main/java/com/google/genai/types/PreferenceOptimizationDataStats.java new file mode 100644 index 00000000000..40472e35fe6 --- /dev/null +++ b/src/main/java/com/google/genai/types/PreferenceOptimizationDataStats.java @@ -0,0 +1,227 @@ +/* + * 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.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Statistics computed for datasets used for preference optimization. */ +@AutoValue +@JsonDeserialize(builder = PreferenceOptimizationDataStats.Builder.class) +public abstract class PreferenceOptimizationDataStats extends JsonSerializable { + /** Output only. Dataset distributions for scores variance per example. */ + @JsonProperty("scoreVariancePerExampleDistribution") + public abstract Optional scoreVariancePerExampleDistribution(); + + /** Output only. Dataset distributions for scores. */ + @JsonProperty("scoresDistribution") + public abstract Optional scoresDistribution(); + + /** Output only. Number of billable tokens in the tuning dataset. */ + @JsonProperty("totalBillableTokenCount") + public abstract Optional totalBillableTokenCount(); + + /** Output only. Number of examples in the tuning dataset. */ + @JsonProperty("tuningDatasetExampleCount") + public abstract Optional tuningDatasetExampleCount(); + + /** Output only. Number of tuning steps for this Tuning Job. */ + @JsonProperty("tuningStepCount") + public abstract Optional tuningStepCount(); + + /** Output only. Sample user examples in the training dataset. */ + @JsonProperty("userDatasetExamples") + public abstract Optional> userDatasetExamples(); + + /** Output only. Dataset distributions for the user input tokens. */ + @JsonProperty("userInputTokenDistribution") + public abstract Optional userInputTokenDistribution(); + + /** Output only. Dataset distributions for the user output tokens. */ + @JsonProperty("userOutputTokenDistribution") + public abstract Optional userOutputTokenDistribution(); + + /** Instantiates a builder for PreferenceOptimizationDataStats. */ + public static Builder builder() { + return new AutoValue_PreferenceOptimizationDataStats.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PreferenceOptimizationDataStats. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `PreferenceOptimizationDataStats.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_PreferenceOptimizationDataStats.Builder(); + } + + /** + * Setter for scoreVariancePerExampleDistribution. + * + *

scoreVariancePerExampleDistribution: Output only. Dataset distributions for scores + * variance per example. + */ + @JsonProperty("scoreVariancePerExampleDistribution") + public abstract Builder scoreVariancePerExampleDistribution( + DatasetDistribution scoreVariancePerExampleDistribution); + + /** + * Setter for scoreVariancePerExampleDistribution builder. + * + *

scoreVariancePerExampleDistribution: Output only. Dataset distributions for scores + * variance per example. + */ + public Builder scoreVariancePerExampleDistribution( + DatasetDistribution.Builder scoreVariancePerExampleDistributionBuilder) { + return scoreVariancePerExampleDistribution( + scoreVariancePerExampleDistributionBuilder.build()); + } + + /** + * Setter for scoresDistribution. + * + *

scoresDistribution: Output only. Dataset distributions for scores. + */ + @JsonProperty("scoresDistribution") + public abstract Builder scoresDistribution(DatasetDistribution scoresDistribution); + + /** + * Setter for scoresDistribution builder. + * + *

scoresDistribution: Output only. Dataset distributions for scores. + */ + public Builder scoresDistribution(DatasetDistribution.Builder scoresDistributionBuilder) { + return scoresDistribution(scoresDistributionBuilder.build()); + } + + /** + * Setter for totalBillableTokenCount. + * + *

totalBillableTokenCount: Output only. Number of billable tokens in the tuning dataset. + */ + @JsonProperty("totalBillableTokenCount") + public abstract Builder totalBillableTokenCount(Long totalBillableTokenCount); + + /** + * Setter for tuningDatasetExampleCount. + * + *

tuningDatasetExampleCount: Output only. Number of examples in the tuning dataset. + */ + @JsonProperty("tuningDatasetExampleCount") + public abstract Builder tuningDatasetExampleCount(Long tuningDatasetExampleCount); + + /** + * Setter for tuningStepCount. + * + *

tuningStepCount: Output only. Number of tuning steps for this Tuning Job. + */ + @JsonProperty("tuningStepCount") + public abstract Builder tuningStepCount(Long tuningStepCount); + + /** + * Setter for userDatasetExamples. + * + *

userDatasetExamples: Output only. Sample user examples in the training dataset. + */ + @JsonProperty("userDatasetExamples") + public abstract Builder userDatasetExamples(List userDatasetExamples); + + /** + * Setter for userDatasetExamples. + * + *

userDatasetExamples: Output only. Sample user examples in the training dataset. + */ + public Builder userDatasetExamples(GeminiPreferenceExample... userDatasetExamples) { + return userDatasetExamples(Arrays.asList(userDatasetExamples)); + } + + /** + * Setter for userDatasetExamples builder. + * + *

userDatasetExamples: Output only. Sample user examples in the training dataset. + */ + public Builder userDatasetExamples( + GeminiPreferenceExample.Builder... userDatasetExamplesBuilders) { + return userDatasetExamples( + Arrays.asList(userDatasetExamplesBuilders).stream() + .map(GeminiPreferenceExample.Builder::build) + .collect(toImmutableList())); + } + + /** + * Setter for userInputTokenDistribution. + * + *

userInputTokenDistribution: Output only. Dataset distributions for the user input tokens. + */ + @JsonProperty("userInputTokenDistribution") + public abstract Builder userInputTokenDistribution( + DatasetDistribution userInputTokenDistribution); + + /** + * Setter for userInputTokenDistribution builder. + * + *

userInputTokenDistribution: Output only. Dataset distributions for the user input tokens. + */ + public Builder userInputTokenDistribution( + DatasetDistribution.Builder userInputTokenDistributionBuilder) { + return userInputTokenDistribution(userInputTokenDistributionBuilder.build()); + } + + /** + * Setter for userOutputTokenDistribution. + * + *

userOutputTokenDistribution: Output only. Dataset distributions for the user output + * tokens. + */ + @JsonProperty("userOutputTokenDistribution") + public abstract Builder userOutputTokenDistribution( + DatasetDistribution userOutputTokenDistribution); + + /** + * Setter for userOutputTokenDistribution builder. + * + *

userOutputTokenDistribution: Output only. Dataset distributions for the user output + * tokens. + */ + public Builder userOutputTokenDistribution( + DatasetDistribution.Builder userOutputTokenDistributionBuilder) { + return userOutputTokenDistribution(userOutputTokenDistributionBuilder.build()); + } + + public abstract PreferenceOptimizationDataStats build(); + } + + /** Deserializes a JSON string to a PreferenceOptimizationDataStats object. */ + public static PreferenceOptimizationDataStats fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PreferenceOptimizationDataStats.class); + } +} diff --git a/src/main/java/com/google/genai/types/PreferenceOptimizationHyperParameters.java b/src/main/java/com/google/genai/types/PreferenceOptimizationHyperParameters.java new file mode 100644 index 00000000000..d1eddb922a8 --- /dev/null +++ b/src/main/java/com/google/genai/types/PreferenceOptimizationHyperParameters.java @@ -0,0 +1,134 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Hyperparameters for Preference Optimization. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = PreferenceOptimizationHyperParameters.Builder.class) +public abstract class PreferenceOptimizationHyperParameters extends JsonSerializable { + /** Optional. Adapter size for preference optimization. */ + @JsonProperty("adapterSize") + public abstract Optional adapterSize(); + + /** Optional. Weight for KL Divergence regularization. */ + @JsonProperty("beta") + public abstract Optional beta(); + + /** + * Optional. Number of complete passes the model makes over the entire training dataset during + * training. + */ + @JsonProperty("epochCount") + public abstract Optional epochCount(); + + /** Optional. Multiplier for adjusting the default learning rate. */ + @JsonProperty("learningRateMultiplier") + public abstract Optional learningRateMultiplier(); + + /** Instantiates a builder for PreferenceOptimizationHyperParameters. */ + public static Builder builder() { + return new AutoValue_PreferenceOptimizationHyperParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PreferenceOptimizationHyperParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `PreferenceOptimizationHyperParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_PreferenceOptimizationHyperParameters.Builder(); + } + + /** + * Setter for adapterSize. + * + *

adapterSize: Optional. Adapter size for preference optimization. + */ + @JsonProperty("adapterSize") + public abstract Builder adapterSize(AdapterSize adapterSize); + + /** + * Setter for adapterSize given a known enum. + * + *

adapterSize: Optional. Adapter size for preference optimization. + */ + @CanIgnoreReturnValue + public Builder adapterSize(AdapterSize.Known knownType) { + return adapterSize(new AdapterSize(knownType)); + } + + /** + * Setter for adapterSize given a string. + * + *

adapterSize: Optional. Adapter size for preference optimization. + */ + @CanIgnoreReturnValue + public Builder adapterSize(String adapterSize) { + return adapterSize(new AdapterSize(adapterSize)); + } + + /** + * Setter for beta. + * + *

beta: Optional. Weight for KL Divergence regularization. + */ + @JsonProperty("beta") + public abstract Builder beta(Double beta); + + /** + * Setter for epochCount. + * + *

epochCount: Optional. Number of complete passes the model makes over the entire training + * dataset during training. + */ + @JsonProperty("epochCount") + public abstract Builder epochCount(Long epochCount); + + /** + * Setter for learningRateMultiplier. + * + *

learningRateMultiplier: Optional. Multiplier for adjusting the default learning rate. + */ + @JsonProperty("learningRateMultiplier") + public abstract Builder learningRateMultiplier(Double learningRateMultiplier); + + public abstract PreferenceOptimizationHyperParameters build(); + } + + /** Deserializes a JSON string to a PreferenceOptimizationHyperParameters object. */ + public static PreferenceOptimizationHyperParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PreferenceOptimizationHyperParameters.class); + } +} diff --git a/src/main/java/com/google/genai/types/PreferenceOptimizationSpec.java b/src/main/java/com/google/genai/types/PreferenceOptimizationSpec.java new file mode 100644 index 00000000000..8a99e02d75b --- /dev/null +++ b/src/main/java/com/google/genai/types/PreferenceOptimizationSpec.java @@ -0,0 +1,110 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tuning Spec for Preference Optimization. */ +@AutoValue +@JsonDeserialize(builder = PreferenceOptimizationSpec.Builder.class) +public abstract class PreferenceOptimizationSpec extends JsonSerializable { + /** Optional. Hyperparameters for Preference Optimization. */ + @JsonProperty("hyperParameters") + public abstract Optional hyperParameters(); + + /** + * Required. Cloud Storage path to file containing training dataset for preference optimization + * tuning. The dataset must be formatted as a JSONL file. + */ + @JsonProperty("trainingDatasetUri") + public abstract Optional trainingDatasetUri(); + + /** + * Optional. Cloud Storage path to file containing validation dataset for preference optimization + * tuning. The dataset must be formatted as a JSONL file. + */ + @JsonProperty("validationDatasetUri") + public abstract Optional validationDatasetUri(); + + /** Instantiates a builder for PreferenceOptimizationSpec. */ + public static Builder builder() { + return new AutoValue_PreferenceOptimizationSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PreferenceOptimizationSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PreferenceOptimizationSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PreferenceOptimizationSpec.Builder(); + } + + /** + * Setter for hyperParameters. + * + *

hyperParameters: Optional. Hyperparameters for Preference Optimization. + */ + @JsonProperty("hyperParameters") + public abstract Builder hyperParameters(PreferenceOptimizationHyperParameters hyperParameters); + + /** + * Setter for hyperParameters builder. + * + *

hyperParameters: Optional. Hyperparameters for Preference Optimization. + */ + public Builder hyperParameters( + PreferenceOptimizationHyperParameters.Builder hyperParametersBuilder) { + return hyperParameters(hyperParametersBuilder.build()); + } + + /** + * Setter for trainingDatasetUri. + * + *

trainingDatasetUri: Required. Cloud Storage path to file containing training dataset for + * preference optimization tuning. The dataset must be formatted as a JSONL file. + */ + @JsonProperty("trainingDatasetUri") + public abstract Builder trainingDatasetUri(String trainingDatasetUri); + + /** + * Setter for validationDatasetUri. + * + *

validationDatasetUri: Optional. Cloud Storage path to file containing validation dataset + * for preference optimization tuning. The dataset must be formatted as a JSONL file. + */ + @JsonProperty("validationDatasetUri") + public abstract Builder validationDatasetUri(String validationDatasetUri); + + public abstract PreferenceOptimizationSpec build(); + } + + /** Deserializes a JSON string to a PreferenceOptimizationSpec object. */ + public static PreferenceOptimizationSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PreferenceOptimizationSpec.class); + } +} diff --git a/src/main/java/com/google/genai/types/SupervisedHyperParameters.java b/src/main/java/com/google/genai/types/SupervisedHyperParameters.java index 18ee356bc4a..7dbbba73b43 100644 --- a/src/main/java/com/google/genai/types/SupervisedHyperParameters.java +++ b/src/main/java/com/google/genai/types/SupervisedHyperParameters.java @@ -36,6 +36,10 @@ public abstract class SupervisedHyperParameters extends JsonSerializable { @JsonProperty("adapterSize") public abstract Optional adapterSize(); + /** Optional. Batch size for tuning. This feature is only available for open source models. */ + @JsonProperty("batchSize") + public abstract Optional batchSize(); + /** * Optional. Number of complete passes the model makes over the entire training dataset during * training. @@ -43,9 +47,16 @@ public abstract class SupervisedHyperParameters extends JsonSerializable { @JsonProperty("epochCount") public abstract Optional epochCount(); + /** + * Optional. Learning rate for tuning. Mutually exclusive with `learning_rate_multiplier`. This + * feature is only available for open source models. + */ + @JsonProperty("learningRate") + public abstract Optional learningRate(); + /** * Optional. Multiplier for adjusting the default learning rate. Mutually exclusive with - * `learning_rate`. + * `learning_rate`. This feature is only available for 1P models. */ @JsonProperty("learningRateMultiplier") public abstract Optional learningRateMultiplier(); @@ -95,6 +106,15 @@ public Builder adapterSize(String adapterSize) { return adapterSize(new AdapterSize(adapterSize)); } + /** + * Setter for batchSize. + * + *

batchSize: Optional. Batch size for tuning. This feature is only available for open source + * models. + */ + @JsonProperty("batchSize") + public abstract Builder batchSize(Long batchSize); + /** * Setter for epochCount. * @@ -104,11 +124,20 @@ public Builder adapterSize(String adapterSize) { @JsonProperty("epochCount") public abstract Builder epochCount(Long epochCount); + /** + * Setter for learningRate. + * + *

learningRate: Optional. Learning rate for tuning. Mutually exclusive with + * `learning_rate_multiplier`. This feature is only available for open source models. + */ + @JsonProperty("learningRate") + public abstract Builder learningRate(Double learningRate); + /** * Setter for learningRateMultiplier. * *

learningRateMultiplier: Optional. Multiplier for adjusting the default learning rate. - * Mutually exclusive with `learning_rate`. + * Mutually exclusive with `learning_rate`. This feature is only available for 1P models. */ @JsonProperty("learningRateMultiplier") public abstract Builder learningRateMultiplier(Double learningRateMultiplier); diff --git a/src/main/java/com/google/genai/types/SupervisedTuningSpec.java b/src/main/java/com/google/genai/types/SupervisedTuningSpec.java index 5ddf6550fc8..59b66a56293 100644 --- a/src/main/java/com/google/genai/types/SupervisedTuningSpec.java +++ b/src/main/java/com/google/genai/types/SupervisedTuningSpec.java @@ -22,6 +22,7 @@ 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.Optional; @@ -47,6 +48,10 @@ public abstract class SupervisedTuningSpec extends JsonSerializable { @JsonProperty("trainingDatasetUri") public abstract Optional trainingDatasetUri(); + /** Tuning mode. */ + @JsonProperty("tuningMode") + public abstract Optional tuningMode(); + /** * Optional. Validation dataset used for tuning. The dataset can be specified as either a Cloud * Storage path to a JSONL file or as the resource name of a Vertex Multimodal Dataset. @@ -108,6 +113,34 @@ public Builder hyperParameters(SupervisedHyperParameters.Builder hyperParameters @JsonProperty("trainingDatasetUri") public abstract Builder trainingDatasetUri(String trainingDatasetUri); + /** + * Setter for tuningMode. + * + *

tuningMode: Tuning mode. + */ + @JsonProperty("tuningMode") + public abstract Builder tuningMode(TuningMode tuningMode); + + /** + * Setter for tuningMode given a known enum. + * + *

tuningMode: Tuning mode. + */ + @CanIgnoreReturnValue + public Builder tuningMode(TuningMode.Known knownType) { + return tuningMode(new TuningMode(knownType)); + } + + /** + * Setter for tuningMode given a string. + * + *

tuningMode: Tuning mode. + */ + @CanIgnoreReturnValue + public Builder tuningMode(String tuningMode) { + return tuningMode(new TuningMode(tuningMode)); + } + /** * Setter for validationDatasetUri. * diff --git a/src/main/java/com/google/genai/types/Tool.java b/src/main/java/com/google/genai/types/Tool.java index 7c81f57e17d..66ef3f7f063 100644 --- a/src/main/java/com/google/genai/types/Tool.java +++ b/src/main/java/com/google/genai/types/Tool.java @@ -86,13 +86,6 @@ public abstract class Tool extends JsonSerializable { @JsonProperty("codeExecution") public abstract Optional codeExecution(); - /** - * Optional. Tool to support the model interacting directly with the computer. If enabled, it - * automatically populates computer-use specific Function Declarations. - */ - @JsonProperty("computerUse") - public abstract Optional computerUse(); - /** Instantiates a builder for Tool. */ public static Builder builder() { return new AutoValue_Tool.Builder(); @@ -293,25 +286,6 @@ public Builder codeExecution(ToolCodeExecution.Builder codeExecutionBuilder) { return codeExecution(codeExecutionBuilder.build()); } - /** - * Setter for computerUse. - * - *

computerUse: Optional. Tool to support the model interacting directly with the computer. - * If enabled, it automatically populates computer-use specific Function Declarations. - */ - @JsonProperty("computerUse") - public abstract Builder computerUse(ToolComputerUse computerUse); - - /** - * Setter for computerUse builder. - * - *

computerUse: Optional. Tool to support the model interacting directly with the computer. - * If enabled, it automatically populates computer-use specific Function Declarations. - */ - public Builder computerUse(ToolComputerUse.Builder computerUseBuilder) { - return computerUse(computerUseBuilder.build()); - } - public abstract Tool build(); } diff --git a/src/main/java/com/google/genai/types/TunedModel.java b/src/main/java/com/google/genai/types/TunedModel.java index 605fe5e6760..430132c18bb 100644 --- a/src/main/java/com/google/genai/types/TunedModel.java +++ b/src/main/java/com/google/genai/types/TunedModel.java @@ -35,7 +35,10 @@ public abstract class TunedModel extends JsonSerializable { /** * Output only. The resource name of the TunedModel. Format: - * `projects/{project}/locations/{location}/models/{model}`. + * `projects/{project}/locations/{location}/models/{model}@{version_id}` When tuning from a base + * model, the version_id will be 1. For continuous tuning, the version id will be incremented by 1 + * from the last version id in the parent model. E.g., + * `projects/{project}/locations/{location}/models/{model}@{last_version_id + 1}` */ @JsonProperty("model") public abstract Optional model(); @@ -75,7 +78,10 @@ private static Builder create() { * Setter for model. * *

model: Output only. The resource name of the TunedModel. Format: - * `projects/{project}/locations/{location}/models/{model}`. + * `projects/{project}/locations/{location}/models/{model}@{version_id}` When tuning from a base + * model, the version_id will be 1. For continuous tuning, the version id will be incremented by + * 1 from the last version id in the parent model. E.g., + * `projects/{project}/locations/{location}/models/{model}@{last_version_id + 1}` */ @JsonProperty("model") public abstract Builder model(String model); diff --git a/src/main/java/com/google/genai/types/TuningDataStats.java b/src/main/java/com/google/genai/types/TuningDataStats.java index 32e3111bd88..baaec4d7a67 100644 --- a/src/main/java/com/google/genai/types/TuningDataStats.java +++ b/src/main/java/com/google/genai/types/TuningDataStats.java @@ -33,6 +33,10 @@ public abstract class TuningDataStats extends JsonSerializable { @JsonProperty("distillationDataStats") public abstract Optional distillationDataStats(); + /** Output only. Statistics for preference optimization. */ + @JsonProperty("preferenceOptimizationDataStats") + public abstract Optional preferenceOptimizationDataStats(); + /** The SFT Tuning data stats. */ @JsonProperty("supervisedTuningDataStats") public abstract Optional supervisedTuningDataStats(); @@ -72,6 +76,25 @@ public Builder distillationDataStats( return distillationDataStats(distillationDataStatsBuilder.build()); } + /** + * Setter for preferenceOptimizationDataStats. + * + *

preferenceOptimizationDataStats: Output only. Statistics for preference optimization. + */ + @JsonProperty("preferenceOptimizationDataStats") + public abstract Builder preferenceOptimizationDataStats( + PreferenceOptimizationDataStats preferenceOptimizationDataStats); + + /** + * Setter for preferenceOptimizationDataStats builder. + * + *

preferenceOptimizationDataStats: Output only. Statistics for preference optimization. + */ + public Builder preferenceOptimizationDataStats( + PreferenceOptimizationDataStats.Builder preferenceOptimizationDataStatsBuilder) { + return preferenceOptimizationDataStats(preferenceOptimizationDataStatsBuilder.build()); + } + /** * Setter for supervisedTuningDataStats. * diff --git a/src/main/java/com/google/genai/types/TuningJob.java b/src/main/java/com/google/genai/types/TuningJob.java index 5a3668fb8bd..730dd1089b1 100644 --- a/src/main/java/com/google/genai/types/TuningJob.java +++ b/src/main/java/com/google/genai/types/TuningJob.java @@ -104,6 +104,16 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("partnerModelTuningSpec") public abstract Optional partnerModelTuningSpec(); + /** + * Optional. The user-provided path to custom model weights. Set this field to tune a custom + * model. The path must be a Cloud Storage directory that contains the model weights in + * .safetensors format along with associated model metadata files. If this field is set, the + * base_model field must still be set to indicate which base model the custom model is derived + * from. This feature is only available for open source models. + */ + @JsonProperty("customBaseModel") + public abstract Optional customBaseModel(); + /** Tuning Spec for Distillation. */ @JsonProperty("distillationSpec") public abstract Optional distillationSpec(); @@ -122,6 +132,13 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("labels") public abstract Optional> labels(); + /** + * Optional. Cloud Storage path to the directory where tuning job outputs are written to. This + * field is only available and required for open source models. + */ + @JsonProperty("outputUri") + public abstract Optional outputUri(); + /** * Output only. The resource name of the PipelineJob associated with the TuningJob. Format: * `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`. @@ -129,6 +146,14 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("pipelineJob") public abstract Optional pipelineJob(); + /** The pre-tuned model for continuous tuning. */ + @JsonProperty("preTunedModel") + public abstract Optional preTunedModel(); + + /** Tuning Spec for Preference Optimization. */ + @JsonProperty("preferenceOptimizationSpec") + public abstract Optional preferenceOptimizationSpec(); + /** Output only. Reserved for future use. */ @JsonProperty("satisfiesPzi") public abstract Optional satisfiesPzi(); @@ -154,6 +179,10 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("tunedModelDisplayName") public abstract Optional tunedModelDisplayName(); + /** Tuning Spec for Veo Tuning. */ + @JsonProperty("veoTuningSpec") + public abstract Optional veoTuningSpec(); + /** Instantiates a builder for TuningJob. */ public static Builder builder() { return new AutoValue_TuningJob.Builder(); @@ -368,6 +397,18 @@ public Builder partnerModelTuningSpec( return partnerModelTuningSpec(partnerModelTuningSpecBuilder.build()); } + /** + * Setter for customBaseModel. + * + *

customBaseModel: Optional. The user-provided path to custom model weights. Set this field + * to tune a custom model. The path must be a Cloud Storage directory that contains the model + * weights in .safetensors format along with associated model metadata files. If this field is + * set, the base_model field must still be set to indicate which base model the custom model is + * derived from. This feature is only available for open source models. + */ + @JsonProperty("customBaseModel") + public abstract Builder customBaseModel(String customBaseModel); + /** * Setter for distillationSpec. * @@ -405,6 +446,15 @@ public Builder distillationSpec(DistillationSpec.Builder distillationSpecBuilder @JsonProperty("labels") public abstract Builder labels(Map labels); + /** + * Setter for outputUri. + * + *

outputUri: Optional. Cloud Storage path to the directory where tuning job outputs are + * written to. This field is only available and required for open source models. + */ + @JsonProperty("outputUri") + public abstract Builder outputUri(String outputUri); + /** * Setter for pipelineJob. * @@ -414,6 +464,42 @@ public Builder distillationSpec(DistillationSpec.Builder distillationSpecBuilder @JsonProperty("pipelineJob") public abstract Builder pipelineJob(String pipelineJob); + /** + * Setter for preTunedModel. + * + *

preTunedModel: The pre-tuned model for continuous tuning. + */ + @JsonProperty("preTunedModel") + public abstract Builder preTunedModel(PreTunedModel preTunedModel); + + /** + * Setter for preTunedModel builder. + * + *

preTunedModel: The pre-tuned model for continuous tuning. + */ + public Builder preTunedModel(PreTunedModel.Builder preTunedModelBuilder) { + return preTunedModel(preTunedModelBuilder.build()); + } + + /** + * Setter for preferenceOptimizationSpec. + * + *

preferenceOptimizationSpec: Tuning Spec for Preference Optimization. + */ + @JsonProperty("preferenceOptimizationSpec") + public abstract Builder preferenceOptimizationSpec( + PreferenceOptimizationSpec preferenceOptimizationSpec); + + /** + * Setter for preferenceOptimizationSpec builder. + * + *

preferenceOptimizationSpec: Tuning Spec for Preference Optimization. + */ + public Builder preferenceOptimizationSpec( + PreferenceOptimizationSpec.Builder preferenceOptimizationSpecBuilder) { + return preferenceOptimizationSpec(preferenceOptimizationSpecBuilder.build()); + } + /** * Setter for satisfiesPzi. * @@ -451,6 +537,23 @@ public Builder distillationSpec(DistillationSpec.Builder distillationSpecBuilder @JsonProperty("tunedModelDisplayName") public abstract Builder tunedModelDisplayName(String tunedModelDisplayName); + /** + * Setter for veoTuningSpec. + * + *

veoTuningSpec: Tuning Spec for Veo Tuning. + */ + @JsonProperty("veoTuningSpec") + public abstract Builder veoTuningSpec(VeoTuningSpec veoTuningSpec); + + /** + * Setter for veoTuningSpec builder. + * + *

veoTuningSpec: Tuning Spec for Veo Tuning. + */ + public Builder veoTuningSpec(VeoTuningSpec.Builder veoTuningSpecBuilder) { + return veoTuningSpec(veoTuningSpecBuilder.build()); + } + public abstract TuningJob build(); } diff --git a/src/main/java/com/google/genai/types/TuningMode.java b/src/main/java/com/google/genai/types/TuningMode.java new file mode 100644 index 00000000000..53fb16a8ba0 --- /dev/null +++ b/src/main/java/com/google/genai/types/TuningMode.java @@ -0,0 +1,107 @@ +/* + * 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; + +/** Tuning mode. */ +public class TuningMode { + + /** Enum representing the known values for TuningMode. */ + public enum Known { + /** Tuning mode is unspecified. */ + TUNING_MODE_UNSPECIFIED, + + /** Full fine-tuning mode. */ + TUNING_MODE_FULL, + + /** PEFT adapter tuning mode. */ + TUNING_MODE_PEFT_ADAPTER + } + + private Known tuningModeEnum; + private final String value; + + @JsonCreator + public TuningMode(String value) { + this.value = value; + for (Known tuningModeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(tuningModeEnum.toString(), value)) { + this.tuningModeEnum = tuningModeEnum; + break; + } + } + if (this.tuningModeEnum == null) { + this.tuningModeEnum = Known.TUNING_MODE_UNSPECIFIED; + } + } + + public TuningMode(Known knownValue) { + this.tuningModeEnum = knownValue; + this.value = knownValue.toString(); + } + + @Override + @JsonValue + public String toString() { + return this.value; + } + + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof TuningMode)) { + return false; + } + + TuningMode other = (TuningMode) o; + + if (this.tuningModeEnum != Known.TUNING_MODE_UNSPECIFIED + && other.tuningModeEnum != Known.TUNING_MODE_UNSPECIFIED) { + return this.tuningModeEnum == other.tuningModeEnum; + } else if (this.tuningModeEnum == Known.TUNING_MODE_UNSPECIFIED + && other.tuningModeEnum == Known.TUNING_MODE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @Override + public int hashCode() { + if (this.tuningModeEnum != Known.TUNING_MODE_UNSPECIFIED) { + return this.tuningModeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + public Known knownEnum() { + return this.tuningModeEnum; + } +} diff --git a/src/main/java/com/google/genai/types/TuningTask.java b/src/main/java/com/google/genai/types/TuningTask.java new file mode 100644 index 00000000000..5373a3e24fa --- /dev/null +++ b/src/main/java/com/google/genai/types/TuningTask.java @@ -0,0 +1,107 @@ +/* + * 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; + +/** Optional. The tuning task. Either I2V or T2V. */ +public class TuningTask { + + /** Enum representing the known values for TuningTask. */ + public enum Known { + /** Default value. This value is unused. */ + TUNING_TASK_UNSPECIFIED, + + /** Tuning task for image to video. */ + TUNING_TASK_I2V, + + /** Tuning task for text to video. */ + TUNING_TASK_T2V + } + + private Known tuningTaskEnum; + private final String value; + + @JsonCreator + public TuningTask(String value) { + this.value = value; + for (Known tuningTaskEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(tuningTaskEnum.toString(), value)) { + this.tuningTaskEnum = tuningTaskEnum; + break; + } + } + if (this.tuningTaskEnum == null) { + this.tuningTaskEnum = Known.TUNING_TASK_UNSPECIFIED; + } + } + + public TuningTask(Known knownValue) { + this.tuningTaskEnum = knownValue; + this.value = knownValue.toString(); + } + + @Override + @JsonValue + public String toString() { + return this.value; + } + + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof TuningTask)) { + return false; + } + + TuningTask other = (TuningTask) o; + + if (this.tuningTaskEnum != Known.TUNING_TASK_UNSPECIFIED + && other.tuningTaskEnum != Known.TUNING_TASK_UNSPECIFIED) { + return this.tuningTaskEnum == other.tuningTaskEnum; + } else if (this.tuningTaskEnum == Known.TUNING_TASK_UNSPECIFIED + && other.tuningTaskEnum == Known.TUNING_TASK_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @Override + public int hashCode() { + if (this.tuningTaskEnum != Known.TUNING_TASK_UNSPECIFIED) { + return this.tuningTaskEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + public Known knownEnum() { + return this.tuningTaskEnum; + } +} diff --git a/src/main/java/com/google/genai/types/VeoHyperParameters.java b/src/main/java/com/google/genai/types/VeoHyperParameters.java new file mode 100644 index 00000000000..af65cbc819d --- /dev/null +++ b/src/main/java/com/google/genai/types/VeoHyperParameters.java @@ -0,0 +1,119 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Hyperparameters for Veo. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = VeoHyperParameters.Builder.class) +public abstract class VeoHyperParameters extends JsonSerializable { + /** + * Optional. Number of complete passes the model makes over the entire training dataset during + * training. + */ + @JsonProperty("epochCount") + public abstract Optional epochCount(); + + /** Optional. Multiplier for adjusting the default learning rate. */ + @JsonProperty("learningRateMultiplier") + public abstract Optional learningRateMultiplier(); + + /** Optional. The tuning task. Either I2V or T2V. */ + @JsonProperty("tuningTask") + public abstract Optional tuningTask(); + + /** Instantiates a builder for VeoHyperParameters. */ + public static Builder builder() { + return new AutoValue_VeoHyperParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for VeoHyperParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `VeoHyperParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_VeoHyperParameters.Builder(); + } + + /** + * Setter for epochCount. + * + *

epochCount: Optional. Number of complete passes the model makes over the entire training + * dataset during training. + */ + @JsonProperty("epochCount") + public abstract Builder epochCount(Long epochCount); + + /** + * Setter for learningRateMultiplier. + * + *

learningRateMultiplier: Optional. Multiplier for adjusting the default learning rate. + */ + @JsonProperty("learningRateMultiplier") + public abstract Builder learningRateMultiplier(Double learningRateMultiplier); + + /** + * Setter for tuningTask. + * + *

tuningTask: Optional. The tuning task. Either I2V or T2V. + */ + @JsonProperty("tuningTask") + public abstract Builder tuningTask(TuningTask tuningTask); + + /** + * Setter for tuningTask given a known enum. + * + *

tuningTask: Optional. The tuning task. Either I2V or T2V. + */ + @CanIgnoreReturnValue + public Builder tuningTask(TuningTask.Known knownType) { + return tuningTask(new TuningTask(knownType)); + } + + /** + * Setter for tuningTask given a string. + * + *

tuningTask: Optional. The tuning task. Either I2V or T2V. + */ + @CanIgnoreReturnValue + public Builder tuningTask(String tuningTask) { + return tuningTask(new TuningTask(tuningTask)); + } + + public abstract VeoHyperParameters build(); + } + + /** Deserializes a JSON string to a VeoHyperParameters object. */ + public static VeoHyperParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, VeoHyperParameters.class); + } +} diff --git a/src/main/java/com/google/genai/types/VeoTuningSpec.java b/src/main/java/com/google/genai/types/VeoTuningSpec.java new file mode 100644 index 00000000000..40b38f3bb79 --- /dev/null +++ b/src/main/java/com/google/genai/types/VeoTuningSpec.java @@ -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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tuning Spec for Veo Model Tuning. */ +@AutoValue +@JsonDeserialize(builder = VeoTuningSpec.Builder.class) +public abstract class VeoTuningSpec extends JsonSerializable { + /** Optional. Hyperparameters for Veo. */ + @JsonProperty("hyperParameters") + public abstract Optional hyperParameters(); + + /** + * Required. Training dataset used for tuning. The dataset can be specified as either a Cloud + * Storage path to a JSONL file or as the resource name of a Vertex Multimodal Dataset. + */ + @JsonProperty("trainingDatasetUri") + public abstract Optional trainingDatasetUri(); + + /** + * Optional. Validation dataset used for tuning. The dataset can be specified as either a Cloud + * Storage path to a JSONL file or as the resource name of a Vertex Multimodal Dataset. + */ + @JsonProperty("validationDatasetUri") + public abstract Optional validationDatasetUri(); + + /** Instantiates a builder for VeoTuningSpec. */ + public static Builder builder() { + return new AutoValue_VeoTuningSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for VeoTuningSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `VeoTuningSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_VeoTuningSpec.Builder(); + } + + /** + * Setter for hyperParameters. + * + *

hyperParameters: Optional. Hyperparameters for Veo. + */ + @JsonProperty("hyperParameters") + public abstract Builder hyperParameters(VeoHyperParameters hyperParameters); + + /** + * Setter for hyperParameters builder. + * + *

hyperParameters: Optional. Hyperparameters for Veo. + */ + public Builder hyperParameters(VeoHyperParameters.Builder hyperParametersBuilder) { + return hyperParameters(hyperParametersBuilder.build()); + } + + /** + * Setter for trainingDatasetUri. + * + *

trainingDatasetUri: Required. Training dataset used for tuning. The dataset can be + * specified as either a Cloud Storage path to a JSONL file or as the resource name of a Vertex + * Multimodal Dataset. + */ + @JsonProperty("trainingDatasetUri") + public abstract Builder trainingDatasetUri(String trainingDatasetUri); + + /** + * Setter for validationDatasetUri. + * + *

validationDatasetUri: Optional. Validation dataset used for tuning. The dataset can be + * specified as either a Cloud Storage path to a JSONL file or as the resource name of a Vertex + * Multimodal Dataset. + */ + @JsonProperty("validationDatasetUri") + public abstract Builder validationDatasetUri(String validationDatasetUri); + + public abstract VeoTuningSpec build(); + } + + /** Deserializes a JSON string to a VeoTuningSpec object. */ + public static VeoTuningSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, VeoTuningSpec.class); + } +} From 255e739290308cb05b95577412afb64ca93dcf44 Mon Sep 17 00:00:00 2001 From: Jaycee Li Date: Thu, 7 Aug 2025 14:27:54 -0700 Subject: [PATCH 020/178] chore: Add more comments to explain function calling and schema examples PiperOrigin-RevId: 792309574 --- README.md | 4 ++++ .../GenerateContentWithFunctionCall.java | 4 +++- .../GenerateContentWithFunctionCallJson.java | 21 ++++++++----------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a6ecd160f19..6a969a6aa8d 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,8 @@ public class GenerateContentWithFunctionCall { public static void main(String[] args) throws NoSuchMethodException { Client client = new Client(); + // Load the method as a reflected Method object so that it can be + // automatically executed on the client side. Method method = GenerateContentWithFunctionCall.class.getMethod( "getCurrentWeather", String.class, String.class); @@ -450,6 +452,7 @@ public class GenerateContentWithSchema { public static void main(String[] args) { Client client = new Client(); + // Define the schema for the response, in Json format. ImmutableMap schema = ImmutableMap.of( "type", "object", "properties", ImmutableMap.of( @@ -462,6 +465,7 @@ public class GenerateContentWithSchema { "required", ImmutableList.of("recipe_name", "ingredients") ); + // Set the response schema in GenerateContentConfig GenerateContentConfig config = GenerateContentConfig.builder() .responseMimeType("application/json") diff --git a/examples/src/main/java/com/google/genai/examples/GenerateContentWithFunctionCall.java b/examples/src/main/java/com/google/genai/examples/GenerateContentWithFunctionCall.java index dc6d4b3e7d4..f44df320415 100644 --- a/examples/src/main/java/com/google/genai/examples/GenerateContentWithFunctionCall.java +++ b/examples/src/main/java/com/google/genai/examples/GenerateContentWithFunctionCall.java @@ -56,7 +56,7 @@ public static String getCurrentWeather(String location, String unit) { } /** A callable function to divide two integers. */ - public static Integer divideTwoIntegers(Integer numerator, Integer denominator) { + public static Integer divideTwoIntegers(int numerator, int denominator) { return numerator / denominator; } @@ -82,6 +82,8 @@ public static void main(String[] args) throws NoSuchMethodException { System.out.println("Using Gemini Developer API"); } + // Load the two methods as reflected Method objects so that they can be automatically executed + // on the client side. Method method1 = GenerateContentWithFunctionCall.class.getMethod( "getCurrentWeather", String.class, String.class); diff --git a/examples/src/main/java/com/google/genai/examples/GenerateContentWithFunctionCallJson.java b/examples/src/main/java/com/google/genai/examples/GenerateContentWithFunctionCallJson.java index a162b920fdf..9c0c9ed930f 100644 --- a/examples/src/main/java/com/google/genai/examples/GenerateContentWithFunctionCallJson.java +++ b/examples/src/main/java/com/google/genai/examples/GenerateContentWithFunctionCallJson.java @@ -45,11 +45,10 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.genai.Client; +import com.google.genai.types.FunctionDeclaration; import com.google.genai.types.GenerateContentConfig; import com.google.genai.types.GenerateContentResponse; import com.google.genai.types.Tool; -import com.google.genai.types.FunctionDeclaration; - /** An example of using the Unified Gen AI Java SDK to generate content with function calling. */ public final class GenerateContentWithFunctionCallJson { @@ -76,28 +75,26 @@ public static void main(String[] args) { System.out.println("Using Gemini Developer API"); } + // Define the schema for the function declaration, in Json format. ImmutableMap schema = ImmutableMap.of( "type", "object", "properties", ImmutableMap.of("location", ImmutableMap.of("type", "string")), "required", ImmutableList.of("location")); + // Define the tool with the function declaration. Tool toolWithFunctionDeclarations = Tool.builder() .functionDeclarations( - ImmutableList.of( - FunctionDeclaration.builder() - .name("get_weather") - .description("Returns the weather in a given location.") - .parametersJsonSchema(schema) - .build())) + FunctionDeclaration.builder() + .name("get_weather") + .description("Returns the weather in a given location.") + .parametersJsonSchema(schema)) .build(); - // Add the two methods as callable functions to the list of tools. + // Add the tool to the GenerateContentConfig. GenerateContentConfig config = - GenerateContentConfig.builder() - .tools(ImmutableList.of(toolWithFunctionDeclarations)) - .build(); + GenerateContentConfig.builder().tools(toolWithFunctionDeclarations).build(); GenerateContentResponse response = client.models.generateContent(modelId, "What is the weather in Vancouver?", config); From 94ab84d2dcf5b4a6e3380761f6ae5910e774d693 Mon Sep 17 00:00:00 2001 From: Amy Wu Date: Thu, 7 Aug 2025 14:57:27 -0700 Subject: [PATCH 021/178] chore: internal PiperOrigin-RevId: 792320851 --- src/main/java/com/google/genai/Tunings.java | 38 +++--- .../types/CreateTuningJobParameters.java | 4 +- .../CreateTuningJobParametersPrivate.java | 120 ++++++++++++++++++ .../com/google/genai/types/TuningJob.java | 42 +++--- 4 files changed, 160 insertions(+), 44 deletions(-) create mode 100644 src/main/java/com/google/genai/types/CreateTuningJobParametersPrivate.java diff --git a/src/main/java/com/google/genai/Tunings.java b/src/main/java/com/google/genai/Tunings.java index f86b91f4371..f02c1037ed1 100644 --- a/src/main/java/com/google/genai/Tunings.java +++ b/src/main/java/com/google/genai/Tunings.java @@ -24,7 +24,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.genai.errors.GenAiIOException; import com.google.genai.types.CreateTuningJobConfig; -import com.google.genai.types.CreateTuningJobParameters; +import com.google.genai.types.CreateTuningJobParametersPrivate; import com.google.genai.types.GetTuningJobConfig; import com.google.genai.types.GetTuningJobParameters; import com.google.genai.types.HttpOptions; @@ -219,7 +219,7 @@ ObjectNode createTuningJobConfigToMldev(JsonNode fromObject, ObjectNode parentOb } @ExcludeFromGeneratedCoverageReport - ObjectNode createTuningJobParametersToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode createTuningJobParametersPrivateToMldev(JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"baseModel"}) != null) { Common.setValueByPath( @@ -427,7 +427,8 @@ ObjectNode createTuningJobConfigToVertex(JsonNode fromObject, ObjectNode parentO } @ExcludeFromGeneratedCoverageReport - ObjectNode createTuningJobParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode createTuningJobParametersPrivateToVertex( + JsonNode fromObject, ObjectNode parentObject) { ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"baseModel"}) != null) { Common.setValueByPath( @@ -591,13 +592,6 @@ ObjectNode tuningJobFromMldev(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"pipelineJob"})); } - if (Common.getValueByPath(fromObject, new String[] {"preTunedModel"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"preTunedModel"}, - Common.getValueByPath(fromObject, new String[] {"preTunedModel"})); - } - if (Common.getValueByPath(fromObject, new String[] {"preferenceOptimizationSpec"}) != null) { Common.setValueByPath( toObject, @@ -847,6 +841,13 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { toObject)); } + if (Common.getValueByPath(fromObject, new String[] {"preTunedModel"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"preTunedModel"}, + Common.getValueByPath(fromObject, new String[] {"preTunedModel"})); + } + if (Common.getValueByPath(fromObject, new String[] {"supervisedTuningSpec"}) != null) { Common.setValueByPath( toObject, @@ -917,13 +918,6 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { Common.getValueByPath(fromObject, new String[] {"pipelineJob"})); } - if (Common.getValueByPath(fromObject, new String[] {"preTunedModel"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"preTunedModel"}, - Common.getValueByPath(fromObject, new String[] {"preTunedModel"})); - } - if (Common.getValueByPath(fromObject, new String[] {"preferenceOptimizationSpec"}) != null) { Common.setValueByPath( toObject, @@ -1119,7 +1113,8 @@ ListTuningJobsResponse privateList(ListTuningJobsConfig config) { TuningJob privateTune( String baseModel, TuningDataset trainingDataset, CreateTuningJobConfig config) { - CreateTuningJobParameters.Builder parameterBuilder = CreateTuningJobParameters.builder(); + CreateTuningJobParametersPrivate.Builder parameterBuilder = + CreateTuningJobParametersPrivate.builder(); if (!Common.isZero(baseModel)) { parameterBuilder.baseModel(baseModel); @@ -1135,7 +1130,7 @@ TuningJob privateTune( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = createTuningJobParametersToVertex(parameterNode, null); + body = createTuningJobParametersPrivateToVertex(parameterNode, null); path = Common.formatMap("tuningJobs", body.get("_url")); } else { throw new UnsupportedOperationException( @@ -1182,7 +1177,8 @@ TuningJob privateTune( TuningOperation privateTuneMldev( String baseModel, TuningDataset trainingDataset, CreateTuningJobConfig config) { - CreateTuningJobParameters.Builder parameterBuilder = CreateTuningJobParameters.builder(); + CreateTuningJobParametersPrivate.Builder parameterBuilder = + CreateTuningJobParametersPrivate.builder(); if (!Common.isZero(baseModel)) { parameterBuilder.baseModel(baseModel); @@ -1201,7 +1197,7 @@ TuningOperation privateTuneMldev( throw new UnsupportedOperationException( "This method is only supported in the Gemini Developer client."); } else { - body = createTuningJobParametersToMldev(parameterNode, null); + body = createTuningJobParametersPrivateToMldev(parameterNode, null); if (body.get("_url") != null) { path = Common.formatMap("tunedModels", body.get("_url")); } else { diff --git a/src/main/java/com/google/genai/types/CreateTuningJobParameters.java b/src/main/java/com/google/genai/types/CreateTuningJobParameters.java index 30683c0ae15..cf438f7c2de 100644 --- a/src/main/java/com/google/genai/types/CreateTuningJobParameters.java +++ b/src/main/java/com/google/genai/types/CreateTuningJobParameters.java @@ -31,7 +31,7 @@ @InternalApi @JsonDeserialize(builder = CreateTuningJobParameters.Builder.class) public abstract class CreateTuningJobParameters extends JsonSerializable { - /** The base model that is being tuned, e.g., "gemini-1.0-pro-002". */ + /** The base model that is being tuned, e.g., "gemini-2.5-flash". */ @JsonProperty("baseModel") public abstract Optional baseModel(); @@ -66,7 +66,7 @@ private static Builder create() { /** * Setter for baseModel. * - *

baseModel: The base model that is being tuned, e.g., "gemini-1.0-pro-002". + *

baseModel: The base model that is being tuned, e.g., "gemini-2.5-flash". */ @JsonProperty("baseModel") public abstract Builder baseModel(String baseModel); diff --git a/src/main/java/com/google/genai/types/CreateTuningJobParametersPrivate.java b/src/main/java/com/google/genai/types/CreateTuningJobParametersPrivate.java new file mode 100644 index 00000000000..8cb8b8275e3 --- /dev/null +++ b/src/main/java/com/google/genai/types/CreateTuningJobParametersPrivate.java @@ -0,0 +1,120 @@ +/* + * 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.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Supervised fine-tuning job creation parameters - optional fields. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateTuningJobParametersPrivate.Builder.class) +public abstract class CreateTuningJobParametersPrivate extends JsonSerializable { + /** The base model that is being tuned, e.g., "gemini-2.5-flash". */ + @JsonProperty("baseModel") + public abstract Optional baseModel(); + + /** + * Cloud Storage path to file containing training dataset for tuning. The dataset must be + * formatted as a JSONL file. + */ + @JsonProperty("trainingDataset") + public abstract Optional trainingDataset(); + + /** Configuration for the tuning job. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateTuningJobParametersPrivate. */ + public static Builder builder() { + return new AutoValue_CreateTuningJobParametersPrivate.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateTuningJobParametersPrivate. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateTuningJobParametersPrivate.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateTuningJobParametersPrivate.Builder(); + } + + /** + * Setter for baseModel. + * + *

baseModel: The base model that is being tuned, e.g., "gemini-2.5-flash". + */ + @JsonProperty("baseModel") + public abstract Builder baseModel(String baseModel); + + /** + * Setter for trainingDataset. + * + *

trainingDataset: Cloud Storage path to file containing training dataset for tuning. The + * dataset must be formatted as a JSONL file. + */ + @JsonProperty("trainingDataset") + public abstract Builder trainingDataset(TuningDataset trainingDataset); + + /** + * Setter for trainingDataset builder. + * + *

trainingDataset: Cloud Storage path to file containing training dataset for tuning. The + * dataset must be formatted as a JSONL file. + */ + public Builder trainingDataset(TuningDataset.Builder trainingDatasetBuilder) { + return trainingDataset(trainingDatasetBuilder.build()); + } + + /** + * Setter for config. + * + *

config: Configuration for the tuning job. + */ + @JsonProperty("config") + public abstract Builder config(CreateTuningJobConfig config); + + /** + * Setter for config builder. + * + *

config: Configuration for the tuning job. + */ + public Builder config(CreateTuningJobConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + public abstract CreateTuningJobParametersPrivate build(); + } + + /** Deserializes a JSON string to a CreateTuningJobParametersPrivate object. */ + public static CreateTuningJobParametersPrivate fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateTuningJobParametersPrivate.class); + } +} diff --git a/src/main/java/com/google/genai/types/TuningJob.java b/src/main/java/com/google/genai/types/TuningJob.java index 730dd1089b1..95165e75172 100644 --- a/src/main/java/com/google/genai/types/TuningJob.java +++ b/src/main/java/com/google/genai/types/TuningJob.java @@ -85,6 +85,10 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("tunedModel") public abstract Optional tunedModel(); + /** The pre-tuned model for continuous tuning. */ + @JsonProperty("preTunedModel") + public abstract Optional preTunedModel(); + /** Tuning Spec for Supervised Fine Tuning. */ @JsonProperty("supervisedTuningSpec") public abstract Optional supervisedTuningSpec(); @@ -146,10 +150,6 @@ public abstract class TuningJob extends JsonSerializable { @JsonProperty("pipelineJob") public abstract Optional pipelineJob(); - /** The pre-tuned model for continuous tuning. */ - @JsonProperty("preTunedModel") - public abstract Optional preTunedModel(); - /** Tuning Spec for Preference Optimization. */ @JsonProperty("preferenceOptimizationSpec") public abstract Optional preferenceOptimizationSpec(); @@ -324,6 +324,23 @@ public Builder tunedModel(TunedModel.Builder tunedModelBuilder) { return tunedModel(tunedModelBuilder.build()); } + /** + * Setter for preTunedModel. + * + *

preTunedModel: The pre-tuned model for continuous tuning. + */ + @JsonProperty("preTunedModel") + public abstract Builder preTunedModel(PreTunedModel preTunedModel); + + /** + * Setter for preTunedModel builder. + * + *

preTunedModel: The pre-tuned model for continuous tuning. + */ + public Builder preTunedModel(PreTunedModel.Builder preTunedModelBuilder) { + return preTunedModel(preTunedModelBuilder.build()); + } + /** * Setter for supervisedTuningSpec. * @@ -464,23 +481,6 @@ public Builder distillationSpec(DistillationSpec.Builder distillationSpecBuilder @JsonProperty("pipelineJob") public abstract Builder pipelineJob(String pipelineJob); - /** - * Setter for preTunedModel. - * - *

preTunedModel: The pre-tuned model for continuous tuning. - */ - @JsonProperty("preTunedModel") - public abstract Builder preTunedModel(PreTunedModel preTunedModel); - - /** - * Setter for preTunedModel builder. - * - *

preTunedModel: The pre-tuned model for continuous tuning. - */ - public Builder preTunedModel(PreTunedModel.Builder preTunedModelBuilder) { - return preTunedModel(preTunedModelBuilder.build()); - } - /** * Setter for preferenceOptimizationSpec. * From 49e1e80f01dda62bb58b6ee426afd52bd0571904 Mon Sep 17 00:00:00 2001 From: Jaycee Li Date: Thu, 7 Aug 2025 15:31:04 -0700 Subject: [PATCH 022/178] chore: Exclude `fromJson` and `builder()` from code coverage report PiperOrigin-RevId: 792333167 --- pom.xml | 4 +-- .../com/google/genai/types/ActivityEnd.java | 2 ++ .../google/genai/types/ActivityHandling.java | 4 +++ .../com/google/genai/types/ActivityStart.java | 2 ++ .../com/google/genai/types/AdapterSize.java | 4 +++ .../java/com/google/genai/types/ApiAuth.java | 2 ++ .../genai/types/ApiAuthApiKeyConfig.java | 2 ++ .../com/google/genai/types/ApiKeyConfig.java | 2 ++ .../java/com/google/genai/types/ApiSpec.java | 4 +++ .../genai/types/AudioTranscriptionConfig.java | 2 ++ .../com/google/genai/types/AuthConfig.java | 2 ++ .../AuthConfigGoogleServiceAccountConfig.java | 2 ++ .../types/AuthConfigHttpBasicAuthConfig.java | 2 ++ .../genai/types/AuthConfigOauthConfig.java | 2 ++ .../genai/types/AuthConfigOidcConfig.java | 2 ++ .../java/com/google/genai/types/AuthType.java | 4 +++ .../types/AutomaticActivityDetection.java | 2 ++ .../types/AutomaticFunctionCallingConfig.java | 2 ++ .../java/com/google/genai/types/BatchJob.java | 2 ++ .../genai/types/BatchJobDestination.java | 2 ++ .../google/genai/types/BatchJobSource.java | 2 ++ .../java/com/google/genai/types/Behavior.java | 4 +++ .../java/com/google/genai/types/Blob.java | 2 ++ .../com/google/genai/types/BlockedReason.java | 4 +++ .../com/google/genai/types/CachedContent.java | 2 ++ .../types/CachedContentUsageMetadata.java | 2 ++ .../genai/types/CancelBatchJobConfig.java | 2 ++ .../genai/types/CancelBatchJobParameters.java | 2 ++ .../com/google/genai/types/Candidate.java | 2 ++ .../com/google/genai/types/Checkpoint.java | 2 ++ .../java/com/google/genai/types/Citation.java | 2 ++ .../google/genai/types/CitationMetadata.java | 2 ++ .../com/google/genai/types/ClientOptions.java | 2 ++ .../genai/types/CodeExecutionResult.java | 2 ++ .../genai/types/ComputeTokensConfig.java | 2 ++ .../genai/types/ComputeTokensParameters.java | 2 ++ .../genai/types/ComputeTokensResponse.java | 2 ++ .../java/com/google/genai/types/Content.java | 2 ++ .../google/genai/types/ContentEmbedding.java | 2 ++ .../types/ContentEmbeddingStatistics.java | 2 ++ .../types/ContextWindowCompressionConfig.java | 2 ++ .../genai/types/ControlReferenceConfig.java | 2 ++ .../genai/types/ControlReferenceImage.java | 2 ++ .../genai/types/ControlReferenceType.java | 4 +++ .../google/genai/types/CountTokensConfig.java | 2 ++ .../genai/types/CountTokensParameters.java | 2 ++ .../genai/types/CountTokensResponse.java | 2 ++ .../genai/types/CreateAuthTokenConfig.java | 2 ++ .../genai/types/CreateBatchJobConfig.java | 2 ++ .../genai/types/CreateBatchJobParameters.java | 2 ++ .../types/CreateCachedContentConfig.java | 2 ++ .../types/CreateCachedContentParameters.java | 2 ++ .../google/genai/types/CreateFileConfig.java | 2 ++ .../genai/types/CreateFileParameters.java | 2 ++ .../genai/types/CreateFileResponse.java | 2 ++ .../genai/types/CreateTuningJobConfig.java | 2 ++ .../types/CreateTuningJobParameters.java | 2 ++ .../CreateTuningJobParametersPrivate.java | 2 ++ .../genai/types/DatasetDistribution.java | 2 ++ ...DatasetDistributionDistributionBucket.java | 2 ++ .../com/google/genai/types/DatasetStats.java | 2 ++ .../genai/types/DeleteBatchJobConfig.java | 2 ++ .../genai/types/DeleteBatchJobParameters.java | 2 ++ .../types/DeleteCachedContentConfig.java | 2 ++ .../types/DeleteCachedContentParameters.java | 2 ++ .../types/DeleteCachedContentResponse.java | 2 ++ .../google/genai/types/DeleteFileConfig.java | 2 ++ .../genai/types/DeleteFileParameters.java | 2 ++ .../genai/types/DeleteFileResponse.java | 2 ++ .../google/genai/types/DeleteModelConfig.java | 2 ++ .../genai/types/DeleteModelParameters.java | 2 ++ .../genai/types/DeleteModelResponse.java | 2 ++ .../google/genai/types/DeleteResourceJob.java | 2 ++ .../genai/types/DistillationDataStats.java | 2 ++ .../types/DistillationHyperParameters.java | 2 ++ .../google/genai/types/DistillationSpec.java | 2 ++ .../genai/types/DownloadFileConfig.java | 2 ++ .../genai/types/DynamicRetrievalConfig.java | 2 ++ .../types/DynamicRetrievalConfigMode.java | 4 +++ .../google/genai/types/EditImageConfig.java | 2 ++ .../genai/types/EditImageParameters.java | 2 ++ .../google/genai/types/EditImageResponse.java | 2 ++ .../java/com/google/genai/types/EditMode.java | 4 +++ .../genai/types/EmbedContentConfig.java | 2 ++ .../genai/types/EmbedContentMetadata.java | 2 ++ .../genai/types/EmbedContentParameters.java | 2 ++ .../genai/types/EmbedContentResponse.java | 2 ++ .../google/genai/types/EncryptionSpec.java | 2 ++ .../google/genai/types/EndSensitivity.java | 4 +++ .../java/com/google/genai/types/Endpoint.java | 2 ++ .../genai/types/EnterpriseWebSearch.java | 2 ++ .../com/google/genai/types/Environment.java | 4 +++ .../ExcludeFromGeneratedCoverageReport.java | 31 +++++++++++++++++++ .../google/genai/types/ExecutableCode.java | 2 ++ .../com/google/genai/types/ExternalApi.java | 2 ++ .../types/ExternalApiElasticSearchParams.java | 2 ++ .../types/ExternalApiSimpleSearchParams.java | 2 ++ .../types/FeatureSelectionPreference.java | 4 +++ .../types/FetchPredictOperationConfig.java | 2 ++ .../FetchPredictOperationParameters.java | 2 ++ .../java/com/google/genai/types/File.java | 2 ++ .../java/com/google/genai/types/FileData.java | 2 ++ .../com/google/genai/types/FileSource.java | 4 +++ .../com/google/genai/types/FileState.java | 4 +++ .../com/google/genai/types/FileStatus.java | 2 ++ .../com/google/genai/types/FinishReason.java | 4 +++ .../com/google/genai/types/FunctionCall.java | 2 ++ .../genai/types/FunctionCallingConfig.java | 2 ++ .../types/FunctionCallingConfigMode.java | 4 +++ .../genai/types/FunctionDeclaration.java | 2 ++ .../google/genai/types/FunctionResponse.java | 2 ++ .../types/FunctionResponseScheduling.java | 4 +++ .../genai/types/GeminiPreferenceExample.java | 2 ++ .../GeminiPreferenceExampleCompletion.java | 2 ++ .../genai/types/GenerateContentConfig.java | 2 ++ .../types/GenerateContentParameters.java | 2 ++ .../genai/types/GenerateContentResponse.java | 2 ++ ...GenerateContentResponsePromptFeedback.java | 2 ++ .../GenerateContentResponseUsageMetadata.java | 2 ++ .../genai/types/GenerateImagesConfig.java | 2 ++ .../genai/types/GenerateImagesParameters.java | 2 ++ .../genai/types/GenerateImagesResponse.java | 2 ++ .../genai/types/GenerateVideosConfig.java | 2 ++ .../genai/types/GenerateVideosOperation.java | 2 ++ .../genai/types/GenerateVideosParameters.java | 2 ++ .../genai/types/GenerateVideosResponse.java | 2 ++ .../google/genai/types/GeneratedImage.java | 2 ++ .../google/genai/types/GeneratedVideo.java | 2 ++ .../google/genai/types/GenerationConfig.java | 2 ++ .../types/GenerationConfigRoutingConfig.java | 2 ++ ...ionConfigRoutingConfigAutoRoutingMode.java | 2 ++ ...nConfigRoutingConfigManualRoutingMode.java | 2 ++ .../types/GenerationConfigThinkingConfig.java | 2 ++ .../google/genai/types/GetBatchJobConfig.java | 2 ++ .../genai/types/GetBatchJobParameters.java | 2 ++ .../genai/types/GetCachedContentConfig.java | 2 ++ .../types/GetCachedContentParameters.java | 2 ++ .../com/google/genai/types/GetFileConfig.java | 2 ++ .../google/genai/types/GetFileParameters.java | 2 ++ .../google/genai/types/GetModelConfig.java | 2 ++ .../genai/types/GetModelParameters.java | 2 ++ .../genai/types/GetOperationConfig.java | 2 ++ .../genai/types/GetOperationParameters.java | 2 ++ .../genai/types/GetTuningJobConfig.java | 2 ++ .../genai/types/GetTuningJobParameters.java | 2 ++ .../com/google/genai/types/GoogleMaps.java | 2 ++ .../google/genai/types/GoogleRpcStatus.java | 2 ++ .../com/google/genai/types/GoogleSearch.java | 2 ++ .../genai/types/GoogleSearchRetrieval.java | 2 ++ .../google/genai/types/GoogleTypeDate.java | 2 ++ .../google/genai/types/GroundingChunk.java | 2 ++ .../genai/types/GroundingChunkMaps.java | 2 ++ .../GroundingChunkMapsPlaceAnswerSources.java | 2 ++ ...psPlaceAnswerSourcesAuthorAttribution.java | 2 ++ ...nkMapsPlaceAnswerSourcesReviewSnippet.java | 2 ++ .../types/GroundingChunkRetrievedContext.java | 2 ++ .../google/genai/types/GroundingChunkWeb.java | 2 ++ .../google/genai/types/GroundingMetadata.java | 2 ++ .../google/genai/types/GroundingSupport.java | 2 ++ .../google/genai/types/HarmBlockMethod.java | 4 +++ .../genai/types/HarmBlockThreshold.java | 4 +++ .../com/google/genai/types/HarmCategory.java | 4 +++ .../google/genai/types/HarmProbability.java | 4 +++ .../com/google/genai/types/HarmSeverity.java | 4 +++ .../com/google/genai/types/HttpOptions.java | 2 ++ .../com/google/genai/types/HttpResponse.java | 2 ++ .../java/com/google/genai/types/Image.java | 2 ++ .../genai/types/ImagePromptLanguage.java | 4 +++ .../google/genai/types/InlinedRequest.java | 2 ++ .../google/genai/types/InlinedResponse.java | 2 ++ .../java/com/google/genai/types/Interval.java | 2 ++ .../java/com/google/genai/types/JobError.java | 2 ++ .../java/com/google/genai/types/JobState.java | 4 +++ .../java/com/google/genai/types/Language.java | 4 +++ .../java/com/google/genai/types/LatLng.java | 2 ++ .../genai/types/ListBatchJobsConfig.java | 2 ++ .../genai/types/ListBatchJobsParameters.java | 2 ++ .../genai/types/ListBatchJobsResponse.java | 2 ++ .../genai/types/ListCachedContentsConfig.java | 2 ++ .../types/ListCachedContentsParameters.java | 2 ++ .../types/ListCachedContentsResponse.java | 2 ++ .../google/genai/types/ListFilesConfig.java | 2 ++ .../genai/types/ListFilesParameters.java | 2 ++ .../google/genai/types/ListFilesResponse.java | 2 ++ .../google/genai/types/ListModelsConfig.java | 2 ++ .../genai/types/ListModelsParameters.java | 2 ++ .../genai/types/ListModelsResponse.java | 2 ++ .../genai/types/ListTuningJobsConfig.java | 2 ++ .../genai/types/ListTuningJobsParameters.java | 2 ++ .../genai/types/ListTuningJobsResponse.java | 2 ++ .../google/genai/types/LiveClientContent.java | 2 ++ .../google/genai/types/LiveClientMessage.java | 2 ++ .../genai/types/LiveClientRealtimeInput.java | 2 ++ .../google/genai/types/LiveClientSetup.java | 2 ++ .../genai/types/LiveClientToolResponse.java | 2 ++ .../google/genai/types/LiveConnectConfig.java | 2 ++ .../genai/types/LiveConnectConstraints.java | 2 ++ .../genai/types/LiveConnectParameters.java | 2 ++ .../LiveSendClientContentParameters.java | 2 ++ .../LiveSendRealtimeInputParameters.java | 2 ++ .../types/LiveSendToolResponseParameters.java | 2 ++ .../google/genai/types/LiveServerContent.java | 2 ++ .../google/genai/types/LiveServerGoAway.java | 2 ++ .../google/genai/types/LiveServerMessage.java | 2 ++ .../LiveServerSessionResumptionUpdate.java | 2 ++ .../genai/types/LiveServerSetupComplete.java | 2 ++ .../genai/types/LiveServerToolCall.java | 2 ++ .../types/LiveServerToolCallCancellation.java | 2 ++ .../google/genai/types/LogprobsResult.java | 2 ++ .../genai/types/LogprobsResultCandidate.java | 2 ++ .../types/LogprobsResultTopCandidates.java | 2 ++ .../genai/types/MaskReferenceConfig.java | 2 ++ .../genai/types/MaskReferenceImage.java | 2 ++ .../google/genai/types/MaskReferenceMode.java | 4 +++ .../com/google/genai/types/MediaModality.java | 4 +++ .../google/genai/types/MediaResolution.java | 4 +++ .../java/com/google/genai/types/Modality.java | 4 +++ .../genai/types/ModalityTokenCount.java | 2 ++ .../java/com/google/genai/types/Mode.java | 4 +++ .../java/com/google/genai/types/Model.java | 2 ++ .../genai/types/ModelRoutingPreference.java | 4 +++ .../genai/types/ModelSelectionConfig.java | 2 ++ .../genai/types/MultiSpeakerVoiceConfig.java | 2 ++ .../java/com/google/genai/types/Outcome.java | 4 +++ .../java/com/google/genai/types/Part.java | 2 ++ .../genai/types/PartnerModelTuningSpec.java | 2 ++ .../google/genai/types/PersonGeneration.java | 4 +++ .../com/google/genai/types/PreTunedModel.java | 2 ++ .../genai/types/PrebuiltVoiceConfig.java | 2 ++ .../PreferenceOptimizationDataStats.java | 2 ++ ...PreferenceOptimizationHyperParameters.java | 2 ++ .../types/PreferenceOptimizationSpec.java | 2 ++ .../google/genai/types/ProactivityConfig.java | 2 ++ .../com/google/genai/types/ProductImage.java | 2 ++ .../java/com/google/genai/types/RagChunk.java | 2 ++ .../google/genai/types/RagChunkPageSpan.java | 2 ++ .../genai/types/RagRetrievalConfig.java | 2 ++ .../genai/types/RagRetrievalConfigFilter.java | 2 ++ .../types/RagRetrievalConfigHybridSearch.java | 2 ++ .../types/RagRetrievalConfigRanking.java | 2 ++ .../RagRetrievalConfigRankingLlmRanker.java | 2 ++ .../RagRetrievalConfigRankingRankService.java | 2 ++ .../google/genai/types/RawReferenceImage.java | 2 ++ .../genai/types/RealtimeInputConfig.java | 2 ++ .../genai/types/RecontextImageConfig.java | 2 ++ .../genai/types/RecontextImageParameters.java | 2 ++ .../genai/types/RecontextImageResponse.java | 2 ++ .../genai/types/RecontextImageSource.java | 2 ++ .../google/genai/types/ReferenceImageAPI.java | 2 ++ .../com/google/genai/types/ReplayFile.java | 2 ++ .../google/genai/types/ReplayInteraction.java | 2 ++ .../com/google/genai/types/ReplayRequest.java | 2 ++ .../google/genai/types/ReplayResponse.java | 2 ++ .../com/google/genai/types/Retrieval.java | 2 ++ .../google/genai/types/RetrievalConfig.java | 2 ++ .../google/genai/types/RetrievalMetadata.java | 2 ++ .../google/genai/types/SafetyAttributes.java | 2 ++ .../google/genai/types/SafetyFilterLevel.java | 4 +++ .../com/google/genai/types/SafetyRating.java | 2 ++ .../com/google/genai/types/SafetySetting.java | 2 ++ .../java/com/google/genai/types/Schema.java | 2 ++ .../google/genai/types/SearchEntryPoint.java | 2 ++ .../java/com/google/genai/types/Segment.java | 2 ++ .../genai/types/SessionResumptionConfig.java | 2 ++ .../com/google/genai/types/SlidingWindow.java | 2 ++ .../genai/types/SpeakerVoiceConfig.java | 2 ++ .../com/google/genai/types/SpeechConfig.java | 2 ++ .../google/genai/types/StartSensitivity.java | 4 +++ .../genai/types/StyleReferenceConfig.java | 2 ++ .../genai/types/StyleReferenceImage.java | 2 ++ .../genai/types/SubjectReferenceConfig.java | 2 ++ .../genai/types/SubjectReferenceImage.java | 2 ++ .../genai/types/SubjectReferenceType.java | 4 +++ .../types/SupervisedHyperParameters.java | 2 ++ .../types/SupervisedTuningDataStats.java | 2 ++ .../SupervisedTuningDatasetDistribution.java | 2 ++ ...uningDatasetDistributionDatasetBucket.java | 2 ++ .../genai/types/SupervisedTuningSpec.java | 2 ++ .../com/google/genai/types/TestTableFile.java | 2 ++ .../com/google/genai/types/TestTableItem.java | 2 ++ .../google/genai/types/ThinkingConfig.java | 2 ++ .../com/google/genai/types/TokensInfo.java | 2 ++ .../java/com/google/genai/types/Tool.java | 2 ++ .../google/genai/types/ToolCodeExecution.java | 2 ++ .../google/genai/types/ToolComputerUse.java | 2 ++ .../com/google/genai/types/ToolConfig.java | 2 ++ .../com/google/genai/types/TrafficType.java | 4 +++ .../com/google/genai/types/Transcription.java | 2 ++ .../com/google/genai/types/TunedModel.java | 2 ++ .../genai/types/TunedModelCheckpoint.java | 2 ++ .../google/genai/types/TunedModelInfo.java | 2 ++ .../google/genai/types/TuningDataStats.java | 2 ++ .../com/google/genai/types/TuningDataset.java | 2 ++ .../com/google/genai/types/TuningExample.java | 2 ++ .../com/google/genai/types/TuningJob.java | 2 ++ .../com/google/genai/types/TuningMode.java | 4 +++ .../google/genai/types/TuningOperation.java | 2 ++ .../com/google/genai/types/TuningTask.java | 4 +++ .../genai/types/TuningValidationDataset.java | 2 ++ .../com/google/genai/types/TurnCoverage.java | 4 +++ .../java/com/google/genai/types/Type.java | 4 +++ .../types/UpdateCachedContentConfig.java | 2 ++ .../types/UpdateCachedContentParameters.java | 2 ++ .../google/genai/types/UpdateModelConfig.java | 2 ++ .../genai/types/UpdateModelParameters.java | 2 ++ .../google/genai/types/UploadFileConfig.java | 2 ++ .../genai/types/UpscaleImageAPIConfig.java | 2 ++ .../types/UpscaleImageAPIParameters.java | 2 ++ .../genai/types/UpscaleImageConfig.java | 2 ++ .../genai/types/UpscaleImageParameters.java | 2 ++ .../genai/types/UpscaleImageResponse.java | 2 ++ .../com/google/genai/types/UrlContext.java | 2 ++ .../genai/types/UrlContextMetadata.java | 2 ++ .../com/google/genai/types/UrlMetadata.java | 2 ++ .../genai/types/UrlRetrievalStatus.java | 4 +++ .../com/google/genai/types/UsageMetadata.java | 2 ++ .../genai/types/VeoHyperParameters.java | 2 ++ .../com/google/genai/types/VeoTuningSpec.java | 2 ++ .../google/genai/types/VertexAISearch.java | 2 ++ .../types/VertexAISearchDataStoreSpec.java | 2 ++ .../google/genai/types/VertexRagStore.java | 2 ++ .../types/VertexRagStoreRagResource.java | 2 ++ .../java/com/google/genai/types/Video.java | 2 ++ .../genai/types/VideoCompressionQuality.java | 4 +++ .../com/google/genai/types/VideoMetadata.java | 2 ++ .../com/google/genai/types/VoiceConfig.java | 2 ++ 326 files changed, 767 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/google/genai/types/ExcludeFromGeneratedCoverageReport.java diff --git a/pom.xml b/pom.xml index 6aec20651eb..8a9c7eec80d 100644 --- a/pom.xml +++ b/pom.xml @@ -366,8 +366,8 @@ INSTRUCTION COVEREDRATIO - - 0.30 + + 0.40 diff --git a/src/main/java/com/google/genai/types/ActivityEnd.java b/src/main/java/com/google/genai/types/ActivityEnd.java index 98778d34ba4..24446b34a68 100644 --- a/src/main/java/com/google/genai/types/ActivityEnd.java +++ b/src/main/java/com/google/genai/types/ActivityEnd.java @@ -32,6 +32,7 @@ @JsonDeserialize(builder = ActivityEnd.Builder.class) public abstract class ActivityEnd extends JsonSerializable { /** Instantiates a builder for ActivityEnd. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ActivityEnd.Builder(); } @@ -52,6 +53,7 @@ private static Builder create() { } /** Deserializes a JSON string to a ActivityEnd object. */ + @ExcludeFromGeneratedCoverageReport public static ActivityEnd fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ActivityEnd.class); } diff --git a/src/main/java/com/google/genai/types/ActivityHandling.java b/src/main/java/com/google/genai/types/ActivityHandling.java index 1f14255254e..d2c39aacfac 100644 --- a/src/main/java/com/google/genai/types/ActivityHandling.java +++ b/src/main/java/com/google/genai/types/ActivityHandling.java @@ -64,12 +64,14 @@ public ActivityHandling(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -96,6 +98,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.activityHandlingEnum != Known.ACTIVITY_HANDLING_UNSPECIFIED) { @@ -105,6 +108,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.activityHandlingEnum; } diff --git a/src/main/java/com/google/genai/types/ActivityStart.java b/src/main/java/com/google/genai/types/ActivityStart.java index 7945ad51cdd..1686db78195 100644 --- a/src/main/java/com/google/genai/types/ActivityStart.java +++ b/src/main/java/com/google/genai/types/ActivityStart.java @@ -32,6 +32,7 @@ @JsonDeserialize(builder = ActivityStart.Builder.class) public abstract class ActivityStart extends JsonSerializable { /** Instantiates a builder for ActivityStart. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ActivityStart.Builder(); } @@ -52,6 +53,7 @@ private static Builder create() { } /** Deserializes a JSON string to a ActivityStart object. */ + @ExcludeFromGeneratedCoverageReport public static ActivityStart fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ActivityStart.class); } diff --git a/src/main/java/com/google/genai/types/AdapterSize.java b/src/main/java/com/google/genai/types/AdapterSize.java index fa47b3d31e6..6117aa00336 100644 --- a/src/main/java/com/google/genai/types/AdapterSize.java +++ b/src/main/java/com/google/genai/types/AdapterSize.java @@ -72,12 +72,14 @@ public AdapterSize(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -104,6 +106,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.adapterSizeEnum != Known.ADAPTER_SIZE_UNSPECIFIED) { @@ -113,6 +116,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.adapterSizeEnum; } diff --git a/src/main/java/com/google/genai/types/ApiAuth.java b/src/main/java/com/google/genai/types/ApiAuth.java index 2ae9cc777e3..e67d1c91d4e 100644 --- a/src/main/java/com/google/genai/types/ApiAuth.java +++ b/src/main/java/com/google/genai/types/ApiAuth.java @@ -37,6 +37,7 @@ public abstract class ApiAuth extends JsonSerializable { public abstract Optional apiKeyConfig(); /** Instantiates a builder for ApiAuth. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ApiAuth.Builder(); } @@ -74,6 +75,7 @@ public Builder apiKeyConfig(ApiAuthApiKeyConfig.Builder apiKeyConfigBuilder) { } /** Deserializes a JSON string to a ApiAuth object. */ + @ExcludeFromGeneratedCoverageReport public static ApiAuth fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ApiAuth.class); } diff --git a/src/main/java/com/google/genai/types/ApiAuthApiKeyConfig.java b/src/main/java/com/google/genai/types/ApiAuthApiKeyConfig.java index 2211294f2d8..4408a0e9910 100644 --- a/src/main/java/com/google/genai/types/ApiAuthApiKeyConfig.java +++ b/src/main/java/com/google/genai/types/ApiAuthApiKeyConfig.java @@ -41,6 +41,7 @@ public abstract class ApiAuthApiKeyConfig extends JsonSerializable { public abstract Optional apiKeyString(); /** Instantiates a builder for ApiAuthApiKeyConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ApiAuthApiKeyConfig.Builder(); } @@ -78,6 +79,7 @@ private static Builder create() { } /** Deserializes a JSON string to a ApiAuthApiKeyConfig object. */ + @ExcludeFromGeneratedCoverageReport public static ApiAuthApiKeyConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ApiAuthApiKeyConfig.class); } diff --git a/src/main/java/com/google/genai/types/ApiKeyConfig.java b/src/main/java/com/google/genai/types/ApiKeyConfig.java index 6ffd2019679..d8c1cb63433 100644 --- a/src/main/java/com/google/genai/types/ApiKeyConfig.java +++ b/src/main/java/com/google/genai/types/ApiKeyConfig.java @@ -34,6 +34,7 @@ public abstract class ApiKeyConfig extends JsonSerializable { public abstract Optional apiKeyString(); /** Instantiates a builder for ApiKeyConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ApiKeyConfig.Builder(); } @@ -62,6 +63,7 @@ private static Builder create() { } /** Deserializes a JSON string to a ApiKeyConfig object. */ + @ExcludeFromGeneratedCoverageReport public static ApiKeyConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ApiKeyConfig.class); } diff --git a/src/main/java/com/google/genai/types/ApiSpec.java b/src/main/java/com/google/genai/types/ApiSpec.java index 17283d5724c..4fd336b8917 100644 --- a/src/main/java/com/google/genai/types/ApiSpec.java +++ b/src/main/java/com/google/genai/types/ApiSpec.java @@ -60,12 +60,14 @@ public ApiSpec(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -92,6 +94,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.apiSpecEnum != Known.API_SPEC_UNSPECIFIED) { @@ -101,6 +104,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.apiSpecEnum; } diff --git a/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java b/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java index a444bcea7f3..61a54d4c9db 100644 --- a/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java +++ b/src/main/java/com/google/genai/types/AudioTranscriptionConfig.java @@ -28,6 +28,7 @@ @JsonDeserialize(builder = AudioTranscriptionConfig.Builder.class) public abstract class AudioTranscriptionConfig extends JsonSerializable { /** Instantiates a builder for AudioTranscriptionConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_AudioTranscriptionConfig.Builder(); } @@ -48,6 +49,7 @@ private static Builder create() { } /** Deserializes a JSON string to a AudioTranscriptionConfig object. */ + @ExcludeFromGeneratedCoverageReport public static AudioTranscriptionConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, AudioTranscriptionConfig.class); } diff --git a/src/main/java/com/google/genai/types/AuthConfig.java b/src/main/java/com/google/genai/types/AuthConfig.java index eec5deb5f22..d2cb708191f 100644 --- a/src/main/java/com/google/genai/types/AuthConfig.java +++ b/src/main/java/com/google/genai/types/AuthConfig.java @@ -55,6 +55,7 @@ public abstract class AuthConfig extends JsonSerializable { public abstract Optional oidcConfig(); /** Instantiates a builder for AuthConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_AuthConfig.Builder(); } @@ -191,6 +192,7 @@ public Builder oidcConfig(AuthConfigOidcConfig.Builder oidcConfigBuilder) { } /** Deserializes a JSON string to a AuthConfig object. */ + @ExcludeFromGeneratedCoverageReport public static AuthConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, AuthConfig.class); } diff --git a/src/main/java/com/google/genai/types/AuthConfigGoogleServiceAccountConfig.java b/src/main/java/com/google/genai/types/AuthConfigGoogleServiceAccountConfig.java index 9bbf124d26f..3785a26ca2b 100644 --- a/src/main/java/com/google/genai/types/AuthConfigGoogleServiceAccountConfig.java +++ b/src/main/java/com/google/genai/types/AuthConfigGoogleServiceAccountConfig.java @@ -41,6 +41,7 @@ public abstract class AuthConfigGoogleServiceAccountConfig extends JsonSerializa public abstract Optional serviceAccount(); /** Instantiates a builder for AuthConfigGoogleServiceAccountConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_AuthConfigGoogleServiceAccountConfig.Builder(); } @@ -77,6 +78,7 @@ private static Builder create() { } /** Deserializes a JSON string to a AuthConfigGoogleServiceAccountConfig object. */ + @ExcludeFromGeneratedCoverageReport public static AuthConfigGoogleServiceAccountConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, AuthConfigGoogleServiceAccountConfig.class); } diff --git a/src/main/java/com/google/genai/types/AuthConfigHttpBasicAuthConfig.java b/src/main/java/com/google/genai/types/AuthConfigHttpBasicAuthConfig.java index 34e55ddf9d8..900b285a4ea 100644 --- a/src/main/java/com/google/genai/types/AuthConfigHttpBasicAuthConfig.java +++ b/src/main/java/com/google/genai/types/AuthConfigHttpBasicAuthConfig.java @@ -40,6 +40,7 @@ public abstract class AuthConfigHttpBasicAuthConfig extends JsonSerializable { public abstract Optional credentialSecret(); /** Instantiates a builder for AuthConfigHttpBasicAuthConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_AuthConfigHttpBasicAuthConfig.Builder(); } @@ -75,6 +76,7 @@ private static Builder create() { } /** Deserializes a JSON string to a AuthConfigHttpBasicAuthConfig object. */ + @ExcludeFromGeneratedCoverageReport public static AuthConfigHttpBasicAuthConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, AuthConfigHttpBasicAuthConfig.class); } diff --git a/src/main/java/com/google/genai/types/AuthConfigOauthConfig.java b/src/main/java/com/google/genai/types/AuthConfigOauthConfig.java index 42082cf4bd6..709f5a29b98 100644 --- a/src/main/java/com/google/genai/types/AuthConfigOauthConfig.java +++ b/src/main/java/com/google/genai/types/AuthConfigOauthConfig.java @@ -47,6 +47,7 @@ public abstract class AuthConfigOauthConfig extends JsonSerializable { public abstract Optional serviceAccount(); /** Instantiates a builder for AuthConfigOauthConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_AuthConfigOauthConfig.Builder(); } @@ -88,6 +89,7 @@ private static Builder create() { } /** Deserializes a JSON string to a AuthConfigOauthConfig object. */ + @ExcludeFromGeneratedCoverageReport public static AuthConfigOauthConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, AuthConfigOauthConfig.class); } diff --git a/src/main/java/com/google/genai/types/AuthConfigOidcConfig.java b/src/main/java/com/google/genai/types/AuthConfigOidcConfig.java index 4f5339f09e6..33ced7433e3 100644 --- a/src/main/java/com/google/genai/types/AuthConfigOidcConfig.java +++ b/src/main/java/com/google/genai/types/AuthConfigOidcConfig.java @@ -49,6 +49,7 @@ public abstract class AuthConfigOidcConfig extends JsonSerializable { public abstract Optional serviceAccount(); /** Instantiates a builder for AuthConfigOidcConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_AuthConfigOidcConfig.Builder(); } @@ -92,6 +93,7 @@ private static Builder create() { } /** Deserializes a JSON string to a AuthConfigOidcConfig object. */ + @ExcludeFromGeneratedCoverageReport public static AuthConfigOidcConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, AuthConfigOidcConfig.class); } diff --git a/src/main/java/com/google/genai/types/AuthType.java b/src/main/java/com/google/genai/types/AuthType.java index 4ac09d48c8a..7f03715507d 100644 --- a/src/main/java/com/google/genai/types/AuthType.java +++ b/src/main/java/com/google/genai/types/AuthType.java @@ -71,12 +71,14 @@ public AuthType(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -103,6 +105,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.authTypeEnum != Known.AUTH_TYPE_UNSPECIFIED) { @@ -112,6 +115,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.authTypeEnum; } diff --git a/src/main/java/com/google/genai/types/AutomaticActivityDetection.java b/src/main/java/com/google/genai/types/AutomaticActivityDetection.java index 17f587ea59b..cd381f2aec6 100644 --- a/src/main/java/com/google/genai/types/AutomaticActivityDetection.java +++ b/src/main/java/com/google/genai/types/AutomaticActivityDetection.java @@ -62,6 +62,7 @@ public abstract class AutomaticActivityDetection extends JsonSerializable { public abstract Optional silenceDurationMs(); /** Instantiates a builder for AutomaticActivityDetection. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_AutomaticActivityDetection.Builder(); } @@ -168,6 +169,7 @@ public Builder endOfSpeechSensitivity(String endOfSpeechSensitivity) { } /** Deserializes a JSON string to a AutomaticActivityDetection object. */ + @ExcludeFromGeneratedCoverageReport public static AutomaticActivityDetection fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, AutomaticActivityDetection.class); } diff --git a/src/main/java/com/google/genai/types/AutomaticFunctionCallingConfig.java b/src/main/java/com/google/genai/types/AutomaticFunctionCallingConfig.java index e161a75f312..252e8df5c31 100644 --- a/src/main/java/com/google/genai/types/AutomaticFunctionCallingConfig.java +++ b/src/main/java/com/google/genai/types/AutomaticFunctionCallingConfig.java @@ -53,6 +53,7 @@ public abstract class AutomaticFunctionCallingConfig extends JsonSerializable { public abstract Optional ignoreCallHistory(); /** Instantiates a builder for AutomaticFunctionCallingConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_AutomaticFunctionCallingConfig.Builder(); } @@ -104,6 +105,7 @@ private static Builder create() { } /** Deserializes a JSON string to a AutomaticFunctionCallingConfig object. */ + @ExcludeFromGeneratedCoverageReport public static AutomaticFunctionCallingConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, AutomaticFunctionCallingConfig.class); } diff --git a/src/main/java/com/google/genai/types/BatchJob.java b/src/main/java/com/google/genai/types/BatchJob.java index 87f829a4d70..b4394be60fc 100644 --- a/src/main/java/com/google/genai/types/BatchJob.java +++ b/src/main/java/com/google/genai/types/BatchJob.java @@ -78,6 +78,7 @@ public abstract class BatchJob extends JsonSerializable { public abstract Optional dest(); /** Instantiates a builder for BatchJob. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_BatchJob.Builder(); } @@ -236,6 +237,7 @@ public Builder dest(BatchJobDestination.Builder destBuilder) { } /** Deserializes a JSON string to a BatchJob object. */ + @ExcludeFromGeneratedCoverageReport public static BatchJob fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, BatchJob.class); } diff --git a/src/main/java/com/google/genai/types/BatchJobDestination.java b/src/main/java/com/google/genai/types/BatchJobDestination.java index 49c7f2933df..7ca1aa5f968 100644 --- a/src/main/java/com/google/genai/types/BatchJobDestination.java +++ b/src/main/java/com/google/genai/types/BatchJobDestination.java @@ -62,6 +62,7 @@ public abstract class BatchJobDestination extends JsonSerializable { public abstract Optional> inlinedResponses(); /** Instantiates a builder for BatchJobDestination. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_BatchJobDestination.Builder(); } @@ -149,6 +150,7 @@ public Builder inlinedResponses(InlinedResponse.Builder... inlinedResponsesBuild } /** Deserializes a JSON string to a BatchJobDestination object. */ + @ExcludeFromGeneratedCoverageReport public static BatchJobDestination fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, BatchJobDestination.class); } diff --git a/src/main/java/com/google/genai/types/BatchJobSource.java b/src/main/java/com/google/genai/types/BatchJobSource.java index d56d3f69011..d45dd9e196b 100644 --- a/src/main/java/com/google/genai/types/BatchJobSource.java +++ b/src/main/java/com/google/genai/types/BatchJobSource.java @@ -54,6 +54,7 @@ public abstract class BatchJobSource extends JsonSerializable { public abstract Optional> inlinedRequests(); /** Instantiates a builder for BatchJobSource. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_BatchJobSource.Builder(); } @@ -145,6 +146,7 @@ public Builder inlinedRequests(InlinedRequest.Builder... inlinedRequestsBuilders } /** Deserializes a JSON string to a BatchJobSource object. */ + @ExcludeFromGeneratedCoverageReport public static BatchJobSource fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, BatchJobSource.class); } diff --git a/src/main/java/com/google/genai/types/Behavior.java b/src/main/java/com/google/genai/types/Behavior.java index baff1526f3f..4b043a4484e 100644 --- a/src/main/java/com/google/genai/types/Behavior.java +++ b/src/main/java/com/google/genai/types/Behavior.java @@ -69,12 +69,14 @@ public Behavior(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -101,6 +103,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.behaviorEnum != Known.BEHAVIOR_UNSPECIFIED) { @@ -110,6 +113,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.behaviorEnum; } diff --git a/src/main/java/com/google/genai/types/Blob.java b/src/main/java/com/google/genai/types/Blob.java index 923319396c5..5de616bfb2d 100644 --- a/src/main/java/com/google/genai/types/Blob.java +++ b/src/main/java/com/google/genai/types/Blob.java @@ -45,6 +45,7 @@ public abstract class Blob extends JsonSerializable { public abstract Optional mimeType(); /** Instantiates a builder for Blob. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_Blob.Builder(); } @@ -90,6 +91,7 @@ private static Builder create() { } /** Deserializes a JSON string to a Blob object. */ + @ExcludeFromGeneratedCoverageReport public static Blob fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, Blob.class); } diff --git a/src/main/java/com/google/genai/types/BlockedReason.java b/src/main/java/com/google/genai/types/BlockedReason.java index fc652ee35d9..cf06e14b5e5 100644 --- a/src/main/java/com/google/genai/types/BlockedReason.java +++ b/src/main/java/com/google/genai/types/BlockedReason.java @@ -69,12 +69,14 @@ public BlockedReason(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -101,6 +103,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.blockedReasonEnum != Known.BLOCKED_REASON_UNSPECIFIED) { @@ -110,6 +113,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.blockedReasonEnum; } diff --git a/src/main/java/com/google/genai/types/CachedContent.java b/src/main/java/com/google/genai/types/CachedContent.java index dfc6ba16ba6..0072b18ddad 100644 --- a/src/main/java/com/google/genai/types/CachedContent.java +++ b/src/main/java/com/google/genai/types/CachedContent.java @@ -59,6 +59,7 @@ public abstract class CachedContent extends JsonSerializable { public abstract Optional usageMetadata(); /** Instantiates a builder for CachedContent. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CachedContent.Builder(); } @@ -144,6 +145,7 @@ public Builder usageMetadata(CachedContentUsageMetadata.Builder usageMetadataBui } /** Deserializes a JSON string to a CachedContent object. */ + @ExcludeFromGeneratedCoverageReport public static CachedContent fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CachedContent.class); } diff --git a/src/main/java/com/google/genai/types/CachedContentUsageMetadata.java b/src/main/java/com/google/genai/types/CachedContentUsageMetadata.java index d9d19731ec4..a5a6b7a6dbc 100644 --- a/src/main/java/com/google/genai/types/CachedContentUsageMetadata.java +++ b/src/main/java/com/google/genai/types/CachedContentUsageMetadata.java @@ -50,6 +50,7 @@ public abstract class CachedContentUsageMetadata extends JsonSerializable { public abstract Optional videoDurationSeconds(); /** Instantiates a builder for CachedContentUsageMetadata. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CachedContentUsageMetadata.Builder(); } @@ -110,6 +111,7 @@ private static Builder create() { } /** Deserializes a JSON string to a CachedContentUsageMetadata object. */ + @ExcludeFromGeneratedCoverageReport public static CachedContentUsageMetadata fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CachedContentUsageMetadata.class); } diff --git a/src/main/java/com/google/genai/types/CancelBatchJobConfig.java b/src/main/java/com/google/genai/types/CancelBatchJobConfig.java index 5a06b0cf176..fb3f7e4cd57 100644 --- a/src/main/java/com/google/genai/types/CancelBatchJobConfig.java +++ b/src/main/java/com/google/genai/types/CancelBatchJobConfig.java @@ -34,6 +34,7 @@ public abstract class CancelBatchJobConfig extends JsonSerializable { public abstract Optional httpOptions(); /** Instantiates a builder for CancelBatchJobConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CancelBatchJobConfig.Builder(); } @@ -71,6 +72,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a CancelBatchJobConfig object. */ + @ExcludeFromGeneratedCoverageReport public static CancelBatchJobConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CancelBatchJobConfig.class); } diff --git a/src/main/java/com/google/genai/types/CancelBatchJobParameters.java b/src/main/java/com/google/genai/types/CancelBatchJobParameters.java index 83201a43cdd..a8300c880c7 100644 --- a/src/main/java/com/google/genai/types/CancelBatchJobParameters.java +++ b/src/main/java/com/google/genai/types/CancelBatchJobParameters.java @@ -44,6 +44,7 @@ public abstract class CancelBatchJobParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for CancelBatchJobParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CancelBatchJobParameters.Builder(); } @@ -91,6 +92,7 @@ public Builder config(CancelBatchJobConfig.Builder configBuilder) { } /** Deserializes a JSON string to a CancelBatchJobParameters object. */ + @ExcludeFromGeneratedCoverageReport public static CancelBatchJobParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CancelBatchJobParameters.class); } diff --git a/src/main/java/com/google/genai/types/Candidate.java b/src/main/java/com/google/genai/types/Candidate.java index 22d7e83006b..02ccb9c0399 100644 --- a/src/main/java/com/google/genai/types/Candidate.java +++ b/src/main/java/com/google/genai/types/Candidate.java @@ -85,6 +85,7 @@ public abstract class Candidate extends JsonSerializable { public abstract Optional> safetyRatings(); /** Instantiates a builder for Candidate. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_Candidate.Builder(); } @@ -287,6 +288,7 @@ public Builder safetyRatings(SafetyRating.Builder... safetyRatingsBuilders) { } /** Deserializes a JSON string to a Candidate object. */ + @ExcludeFromGeneratedCoverageReport public static Candidate fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, Candidate.class); } diff --git a/src/main/java/com/google/genai/types/Checkpoint.java b/src/main/java/com/google/genai/types/Checkpoint.java index 41dd53b0256..9cc5bf87d27 100644 --- a/src/main/java/com/google/genai/types/Checkpoint.java +++ b/src/main/java/com/google/genai/types/Checkpoint.java @@ -42,6 +42,7 @@ public abstract class Checkpoint extends JsonSerializable { public abstract Optional step(); /** Instantiates a builder for Checkpoint. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_Checkpoint.Builder(); } @@ -86,6 +87,7 @@ private static Builder create() { } /** Deserializes a JSON string to a Checkpoint object. */ + @ExcludeFromGeneratedCoverageReport public static Checkpoint fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, Checkpoint.class); } diff --git a/src/main/java/com/google/genai/types/Citation.java b/src/main/java/com/google/genai/types/Citation.java index 63c0fa41c3a..9815094c96d 100644 --- a/src/main/java/com/google/genai/types/Citation.java +++ b/src/main/java/com/google/genai/types/Citation.java @@ -54,6 +54,7 @@ public abstract class Citation extends JsonSerializable { public abstract Optional uri(); /** Instantiates a builder for Citation. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_Citation.Builder(); } @@ -131,6 +132,7 @@ public Builder publicationDate(GoogleTypeDate.Builder publicationDateBuilder) { } /** Deserializes a JSON string to a Citation object. */ + @ExcludeFromGeneratedCoverageReport public static Citation fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, Citation.class); } diff --git a/src/main/java/com/google/genai/types/CitationMetadata.java b/src/main/java/com/google/genai/types/CitationMetadata.java index 701e9e70554..d0ac71aa954 100644 --- a/src/main/java/com/google/genai/types/CitationMetadata.java +++ b/src/main/java/com/google/genai/types/CitationMetadata.java @@ -41,6 +41,7 @@ public abstract class CitationMetadata extends JsonSerializable { public abstract Optional> citations(); /** Instantiates a builder for CitationMetadata. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CitationMetadata.Builder(); } @@ -93,6 +94,7 @@ public Builder citations(Citation.Builder... citationsBuilders) { } /** Deserializes a JSON string to a CitationMetadata object. */ + @ExcludeFromGeneratedCoverageReport public static CitationMetadata fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CitationMetadata.class); } diff --git a/src/main/java/com/google/genai/types/ClientOptions.java b/src/main/java/com/google/genai/types/ClientOptions.java index 8157b162225..245d93d9d1a 100644 --- a/src/main/java/com/google/genai/types/ClientOptions.java +++ b/src/main/java/com/google/genai/types/ClientOptions.java @@ -38,6 +38,7 @@ public abstract class ClientOptions extends JsonSerializable { public abstract Optional maxConnectionsPerHost(); /** Instantiates a builder for ClientOptions. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ClientOptions.Builder(); } @@ -74,6 +75,7 @@ private static Builder create() { } /** Deserializes a JSON string to a ClientOptions object. */ + @ExcludeFromGeneratedCoverageReport public static ClientOptions fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ClientOptions.class); } diff --git a/src/main/java/com/google/genai/types/CodeExecutionResult.java b/src/main/java/com/google/genai/types/CodeExecutionResult.java index 2907684badd..433267c12e5 100644 --- a/src/main/java/com/google/genai/types/CodeExecutionResult.java +++ b/src/main/java/com/google/genai/types/CodeExecutionResult.java @@ -45,6 +45,7 @@ public abstract class CodeExecutionResult extends JsonSerializable { public abstract Optional output(); /** Instantiates a builder for CodeExecutionResult. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CodeExecutionResult.Builder(); } @@ -102,6 +103,7 @@ public Builder outcome(String outcome) { } /** Deserializes a JSON string to a CodeExecutionResult object. */ + @ExcludeFromGeneratedCoverageReport public static CodeExecutionResult fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CodeExecutionResult.class); } diff --git a/src/main/java/com/google/genai/types/ComputeTokensConfig.java b/src/main/java/com/google/genai/types/ComputeTokensConfig.java index 6db60ccd1d9..b27800d6c77 100644 --- a/src/main/java/com/google/genai/types/ComputeTokensConfig.java +++ b/src/main/java/com/google/genai/types/ComputeTokensConfig.java @@ -34,6 +34,7 @@ public abstract class ComputeTokensConfig extends JsonSerializable { public abstract Optional httpOptions(); /** Instantiates a builder for ComputeTokensConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ComputeTokensConfig.Builder(); } @@ -71,6 +72,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a ComputeTokensConfig object. */ + @ExcludeFromGeneratedCoverageReport public static ComputeTokensConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ComputeTokensConfig.class); } diff --git a/src/main/java/com/google/genai/types/ComputeTokensParameters.java b/src/main/java/com/google/genai/types/ComputeTokensParameters.java index b0c02b9970a..ec789b07dc1 100644 --- a/src/main/java/com/google/genai/types/ComputeTokensParameters.java +++ b/src/main/java/com/google/genai/types/ComputeTokensParameters.java @@ -51,6 +51,7 @@ public abstract class ComputeTokensParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for ComputeTokensParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ComputeTokensParameters.Builder(); } @@ -126,6 +127,7 @@ public Builder config(ComputeTokensConfig.Builder configBuilder) { } /** Deserializes a JSON string to a ComputeTokensParameters object. */ + @ExcludeFromGeneratedCoverageReport public static ComputeTokensParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ComputeTokensParameters.class); } diff --git a/src/main/java/com/google/genai/types/ComputeTokensResponse.java b/src/main/java/com/google/genai/types/ComputeTokensResponse.java index 60caed0e736..12d98eda999 100644 --- a/src/main/java/com/google/genai/types/ComputeTokensResponse.java +++ b/src/main/java/com/google/genai/types/ComputeTokensResponse.java @@ -42,6 +42,7 @@ public abstract class ComputeTokensResponse extends JsonSerializable { public abstract Optional> tokensInfo(); /** Instantiates a builder for ComputeTokensResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ComputeTokensResponse.Builder(); } @@ -97,6 +98,7 @@ public Builder tokensInfo(TokensInfo.Builder... tokensInfoBuilders) { } /** Deserializes a JSON string to a ComputeTokensResponse object. */ + @ExcludeFromGeneratedCoverageReport public static ComputeTokensResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ComputeTokensResponse.class); } diff --git a/src/main/java/com/google/genai/types/Content.java b/src/main/java/com/google/genai/types/Content.java index 3e6229cb1bf..a1148d9591d 100644 --- a/src/main/java/com/google/genai/types/Content.java +++ b/src/main/java/com/google/genai/types/Content.java @@ -51,6 +51,7 @@ public abstract class Content extends JsonSerializable { public abstract Optional role(); /** Instantiates a builder for Content. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_Content.Builder(); } @@ -113,6 +114,7 @@ public Builder parts(Part.Builder... partsBuilders) { } /** Deserializes a JSON string to a Content object. */ + @ExcludeFromGeneratedCoverageReport public static Content fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, Content.class); } diff --git a/src/main/java/com/google/genai/types/ContentEmbedding.java b/src/main/java/com/google/genai/types/ContentEmbedding.java index 9dc43169795..be2bbd049c9 100644 --- a/src/main/java/com/google/genai/types/ContentEmbedding.java +++ b/src/main/java/com/google/genai/types/ContentEmbedding.java @@ -40,6 +40,7 @@ public abstract class ContentEmbedding extends JsonSerializable { public abstract Optional statistics(); /** Instantiates a builder for ContentEmbedding. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ContentEmbedding.Builder(); } @@ -94,6 +95,7 @@ public Builder statistics(ContentEmbeddingStatistics.Builder statisticsBuilder) } /** Deserializes a JSON string to a ContentEmbedding object. */ + @ExcludeFromGeneratedCoverageReport public static ContentEmbedding fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ContentEmbedding.class); } diff --git a/src/main/java/com/google/genai/types/ContentEmbeddingStatistics.java b/src/main/java/com/google/genai/types/ContentEmbeddingStatistics.java index 32e37344c02..6440a3eb4dc 100644 --- a/src/main/java/com/google/genai/types/ContentEmbeddingStatistics.java +++ b/src/main/java/com/google/genai/types/ContentEmbeddingStatistics.java @@ -41,6 +41,7 @@ public abstract class ContentEmbeddingStatistics extends JsonSerializable { public abstract Optional tokenCount(); /** Instantiates a builder for ContentEmbeddingStatistics. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ContentEmbeddingStatistics.Builder(); } @@ -78,6 +79,7 @@ private static Builder create() { } /** Deserializes a JSON string to a ContentEmbeddingStatistics object. */ + @ExcludeFromGeneratedCoverageReport public static ContentEmbeddingStatistics fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ContentEmbeddingStatistics.class); } diff --git a/src/main/java/com/google/genai/types/ContextWindowCompressionConfig.java b/src/main/java/com/google/genai/types/ContextWindowCompressionConfig.java index 0534b206b5a..594aaf57518 100644 --- a/src/main/java/com/google/genai/types/ContextWindowCompressionConfig.java +++ b/src/main/java/com/google/genai/types/ContextWindowCompressionConfig.java @@ -41,6 +41,7 @@ public abstract class ContextWindowCompressionConfig extends JsonSerializable { public abstract Optional slidingWindow(); /** Instantiates a builder for ContextWindowCompressionConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ContextWindowCompressionConfig.Builder(); } @@ -89,6 +90,7 @@ public Builder slidingWindow(SlidingWindow.Builder slidingWindowBuilder) { } /** Deserializes a JSON string to a ContextWindowCompressionConfig object. */ + @ExcludeFromGeneratedCoverageReport public static ContextWindowCompressionConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ContextWindowCompressionConfig.class); } diff --git a/src/main/java/com/google/genai/types/ControlReferenceConfig.java b/src/main/java/com/google/genai/types/ControlReferenceConfig.java index 698999ca7c7..a8a00f545a7 100644 --- a/src/main/java/com/google/genai/types/ControlReferenceConfig.java +++ b/src/main/java/com/google/genai/types/ControlReferenceConfig.java @@ -42,6 +42,7 @@ public abstract class ControlReferenceConfig extends JsonSerializable { public abstract Optional enableControlImageComputation(); /** Instantiates a builder for ControlReferenceConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ControlReferenceConfig.Builder(); } @@ -100,6 +101,7 @@ public Builder controlType(String controlType) { } /** Deserializes a JSON string to a ControlReferenceConfig object. */ + @ExcludeFromGeneratedCoverageReport public static ControlReferenceConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ControlReferenceConfig.class); } diff --git a/src/main/java/com/google/genai/types/ControlReferenceImage.java b/src/main/java/com/google/genai/types/ControlReferenceImage.java index 9d3cdb920c9..0471d171bf4 100644 --- a/src/main/java/com/google/genai/types/ControlReferenceImage.java +++ b/src/main/java/com/google/genai/types/ControlReferenceImage.java @@ -55,6 +55,7 @@ public abstract class ControlReferenceImage extends JsonSerializable implements public abstract Optional config(); /** Instantiates a builder for ControlReferenceImage. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ControlReferenceImage.Builder(); } @@ -125,6 +126,7 @@ public Builder config(ControlReferenceConfig.Builder configBuilder) { } /** Deserializes a JSON string to a ControlReferenceImage object. */ + @ExcludeFromGeneratedCoverageReport public static ControlReferenceImage fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ControlReferenceImage.class); } diff --git a/src/main/java/com/google/genai/types/ControlReferenceType.java b/src/main/java/com/google/genai/types/ControlReferenceType.java index 6487868075f..ed0c86ebc53 100644 --- a/src/main/java/com/google/genai/types/ControlReferenceType.java +++ b/src/main/java/com/google/genai/types/ControlReferenceType.java @@ -61,12 +61,14 @@ public ControlReferenceType(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -93,6 +95,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.controlReferenceTypeEnum != Known.CONTROL_REFERENCE_TYPE_UNSPECIFIED) { @@ -102,6 +105,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.controlReferenceTypeEnum; } diff --git a/src/main/java/com/google/genai/types/CountTokensConfig.java b/src/main/java/com/google/genai/types/CountTokensConfig.java index 2d24dce46d9..dab32e0f530 100644 --- a/src/main/java/com/google/genai/types/CountTokensConfig.java +++ b/src/main/java/com/google/genai/types/CountTokensConfig.java @@ -56,6 +56,7 @@ public abstract class CountTokensConfig extends JsonSerializable { public abstract Optional generationConfig(); /** Instantiates a builder for CountTokensConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CountTokensConfig.Builder(); } @@ -161,6 +162,7 @@ public Builder generationConfig(GenerationConfig.Builder generationConfigBuilder } /** Deserializes a JSON string to a CountTokensConfig object. */ + @ExcludeFromGeneratedCoverageReport public static CountTokensConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CountTokensConfig.class); } diff --git a/src/main/java/com/google/genai/types/CountTokensParameters.java b/src/main/java/com/google/genai/types/CountTokensParameters.java index 896796e5718..d21e0591958 100644 --- a/src/main/java/com/google/genai/types/CountTokensParameters.java +++ b/src/main/java/com/google/genai/types/CountTokensParameters.java @@ -51,6 +51,7 @@ public abstract class CountTokensParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for CountTokensParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CountTokensParameters.Builder(); } @@ -126,6 +127,7 @@ public Builder config(CountTokensConfig.Builder configBuilder) { } /** Deserializes a JSON string to a CountTokensParameters object. */ + @ExcludeFromGeneratedCoverageReport public static CountTokensParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CountTokensParameters.class); } diff --git a/src/main/java/com/google/genai/types/CountTokensResponse.java b/src/main/java/com/google/genai/types/CountTokensResponse.java index 98c8c228844..a3418db99c2 100644 --- a/src/main/java/com/google/genai/types/CountTokensResponse.java +++ b/src/main/java/com/google/genai/types/CountTokensResponse.java @@ -38,6 +38,7 @@ public abstract class CountTokensResponse extends JsonSerializable { public abstract Optional cachedContentTokenCount(); /** Instantiates a builder for CountTokensResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CountTokensResponse.Builder(); } @@ -75,6 +76,7 @@ private static Builder create() { } /** Deserializes a JSON string to a CountTokensResponse object. */ + @ExcludeFromGeneratedCoverageReport public static CountTokensResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CountTokensResponse.class); } diff --git a/src/main/java/com/google/genai/types/CreateAuthTokenConfig.java b/src/main/java/com/google/genai/types/CreateAuthTokenConfig.java index ec3e81c854c..5260501fb62 100644 --- a/src/main/java/com/google/genai/types/CreateAuthTokenConfig.java +++ b/src/main/java/com/google/genai/types/CreateAuthTokenConfig.java @@ -72,6 +72,7 @@ public abstract class CreateAuthTokenConfig extends JsonSerializable { public abstract Optional> lockAdditionalFields(); /** Instantiates a builder for CreateAuthTokenConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateAuthTokenConfig.Builder(); } @@ -179,6 +180,7 @@ public Builder lockAdditionalFields(String... lockAdditionalFields) { } /** Deserializes a JSON string to a CreateAuthTokenConfig object. */ + @ExcludeFromGeneratedCoverageReport public static CreateAuthTokenConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateAuthTokenConfig.class); } diff --git a/src/main/java/com/google/genai/types/CreateBatchJobConfig.java b/src/main/java/com/google/genai/types/CreateBatchJobConfig.java index 505ecda5e47..5e8a1fcc141 100644 --- a/src/main/java/com/google/genai/types/CreateBatchJobConfig.java +++ b/src/main/java/com/google/genai/types/CreateBatchJobConfig.java @@ -45,6 +45,7 @@ public abstract class CreateBatchJobConfig extends JsonSerializable { public abstract Optional dest(); /** Instantiates a builder for CreateBatchJobConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateBatchJobConfig.Builder(); } @@ -109,6 +110,7 @@ public Builder dest(BatchJobDestination.Builder destBuilder) { } /** Deserializes a JSON string to a CreateBatchJobConfig object. */ + @ExcludeFromGeneratedCoverageReport public static CreateBatchJobConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateBatchJobConfig.class); } diff --git a/src/main/java/com/google/genai/types/CreateBatchJobParameters.java b/src/main/java/com/google/genai/types/CreateBatchJobParameters.java index e5348a0a460..445213a1715 100644 --- a/src/main/java/com/google/genai/types/CreateBatchJobParameters.java +++ b/src/main/java/com/google/genai/types/CreateBatchJobParameters.java @@ -47,6 +47,7 @@ public abstract class CreateBatchJobParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for CreateBatchJobParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateBatchJobParameters.Builder(); } @@ -111,6 +112,7 @@ public Builder config(CreateBatchJobConfig.Builder configBuilder) { } /** Deserializes a JSON string to a CreateBatchJobParameters object. */ + @ExcludeFromGeneratedCoverageReport public static CreateBatchJobParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateBatchJobParameters.class); } diff --git a/src/main/java/com/google/genai/types/CreateCachedContentConfig.java b/src/main/java/com/google/genai/types/CreateCachedContentConfig.java index a161571e3b9..d766c78d906 100644 --- a/src/main/java/com/google/genai/types/CreateCachedContentConfig.java +++ b/src/main/java/com/google/genai/types/CreateCachedContentConfig.java @@ -84,6 +84,7 @@ public abstract class CreateCachedContentConfig extends JsonSerializable { public abstract Optional kmsKeyName(); /** Instantiates a builder for CreateCachedContentConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateCachedContentConfig.Builder(); } @@ -252,6 +253,7 @@ public Builder toolConfig(ToolConfig.Builder toolConfigBuilder) { } /** Deserializes a JSON string to a CreateCachedContentConfig object. */ + @ExcludeFromGeneratedCoverageReport public static CreateCachedContentConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateCachedContentConfig.class); } diff --git a/src/main/java/com/google/genai/types/CreateCachedContentParameters.java b/src/main/java/com/google/genai/types/CreateCachedContentParameters.java index afa0b4bc86e..70ae0d868f9 100644 --- a/src/main/java/com/google/genai/types/CreateCachedContentParameters.java +++ b/src/main/java/com/google/genai/types/CreateCachedContentParameters.java @@ -40,6 +40,7 @@ public abstract class CreateCachedContentParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for CreateCachedContentParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateCachedContentParameters.Builder(); } @@ -87,6 +88,7 @@ public Builder config(CreateCachedContentConfig.Builder configBuilder) { } /** Deserializes a JSON string to a CreateCachedContentParameters object. */ + @ExcludeFromGeneratedCoverageReport public static CreateCachedContentParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateCachedContentParameters.class); } diff --git a/src/main/java/com/google/genai/types/CreateFileConfig.java b/src/main/java/com/google/genai/types/CreateFileConfig.java index 0202c9f4a7b..13b998624fb 100644 --- a/src/main/java/com/google/genai/types/CreateFileConfig.java +++ b/src/main/java/com/google/genai/types/CreateFileConfig.java @@ -38,6 +38,7 @@ public abstract class CreateFileConfig extends JsonSerializable { public abstract Optional shouldReturnHttpResponse(); /** Instantiates a builder for CreateFileConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateFileConfig.Builder(); } @@ -84,6 +85,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a CreateFileConfig object. */ + @ExcludeFromGeneratedCoverageReport public static CreateFileConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateFileConfig.class); } diff --git a/src/main/java/com/google/genai/types/CreateFileParameters.java b/src/main/java/com/google/genai/types/CreateFileParameters.java index 027f2c05596..4e7c0202097 100644 --- a/src/main/java/com/google/genai/types/CreateFileParameters.java +++ b/src/main/java/com/google/genai/types/CreateFileParameters.java @@ -44,6 +44,7 @@ public abstract class CreateFileParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for CreateFileParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateFileParameters.Builder(); } @@ -102,6 +103,7 @@ public Builder config(CreateFileConfig.Builder configBuilder) { } /** Deserializes a JSON string to a CreateFileParameters object. */ + @ExcludeFromGeneratedCoverageReport public static CreateFileParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateFileParameters.class); } diff --git a/src/main/java/com/google/genai/types/CreateFileResponse.java b/src/main/java/com/google/genai/types/CreateFileResponse.java index f78b822fcbf..da9305682bd 100644 --- a/src/main/java/com/google/genai/types/CreateFileResponse.java +++ b/src/main/java/com/google/genai/types/CreateFileResponse.java @@ -34,6 +34,7 @@ public abstract class CreateFileResponse extends JsonSerializable { public abstract Optional sdkHttpResponse(); /** Instantiates a builder for CreateFileResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateFileResponse.Builder(); } @@ -71,6 +72,7 @@ public Builder sdkHttpResponse(HttpResponse.Builder sdkHttpResponseBuilder) { } /** Deserializes a JSON string to a CreateFileResponse object. */ + @ExcludeFromGeneratedCoverageReport public static CreateFileResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateFileResponse.class); } diff --git a/src/main/java/com/google/genai/types/CreateTuningJobConfig.java b/src/main/java/com/google/genai/types/CreateTuningJobConfig.java index 151fcfd4a35..e725faeeecd 100644 --- a/src/main/java/com/google/genai/types/CreateTuningJobConfig.java +++ b/src/main/java/com/google/genai/types/CreateTuningJobConfig.java @@ -86,6 +86,7 @@ public abstract class CreateTuningJobConfig extends JsonSerializable { public abstract Optional learningRate(); /** Instantiates a builder for CreateTuningJobConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateTuningJobConfig.Builder(); } @@ -232,6 +233,7 @@ public Builder adapterSize(String adapterSize) { } /** Deserializes a JSON string to a CreateTuningJobConfig object. */ + @ExcludeFromGeneratedCoverageReport public static CreateTuningJobConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateTuningJobConfig.class); } diff --git a/src/main/java/com/google/genai/types/CreateTuningJobParameters.java b/src/main/java/com/google/genai/types/CreateTuningJobParameters.java index cf438f7c2de..1e0d044c3ff 100644 --- a/src/main/java/com/google/genai/types/CreateTuningJobParameters.java +++ b/src/main/java/com/google/genai/types/CreateTuningJobParameters.java @@ -47,6 +47,7 @@ public abstract class CreateTuningJobParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for CreateTuningJobParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateTuningJobParameters.Builder(); } @@ -111,6 +112,7 @@ public Builder config(CreateTuningJobConfig.Builder configBuilder) { } /** Deserializes a JSON string to a CreateTuningJobParameters object. */ + @ExcludeFromGeneratedCoverageReport public static CreateTuningJobParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateTuningJobParameters.class); } diff --git a/src/main/java/com/google/genai/types/CreateTuningJobParametersPrivate.java b/src/main/java/com/google/genai/types/CreateTuningJobParametersPrivate.java index 8cb8b8275e3..0b7873ddf0f 100644 --- a/src/main/java/com/google/genai/types/CreateTuningJobParametersPrivate.java +++ b/src/main/java/com/google/genai/types/CreateTuningJobParametersPrivate.java @@ -47,6 +47,7 @@ public abstract class CreateTuningJobParametersPrivate extends JsonSerializable public abstract Optional config(); /** Instantiates a builder for CreateTuningJobParametersPrivate. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_CreateTuningJobParametersPrivate.Builder(); } @@ -114,6 +115,7 @@ public Builder config(CreateTuningJobConfig.Builder configBuilder) { } /** Deserializes a JSON string to a CreateTuningJobParametersPrivate object. */ + @ExcludeFromGeneratedCoverageReport public static CreateTuningJobParametersPrivate fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, CreateTuningJobParametersPrivate.class); } diff --git a/src/main/java/com/google/genai/types/DatasetDistribution.java b/src/main/java/com/google/genai/types/DatasetDistribution.java index f70b89330ee..306a1781d6f 100644 --- a/src/main/java/com/google/genai/types/DatasetDistribution.java +++ b/src/main/java/com/google/genai/types/DatasetDistribution.java @@ -66,6 +66,7 @@ public abstract class DatasetDistribution extends JsonSerializable { public abstract Optional sum(); /** Instantiates a builder for DatasetDistribution. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DatasetDistribution.Builder(); } @@ -171,6 +172,7 @@ public Builder buckets(DatasetDistributionDistributionBucket.Builder... bucketsB } /** Deserializes a JSON string to a DatasetDistribution object. */ + @ExcludeFromGeneratedCoverageReport public static DatasetDistribution fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DatasetDistribution.class); } diff --git a/src/main/java/com/google/genai/types/DatasetDistributionDistributionBucket.java b/src/main/java/com/google/genai/types/DatasetDistributionDistributionBucket.java index adf61aa69ce..2786e3ce05b 100644 --- a/src/main/java/com/google/genai/types/DatasetDistributionDistributionBucket.java +++ b/src/main/java/com/google/genai/types/DatasetDistributionDistributionBucket.java @@ -42,6 +42,7 @@ public abstract class DatasetDistributionDistributionBucket extends JsonSerializ public abstract Optional right(); /** Instantiates a builder for DatasetDistributionDistributionBucket. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DatasetDistributionDistributionBucket.Builder(); } @@ -89,6 +90,7 @@ private static Builder create() { } /** Deserializes a JSON string to a DatasetDistributionDistributionBucket object. */ + @ExcludeFromGeneratedCoverageReport public static DatasetDistributionDistributionBucket fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DatasetDistributionDistributionBucket.class); } diff --git a/src/main/java/com/google/genai/types/DatasetStats.java b/src/main/java/com/google/genai/types/DatasetStats.java index dcc839becb7..e764568bc64 100644 --- a/src/main/java/com/google/genai/types/DatasetStats.java +++ b/src/main/java/com/google/genai/types/DatasetStats.java @@ -66,6 +66,7 @@ public abstract class DatasetStats extends JsonSerializable { public abstract Optional userOutputTokenDistribution(); /** Instantiates a builder for DatasetStats. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DatasetStats.Builder(); } @@ -209,6 +210,7 @@ public Builder userOutputTokenDistribution( } /** Deserializes a JSON string to a DatasetStats object. */ + @ExcludeFromGeneratedCoverageReport public static DatasetStats fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DatasetStats.class); } diff --git a/src/main/java/com/google/genai/types/DeleteBatchJobConfig.java b/src/main/java/com/google/genai/types/DeleteBatchJobConfig.java index 638197ccef4..3717e3d14c6 100644 --- a/src/main/java/com/google/genai/types/DeleteBatchJobConfig.java +++ b/src/main/java/com/google/genai/types/DeleteBatchJobConfig.java @@ -34,6 +34,7 @@ public abstract class DeleteBatchJobConfig extends JsonSerializable { public abstract Optional httpOptions(); /** Instantiates a builder for DeleteBatchJobConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteBatchJobConfig.Builder(); } @@ -71,6 +72,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a DeleteBatchJobConfig object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteBatchJobConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteBatchJobConfig.class); } diff --git a/src/main/java/com/google/genai/types/DeleteBatchJobParameters.java b/src/main/java/com/google/genai/types/DeleteBatchJobParameters.java index 27807fea35a..c72c66bc6fd 100644 --- a/src/main/java/com/google/genai/types/DeleteBatchJobParameters.java +++ b/src/main/java/com/google/genai/types/DeleteBatchJobParameters.java @@ -44,6 +44,7 @@ public abstract class DeleteBatchJobParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for DeleteBatchJobParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteBatchJobParameters.Builder(); } @@ -91,6 +92,7 @@ public Builder config(DeleteBatchJobConfig.Builder configBuilder) { } /** Deserializes a JSON string to a DeleteBatchJobParameters object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteBatchJobParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteBatchJobParameters.class); } diff --git a/src/main/java/com/google/genai/types/DeleteCachedContentConfig.java b/src/main/java/com/google/genai/types/DeleteCachedContentConfig.java index b30bd2724b8..9343df3f57b 100644 --- a/src/main/java/com/google/genai/types/DeleteCachedContentConfig.java +++ b/src/main/java/com/google/genai/types/DeleteCachedContentConfig.java @@ -34,6 +34,7 @@ public abstract class DeleteCachedContentConfig extends JsonSerializable { public abstract Optional httpOptions(); /** Instantiates a builder for DeleteCachedContentConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteCachedContentConfig.Builder(); } @@ -71,6 +72,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a DeleteCachedContentConfig object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteCachedContentConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteCachedContentConfig.class); } diff --git a/src/main/java/com/google/genai/types/DeleteCachedContentParameters.java b/src/main/java/com/google/genai/types/DeleteCachedContentParameters.java index ff4794ece9d..536d1ab11a3 100644 --- a/src/main/java/com/google/genai/types/DeleteCachedContentParameters.java +++ b/src/main/java/com/google/genai/types/DeleteCachedContentParameters.java @@ -40,6 +40,7 @@ public abstract class DeleteCachedContentParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for DeleteCachedContentParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteCachedContentParameters.Builder(); } @@ -87,6 +88,7 @@ public Builder config(DeleteCachedContentConfig.Builder configBuilder) { } /** Deserializes a JSON string to a DeleteCachedContentParameters object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteCachedContentParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteCachedContentParameters.class); } diff --git a/src/main/java/com/google/genai/types/DeleteCachedContentResponse.java b/src/main/java/com/google/genai/types/DeleteCachedContentResponse.java index 339d4b6ef97..0b79785a5b9 100644 --- a/src/main/java/com/google/genai/types/DeleteCachedContentResponse.java +++ b/src/main/java/com/google/genai/types/DeleteCachedContentResponse.java @@ -28,6 +28,7 @@ @JsonDeserialize(builder = DeleteCachedContentResponse.Builder.class) public abstract class DeleteCachedContentResponse extends JsonSerializable { /** Instantiates a builder for DeleteCachedContentResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteCachedContentResponse.Builder(); } @@ -48,6 +49,7 @@ private static Builder create() { } /** Deserializes a JSON string to a DeleteCachedContentResponse object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteCachedContentResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteCachedContentResponse.class); } diff --git a/src/main/java/com/google/genai/types/DeleteFileConfig.java b/src/main/java/com/google/genai/types/DeleteFileConfig.java index 530b22e25ab..1059f2b3715 100644 --- a/src/main/java/com/google/genai/types/DeleteFileConfig.java +++ b/src/main/java/com/google/genai/types/DeleteFileConfig.java @@ -34,6 +34,7 @@ public abstract class DeleteFileConfig extends JsonSerializable { public abstract Optional httpOptions(); /** Instantiates a builder for DeleteFileConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteFileConfig.Builder(); } @@ -71,6 +72,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a DeleteFileConfig object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteFileConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteFileConfig.class); } diff --git a/src/main/java/com/google/genai/types/DeleteFileParameters.java b/src/main/java/com/google/genai/types/DeleteFileParameters.java index a4a18770a39..cb4d5ed6707 100644 --- a/src/main/java/com/google/genai/types/DeleteFileParameters.java +++ b/src/main/java/com/google/genai/types/DeleteFileParameters.java @@ -40,6 +40,7 @@ public abstract class DeleteFileParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for DeleteFileParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteFileParameters.Builder(); } @@ -85,6 +86,7 @@ public Builder config(DeleteFileConfig.Builder configBuilder) { } /** Deserializes a JSON string to a DeleteFileParameters object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteFileParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteFileParameters.class); } diff --git a/src/main/java/com/google/genai/types/DeleteFileResponse.java b/src/main/java/com/google/genai/types/DeleteFileResponse.java index c1b34814310..fa9e59f97a8 100644 --- a/src/main/java/com/google/genai/types/DeleteFileResponse.java +++ b/src/main/java/com/google/genai/types/DeleteFileResponse.java @@ -28,6 +28,7 @@ @JsonDeserialize(builder = DeleteFileResponse.Builder.class) public abstract class DeleteFileResponse extends JsonSerializable { /** Instantiates a builder for DeleteFileResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteFileResponse.Builder(); } @@ -48,6 +49,7 @@ private static Builder create() { } /** Deserializes a JSON string to a DeleteFileResponse object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteFileResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteFileResponse.class); } diff --git a/src/main/java/com/google/genai/types/DeleteModelConfig.java b/src/main/java/com/google/genai/types/DeleteModelConfig.java index cc1b8543833..04f9528dde1 100644 --- a/src/main/java/com/google/genai/types/DeleteModelConfig.java +++ b/src/main/java/com/google/genai/types/DeleteModelConfig.java @@ -34,6 +34,7 @@ public abstract class DeleteModelConfig extends JsonSerializable { public abstract Optional httpOptions(); /** Instantiates a builder for DeleteModelConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteModelConfig.Builder(); } @@ -71,6 +72,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a DeleteModelConfig object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteModelConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteModelConfig.class); } diff --git a/src/main/java/com/google/genai/types/DeleteModelParameters.java b/src/main/java/com/google/genai/types/DeleteModelParameters.java index 383e43ea7f5..8e5d9a7e143 100644 --- a/src/main/java/com/google/genai/types/DeleteModelParameters.java +++ b/src/main/java/com/google/genai/types/DeleteModelParameters.java @@ -40,6 +40,7 @@ public abstract class DeleteModelParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for DeleteModelParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteModelParameters.Builder(); } @@ -85,6 +86,7 @@ public Builder config(DeleteModelConfig.Builder configBuilder) { } /** Deserializes a JSON string to a DeleteModelParameters object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteModelParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteModelParameters.class); } diff --git a/src/main/java/com/google/genai/types/DeleteModelResponse.java b/src/main/java/com/google/genai/types/DeleteModelResponse.java index 5a7d3c90794..24fdacd0eee 100644 --- a/src/main/java/com/google/genai/types/DeleteModelResponse.java +++ b/src/main/java/com/google/genai/types/DeleteModelResponse.java @@ -28,6 +28,7 @@ @JsonDeserialize(builder = DeleteModelResponse.Builder.class) public abstract class DeleteModelResponse extends JsonSerializable { /** Instantiates a builder for DeleteModelResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteModelResponse.Builder(); } @@ -48,6 +49,7 @@ private static Builder create() { } /** Deserializes a JSON string to a DeleteModelResponse object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteModelResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteModelResponse.class); } diff --git a/src/main/java/com/google/genai/types/DeleteResourceJob.java b/src/main/java/com/google/genai/types/DeleteResourceJob.java index e3bc5e40fc9..e2b2989bf16 100644 --- a/src/main/java/com/google/genai/types/DeleteResourceJob.java +++ b/src/main/java/com/google/genai/types/DeleteResourceJob.java @@ -42,6 +42,7 @@ public abstract class DeleteResourceJob extends JsonSerializable { public abstract Optional error(); /** Instantiates a builder for DeleteResourceJob. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DeleteResourceJob.Builder(); } @@ -95,6 +96,7 @@ public Builder error(JobError.Builder errorBuilder) { } /** Deserializes a JSON string to a DeleteResourceJob object. */ + @ExcludeFromGeneratedCoverageReport public static DeleteResourceJob fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DeleteResourceJob.class); } diff --git a/src/main/java/com/google/genai/types/DistillationDataStats.java b/src/main/java/com/google/genai/types/DistillationDataStats.java index 68c608529f5..862afd5be4b 100644 --- a/src/main/java/com/google/genai/types/DistillationDataStats.java +++ b/src/main/java/com/google/genai/types/DistillationDataStats.java @@ -34,6 +34,7 @@ public abstract class DistillationDataStats extends JsonSerializable { public abstract Optional trainingDatasetStats(); /** Instantiates a builder for DistillationDataStats. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DistillationDataStats.Builder(); } @@ -71,6 +72,7 @@ public Builder trainingDatasetStats(DatasetStats.Builder trainingDatasetStatsBui } /** Deserializes a JSON string to a DistillationDataStats object. */ + @ExcludeFromGeneratedCoverageReport public static DistillationDataStats fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DistillationDataStats.class); } diff --git a/src/main/java/com/google/genai/types/DistillationHyperParameters.java b/src/main/java/com/google/genai/types/DistillationHyperParameters.java index be717feef84..d05bc8372ca 100644 --- a/src/main/java/com/google/genai/types/DistillationHyperParameters.java +++ b/src/main/java/com/google/genai/types/DistillationHyperParameters.java @@ -48,6 +48,7 @@ public abstract class DistillationHyperParameters extends JsonSerializable { public abstract Optional learningRateMultiplier(); /** Instantiates a builder for DistillationHyperParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DistillationHyperParameters.Builder(); } @@ -113,6 +114,7 @@ public Builder adapterSize(String adapterSize) { } /** Deserializes a JSON string to a DistillationHyperParameters object. */ + @ExcludeFromGeneratedCoverageReport public static DistillationHyperParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DistillationHyperParameters.class); } diff --git a/src/main/java/com/google/genai/types/DistillationSpec.java b/src/main/java/com/google/genai/types/DistillationSpec.java index 638b6450620..474e61332b1 100644 --- a/src/main/java/com/google/genai/types/DistillationSpec.java +++ b/src/main/java/com/google/genai/types/DistillationSpec.java @@ -77,6 +77,7 @@ public abstract class DistillationSpec extends JsonSerializable { public abstract Optional validationDatasetUri(); /** Instantiates a builder for DistillationSpec. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DistillationSpec.Builder(); } @@ -169,6 +170,7 @@ public Builder hyperParameters(DistillationHyperParameters.Builder hyperParamete } /** Deserializes a JSON string to a DistillationSpec object. */ + @ExcludeFromGeneratedCoverageReport public static DistillationSpec fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DistillationSpec.class); } diff --git a/src/main/java/com/google/genai/types/DownloadFileConfig.java b/src/main/java/com/google/genai/types/DownloadFileConfig.java index ec8e6aa6ccd..2a23c62a0e1 100644 --- a/src/main/java/com/google/genai/types/DownloadFileConfig.java +++ b/src/main/java/com/google/genai/types/DownloadFileConfig.java @@ -34,6 +34,7 @@ public abstract class DownloadFileConfig extends JsonSerializable { public abstract Optional httpOptions(); /** Instantiates a builder for DownloadFileConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DownloadFileConfig.Builder(); } @@ -71,6 +72,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a DownloadFileConfig object. */ + @ExcludeFromGeneratedCoverageReport public static DownloadFileConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DownloadFileConfig.class); } diff --git a/src/main/java/com/google/genai/types/DynamicRetrievalConfig.java b/src/main/java/com/google/genai/types/DynamicRetrievalConfig.java index efc4f87949d..97089b82cce 100644 --- a/src/main/java/com/google/genai/types/DynamicRetrievalConfig.java +++ b/src/main/java/com/google/genai/types/DynamicRetrievalConfig.java @@ -42,6 +42,7 @@ public abstract class DynamicRetrievalConfig extends JsonSerializable { public abstract Optional dynamicThreshold(); /** Instantiates a builder for DynamicRetrievalConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_DynamicRetrievalConfig.Builder(); } @@ -99,6 +100,7 @@ public Builder mode(String mode) { } /** Deserializes a JSON string to a DynamicRetrievalConfig object. */ + @ExcludeFromGeneratedCoverageReport public static DynamicRetrievalConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, DynamicRetrievalConfig.class); } diff --git a/src/main/java/com/google/genai/types/DynamicRetrievalConfigMode.java b/src/main/java/com/google/genai/types/DynamicRetrievalConfigMode.java index 0af252eea2f..515b5ff89af 100644 --- a/src/main/java/com/google/genai/types/DynamicRetrievalConfigMode.java +++ b/src/main/java/com/google/genai/types/DynamicRetrievalConfigMode.java @@ -59,12 +59,14 @@ public DynamicRetrievalConfigMode(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -94,6 +96,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.dynamicRetrievalConfigModeEnum != Known.DYNAMIC_RETRIEVAL_CONFIG_MODE_UNSPECIFIED) { @@ -103,6 +106,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.dynamicRetrievalConfigModeEnum; } diff --git a/src/main/java/com/google/genai/types/EditImageConfig.java b/src/main/java/com/google/genai/types/EditImageConfig.java index 0f0c7f6e539..35211fd1dd2 100644 --- a/src/main/java/com/google/genai/types/EditImageConfig.java +++ b/src/main/java/com/google/genai/types/EditImageConfig.java @@ -116,6 +116,7 @@ public abstract class EditImageConfig extends JsonSerializable { public abstract Optional baseSteps(); /** Instantiates a builder for EditImageConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EditImageConfig.Builder(); } @@ -368,6 +369,7 @@ public Builder editMode(String editMode) { } /** Deserializes a JSON string to a EditImageConfig object. */ + @ExcludeFromGeneratedCoverageReport public static EditImageConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EditImageConfig.class); } diff --git a/src/main/java/com/google/genai/types/EditImageParameters.java b/src/main/java/com/google/genai/types/EditImageParameters.java index df0568abec0..e47f69e6b56 100644 --- a/src/main/java/com/google/genai/types/EditImageParameters.java +++ b/src/main/java/com/google/genai/types/EditImageParameters.java @@ -50,6 +50,7 @@ public abstract class EditImageParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for EditImageParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EditImageParameters.Builder(); } @@ -120,6 +121,7 @@ public Builder config(EditImageConfig.Builder configBuilder) { } /** Deserializes a JSON string to a EditImageParameters object. */ + @ExcludeFromGeneratedCoverageReport public static EditImageParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EditImageParameters.class); } diff --git a/src/main/java/com/google/genai/types/EditImageResponse.java b/src/main/java/com/google/genai/types/EditImageResponse.java index 7aee310938b..d39df0a9d53 100644 --- a/src/main/java/com/google/genai/types/EditImageResponse.java +++ b/src/main/java/com/google/genai/types/EditImageResponse.java @@ -38,6 +38,7 @@ public abstract class EditImageResponse extends JsonSerializable { public abstract Optional> generatedImages(); /** Instantiates a builder for EditImageResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EditImageResponse.Builder(); } @@ -87,6 +88,7 @@ public Builder generatedImages(GeneratedImage.Builder... generatedImagesBuilders } /** Deserializes a JSON string to a EditImageResponse object. */ + @ExcludeFromGeneratedCoverageReport public static EditImageResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EditImageResponse.class); } diff --git a/src/main/java/com/google/genai/types/EditMode.java b/src/main/java/com/google/genai/types/EditMode.java index 1e7d6fb70f7..7258c3b4799 100644 --- a/src/main/java/com/google/genai/types/EditMode.java +++ b/src/main/java/com/google/genai/types/EditMode.java @@ -69,12 +69,14 @@ public EditMode(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -101,6 +103,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.editModeEnum != Known.EDIT_MODE_UNSPECIFIED) { @@ -110,6 +113,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.editModeEnum; } diff --git a/src/main/java/com/google/genai/types/EmbedContentConfig.java b/src/main/java/com/google/genai/types/EmbedContentConfig.java index ccef31e056f..88bc9c824c6 100644 --- a/src/main/java/com/google/genai/types/EmbedContentConfig.java +++ b/src/main/java/com/google/genai/types/EmbedContentConfig.java @@ -62,6 +62,7 @@ public abstract class EmbedContentConfig extends JsonSerializable { public abstract Optional autoTruncate(); /** Instantiates a builder for EmbedContentConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EmbedContentConfig.Builder(); } @@ -143,6 +144,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a EmbedContentConfig object. */ + @ExcludeFromGeneratedCoverageReport public static EmbedContentConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EmbedContentConfig.class); } diff --git a/src/main/java/com/google/genai/types/EmbedContentMetadata.java b/src/main/java/com/google/genai/types/EmbedContentMetadata.java index 816bb9d11c4..baadebbdb88 100644 --- a/src/main/java/com/google/genai/types/EmbedContentMetadata.java +++ b/src/main/java/com/google/genai/types/EmbedContentMetadata.java @@ -34,6 +34,7 @@ public abstract class EmbedContentMetadata extends JsonSerializable { public abstract Optional billableCharacterCount(); /** Instantiates a builder for EmbedContentMetadata. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EmbedContentMetadata.Builder(); } @@ -63,6 +64,7 @@ private static Builder create() { } /** Deserializes a JSON string to a EmbedContentMetadata object. */ + @ExcludeFromGeneratedCoverageReport public static EmbedContentMetadata fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EmbedContentMetadata.class); } diff --git a/src/main/java/com/google/genai/types/EmbedContentParameters.java b/src/main/java/com/google/genai/types/EmbedContentParameters.java index 4ae02be1959..6a52239f7dc 100644 --- a/src/main/java/com/google/genai/types/EmbedContentParameters.java +++ b/src/main/java/com/google/genai/types/EmbedContentParameters.java @@ -51,6 +51,7 @@ public abstract class EmbedContentParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for EmbedContentParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EmbedContentParameters.Builder(); } @@ -126,6 +127,7 @@ public Builder config(EmbedContentConfig.Builder configBuilder) { } /** Deserializes a JSON string to a EmbedContentParameters object. */ + @ExcludeFromGeneratedCoverageReport public static EmbedContentParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EmbedContentParameters.class); } diff --git a/src/main/java/com/google/genai/types/EmbedContentResponse.java b/src/main/java/com/google/genai/types/EmbedContentResponse.java index 2f35dd4a307..7dee6c06ade 100644 --- a/src/main/java/com/google/genai/types/EmbedContentResponse.java +++ b/src/main/java/com/google/genai/types/EmbedContentResponse.java @@ -42,6 +42,7 @@ public abstract class EmbedContentResponse extends JsonSerializable { public abstract Optional metadata(); /** Instantiates a builder for EmbedContentResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EmbedContentResponse.Builder(); } @@ -111,6 +112,7 @@ public Builder metadata(EmbedContentMetadata.Builder metadataBuilder) { } /** Deserializes a JSON string to a EmbedContentResponse object. */ + @ExcludeFromGeneratedCoverageReport public static EmbedContentResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EmbedContentResponse.class); } diff --git a/src/main/java/com/google/genai/types/EncryptionSpec.java b/src/main/java/com/google/genai/types/EncryptionSpec.java index ea39c7c341a..80b5dfd5352 100644 --- a/src/main/java/com/google/genai/types/EncryptionSpec.java +++ b/src/main/java/com/google/genai/types/EncryptionSpec.java @@ -41,6 +41,7 @@ public abstract class EncryptionSpec extends JsonSerializable { public abstract Optional kmsKeyName(); /** Instantiates a builder for EncryptionSpec. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EncryptionSpec.Builder(); } @@ -72,6 +73,7 @@ private static Builder create() { } /** Deserializes a JSON string to a EncryptionSpec object. */ + @ExcludeFromGeneratedCoverageReport public static EncryptionSpec fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EncryptionSpec.class); } diff --git a/src/main/java/com/google/genai/types/EndSensitivity.java b/src/main/java/com/google/genai/types/EndSensitivity.java index 35641b466bb..3cf231dba11 100644 --- a/src/main/java/com/google/genai/types/EndSensitivity.java +++ b/src/main/java/com/google/genai/types/EndSensitivity.java @@ -60,12 +60,14 @@ public EndSensitivity(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -92,6 +94,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.endSensitivityEnum != Known.END_SENSITIVITY_UNSPECIFIED) { @@ -101,6 +104,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.endSensitivityEnum; } diff --git a/src/main/java/com/google/genai/types/Endpoint.java b/src/main/java/com/google/genai/types/Endpoint.java index 85a19fb8a39..78d1991b5c3 100644 --- a/src/main/java/com/google/genai/types/Endpoint.java +++ b/src/main/java/com/google/genai/types/Endpoint.java @@ -38,6 +38,7 @@ public abstract class Endpoint extends JsonSerializable { public abstract Optional deployedModelId(); /** Instantiates a builder for Endpoint. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_Endpoint.Builder(); } @@ -74,6 +75,7 @@ private static Builder create() { } /** Deserializes a JSON string to a Endpoint object. */ + @ExcludeFromGeneratedCoverageReport public static Endpoint fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, Endpoint.class); } diff --git a/src/main/java/com/google/genai/types/EnterpriseWebSearch.java b/src/main/java/com/google/genai/types/EnterpriseWebSearch.java index 29543cfc27f..d0f698cba56 100644 --- a/src/main/java/com/google/genai/types/EnterpriseWebSearch.java +++ b/src/main/java/com/google/genai/types/EnterpriseWebSearch.java @@ -28,6 +28,7 @@ @JsonDeserialize(builder = EnterpriseWebSearch.Builder.class) public abstract class EnterpriseWebSearch extends JsonSerializable { /** Instantiates a builder for EnterpriseWebSearch. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_EnterpriseWebSearch.Builder(); } @@ -48,6 +49,7 @@ private static Builder create() { } /** Deserializes a JSON string to a EnterpriseWebSearch object. */ + @ExcludeFromGeneratedCoverageReport public static EnterpriseWebSearch fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, EnterpriseWebSearch.class); } diff --git a/src/main/java/com/google/genai/types/Environment.java b/src/main/java/com/google/genai/types/Environment.java index 4347d593cfd..6708ae60499 100644 --- a/src/main/java/com/google/genai/types/Environment.java +++ b/src/main/java/com/google/genai/types/Environment.java @@ -57,12 +57,14 @@ public Environment(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -89,6 +91,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.environmentEnum != Known.ENVIRONMENT_UNSPECIFIED) { @@ -98,6 +101,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.environmentEnum; } diff --git a/src/main/java/com/google/genai/types/ExcludeFromGeneratedCoverageReport.java b/src/main/java/com/google/genai/types/ExcludeFromGeneratedCoverageReport.java new file mode 100644 index 00000000000..73d98f6f869 --- /dev/null +++ b/src/main/java/com/google/genai/types/ExcludeFromGeneratedCoverageReport.java @@ -0,0 +1,31 @@ +/* + * 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. + */ + +package com.google.genai.types; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to exclude a method or constructor from the Jacoco coverage report. + * + *

Jacoco will exclude methods that have an annotation with the word "generated" in it. + */ +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) +@interface ExcludeFromGeneratedCoverageReport {} diff --git a/src/main/java/com/google/genai/types/ExecutableCode.java b/src/main/java/com/google/genai/types/ExecutableCode.java index 96779f55a4b..f017751d847 100644 --- a/src/main/java/com/google/genai/types/ExecutableCode.java +++ b/src/main/java/com/google/genai/types/ExecutableCode.java @@ -43,6 +43,7 @@ public abstract class ExecutableCode extends JsonSerializable { public abstract Optional language(); /** Instantiates a builder for ExecutableCode. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ExecutableCode.Builder(); } @@ -99,6 +100,7 @@ public Builder language(String language) { } /** Deserializes a JSON string to a ExecutableCode object. */ + @ExcludeFromGeneratedCoverageReport public static ExecutableCode fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ExecutableCode.class); } diff --git a/src/main/java/com/google/genai/types/ExternalApi.java b/src/main/java/com/google/genai/types/ExternalApi.java index 69a7ecb26e8..7ff8cbc5104 100644 --- a/src/main/java/com/google/genai/types/ExternalApi.java +++ b/src/main/java/com/google/genai/types/ExternalApi.java @@ -61,6 +61,7 @@ public abstract class ExternalApi extends JsonSerializable { public abstract Optional simpleSearchParams(); /** Instantiates a builder for ExternalApi. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ExternalApi.Builder(); } @@ -190,6 +191,7 @@ public Builder simpleSearchParams( } /** Deserializes a JSON string to a ExternalApi object. */ + @ExcludeFromGeneratedCoverageReport public static ExternalApi fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ExternalApi.class); } diff --git a/src/main/java/com/google/genai/types/ExternalApiElasticSearchParams.java b/src/main/java/com/google/genai/types/ExternalApiElasticSearchParams.java index 5ec0a623ec5..5d04d103b42 100644 --- a/src/main/java/com/google/genai/types/ExternalApiElasticSearchParams.java +++ b/src/main/java/com/google/genai/types/ExternalApiElasticSearchParams.java @@ -45,6 +45,7 @@ public abstract class ExternalApiElasticSearchParams extends JsonSerializable { public abstract Optional searchTemplate(); /** Instantiates a builder for ExternalApiElasticSearchParams. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ExternalApiElasticSearchParams.Builder(); } @@ -92,6 +93,7 @@ private static Builder create() { } /** Deserializes a JSON string to a ExternalApiElasticSearchParams object. */ + @ExcludeFromGeneratedCoverageReport public static ExternalApiElasticSearchParams fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ExternalApiElasticSearchParams.class); } diff --git a/src/main/java/com/google/genai/types/ExternalApiSimpleSearchParams.java b/src/main/java/com/google/genai/types/ExternalApiSimpleSearchParams.java index 39314fe765f..d32068994a3 100644 --- a/src/main/java/com/google/genai/types/ExternalApiSimpleSearchParams.java +++ b/src/main/java/com/google/genai/types/ExternalApiSimpleSearchParams.java @@ -28,6 +28,7 @@ @JsonDeserialize(builder = ExternalApiSimpleSearchParams.Builder.class) public abstract class ExternalApiSimpleSearchParams extends JsonSerializable { /** Instantiates a builder for ExternalApiSimpleSearchParams. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_ExternalApiSimpleSearchParams.Builder(); } @@ -50,6 +51,7 @@ private static Builder create() { } /** Deserializes a JSON string to a ExternalApiSimpleSearchParams object. */ + @ExcludeFromGeneratedCoverageReport public static ExternalApiSimpleSearchParams fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, ExternalApiSimpleSearchParams.class); } diff --git a/src/main/java/com/google/genai/types/FeatureSelectionPreference.java b/src/main/java/com/google/genai/types/FeatureSelectionPreference.java index 5a1815d0128..7976dff966d 100644 --- a/src/main/java/com/google/genai/types/FeatureSelectionPreference.java +++ b/src/main/java/com/google/genai/types/FeatureSelectionPreference.java @@ -59,12 +59,14 @@ public FeatureSelectionPreference(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -91,6 +93,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.featureSelectionPreferenceEnum != Known.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED) { @@ -100,6 +103,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.featureSelectionPreferenceEnum; } diff --git a/src/main/java/com/google/genai/types/FetchPredictOperationConfig.java b/src/main/java/com/google/genai/types/FetchPredictOperationConfig.java index 006f2f9489f..f8ea69c8315 100644 --- a/src/main/java/com/google/genai/types/FetchPredictOperationConfig.java +++ b/src/main/java/com/google/genai/types/FetchPredictOperationConfig.java @@ -34,6 +34,7 @@ public abstract class FetchPredictOperationConfig extends JsonSerializable { public abstract Optional httpOptions(); /** Instantiates a builder for FetchPredictOperationConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_FetchPredictOperationConfig.Builder(); } @@ -71,6 +72,7 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) { } /** Deserializes a JSON string to a FetchPredictOperationConfig object. */ + @ExcludeFromGeneratedCoverageReport public static FetchPredictOperationConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, FetchPredictOperationConfig.class); } diff --git a/src/main/java/com/google/genai/types/FetchPredictOperationParameters.java b/src/main/java/com/google/genai/types/FetchPredictOperationParameters.java index 4a3eae13eae..acb9eb36b59 100644 --- a/src/main/java/com/google/genai/types/FetchPredictOperationParameters.java +++ b/src/main/java/com/google/genai/types/FetchPredictOperationParameters.java @@ -44,6 +44,7 @@ public abstract class FetchPredictOperationParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for FetchPredictOperationParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_FetchPredictOperationParameters.Builder(); } @@ -99,6 +100,7 @@ public Builder config(FetchPredictOperationConfig.Builder configBuilder) { } /** Deserializes a JSON string to a FetchPredictOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport public static FetchPredictOperationParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, FetchPredictOperationParameters.class); } diff --git a/src/main/java/com/google/genai/types/File.java b/src/main/java/com/google/genai/types/File.java index 34ecb1e76d9..bbf979d72c2 100644 --- a/src/main/java/com/google/genai/types/File.java +++ b/src/main/java/com/google/genai/types/File.java @@ -101,6 +101,7 @@ public abstract class File extends JsonSerializable { public abstract Optional error(); /** Instantiates a builder for File. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_File.Builder(); } @@ -289,6 +290,7 @@ public Builder error(FileStatus.Builder errorBuilder) { } /** Deserializes a JSON string to a File object. */ + @ExcludeFromGeneratedCoverageReport public static File fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, File.class); } diff --git a/src/main/java/com/google/genai/types/FileData.java b/src/main/java/com/google/genai/types/FileData.java index d36aa3b8157..4f059ef957c 100644 --- a/src/main/java/com/google/genai/types/FileData.java +++ b/src/main/java/com/google/genai/types/FileData.java @@ -45,6 +45,7 @@ public abstract class FileData extends JsonSerializable { public abstract Optional mimeType(); /** Instantiates a builder for FileData. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_FileData.Builder(); } @@ -90,6 +91,7 @@ private static Builder create() { } /** Deserializes a JSON string to a FileData object. */ + @ExcludeFromGeneratedCoverageReport public static FileData fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, FileData.class); } diff --git a/src/main/java/com/google/genai/types/FileSource.java b/src/main/java/com/google/genai/types/FileSource.java index fa360c5fda9..1763c1c4d78 100644 --- a/src/main/java/com/google/genai/types/FileSource.java +++ b/src/main/java/com/google/genai/types/FileSource.java @@ -59,12 +59,14 @@ public FileSource(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -91,6 +93,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.fileSourceEnum != Known.FILE_SOURCE_UNSPECIFIED) { @@ -100,6 +103,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.fileSourceEnum; } diff --git a/src/main/java/com/google/genai/types/FileState.java b/src/main/java/com/google/genai/types/FileState.java index a4f74872b85..af9e2ae68f7 100644 --- a/src/main/java/com/google/genai/types/FileState.java +++ b/src/main/java/com/google/genai/types/FileState.java @@ -61,12 +61,14 @@ public FileState(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -93,6 +95,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.fileStateEnum != Known.FILE_STATE_UNSPECIFIED) { @@ -102,6 +105,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.fileStateEnum; } diff --git a/src/main/java/com/google/genai/types/FileStatus.java b/src/main/java/com/google/genai/types/FileStatus.java index 5c69faa3292..d3c190a2b50 100644 --- a/src/main/java/com/google/genai/types/FileStatus.java +++ b/src/main/java/com/google/genai/types/FileStatus.java @@ -51,6 +51,7 @@ public abstract class FileStatus extends JsonSerializable { public abstract Optional code(); /** Instantiates a builder for FileStatus. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_FileStatus.Builder(); } @@ -107,6 +108,7 @@ public Builder details(Map... details) { } /** Deserializes a JSON string to a FileStatus object. */ + @ExcludeFromGeneratedCoverageReport public static FileStatus fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, FileStatus.class); } diff --git a/src/main/java/com/google/genai/types/FinishReason.java b/src/main/java/com/google/genai/types/FinishReason.java index 6df7ea34964..219d350c374 100644 --- a/src/main/java/com/google/genai/types/FinishReason.java +++ b/src/main/java/com/google/genai/types/FinishReason.java @@ -100,12 +100,14 @@ public FinishReason(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -132,6 +134,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.finishReasonEnum != Known.FINISH_REASON_UNSPECIFIED) { @@ -141,6 +144,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.finishReasonEnum; } diff --git a/src/main/java/com/google/genai/types/FunctionCall.java b/src/main/java/com/google/genai/types/FunctionCall.java index ca0a88af924..ebadb56c076 100644 --- a/src/main/java/com/google/genai/types/FunctionCall.java +++ b/src/main/java/com/google/genai/types/FunctionCall.java @@ -49,6 +49,7 @@ public abstract class FunctionCall extends JsonSerializable { public abstract Optional name(); /** Instantiates a builder for FunctionCall. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_FunctionCall.Builder(); } @@ -95,6 +96,7 @@ private static Builder create() { } /** Deserializes a JSON string to a FunctionCall object. */ + @ExcludeFromGeneratedCoverageReport public static FunctionCall fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, FunctionCall.class); } diff --git a/src/main/java/com/google/genai/types/FunctionCallingConfig.java b/src/main/java/com/google/genai/types/FunctionCallingConfig.java index cd64b08f89d..5d280e4642a 100644 --- a/src/main/java/com/google/genai/types/FunctionCallingConfig.java +++ b/src/main/java/com/google/genai/types/FunctionCallingConfig.java @@ -45,6 +45,7 @@ public abstract class FunctionCallingConfig extends JsonSerializable { public abstract Optional> allowedFunctionNames(); /** Instantiates a builder for FunctionCallingConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_FunctionCallingConfig.Builder(); } @@ -114,6 +115,7 @@ public Builder allowedFunctionNames(String... allowedFunctionNames) { } /** Deserializes a JSON string to a FunctionCallingConfig object. */ + @ExcludeFromGeneratedCoverageReport public static FunctionCallingConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, FunctionCallingConfig.class); } diff --git a/src/main/java/com/google/genai/types/FunctionCallingConfigMode.java b/src/main/java/com/google/genai/types/FunctionCallingConfigMode.java index 6d6ff9c675d..2ca721a3df3 100644 --- a/src/main/java/com/google/genai/types/FunctionCallingConfigMode.java +++ b/src/main/java/com/google/genai/types/FunctionCallingConfigMode.java @@ -75,12 +75,14 @@ public FunctionCallingConfigMode(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -107,6 +109,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.functionCallingConfigModeEnum != Known.FUNCTION_CALLING_CONFIG_MODE_UNSPECIFIED) { @@ -116,6 +119,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.functionCallingConfigModeEnum; } diff --git a/src/main/java/com/google/genai/types/FunctionDeclaration.java b/src/main/java/com/google/genai/types/FunctionDeclaration.java index 7e02cc508ea..78801843a0f 100644 --- a/src/main/java/com/google/genai/types/FunctionDeclaration.java +++ b/src/main/java/com/google/genai/types/FunctionDeclaration.java @@ -97,6 +97,7 @@ public abstract class FunctionDeclaration extends JsonSerializable { public abstract Optional responseJsonSchema(); /** Instantiates a builder for FunctionDeclaration. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_FunctionDeclaration.Builder(); } @@ -236,6 +237,7 @@ public Builder response(Schema.Builder responseBuilder) { } /** Deserializes a JSON string to a FunctionDeclaration object. */ + @ExcludeFromGeneratedCoverageReport public static FunctionDeclaration fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, FunctionDeclaration.class); } diff --git a/src/main/java/com/google/genai/types/FunctionResponse.java b/src/main/java/com/google/genai/types/FunctionResponse.java index a3cdc1ecdea..50d14349d8d 100644 --- a/src/main/java/com/google/genai/types/FunctionResponse.java +++ b/src/main/java/com/google/genai/types/FunctionResponse.java @@ -72,6 +72,7 @@ public abstract class FunctionResponse extends JsonSerializable { public abstract Optional> response(); /** Instantiates a builder for FunctionResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_FunctionResponse.Builder(); } @@ -165,6 +166,7 @@ public Builder scheduling(String scheduling) { } /** Deserializes a JSON string to a FunctionResponse object. */ + @ExcludeFromGeneratedCoverageReport public static FunctionResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, FunctionResponse.class); } diff --git a/src/main/java/com/google/genai/types/FunctionResponseScheduling.java b/src/main/java/com/google/genai/types/FunctionResponseScheduling.java index 527afa0a418..cd22370f049 100644 --- a/src/main/java/com/google/genai/types/FunctionResponseScheduling.java +++ b/src/main/java/com/google/genai/types/FunctionResponseScheduling.java @@ -71,12 +71,14 @@ public FunctionResponseScheduling(Known knownValue) { this.value = knownValue.toString(); } + @ExcludeFromGeneratedCoverageReport @Override @JsonValue public String toString() { return this.value; } + @ExcludeFromGeneratedCoverageReport @SuppressWarnings("PatternMatchingInstanceof") @Override public boolean equals(Object o) { @@ -103,6 +105,7 @@ public boolean equals(Object o) { return false; } + @ExcludeFromGeneratedCoverageReport @Override public int hashCode() { if (this.functionResponseSchedulingEnum != Known.FUNCTION_RESPONSE_SCHEDULING_UNSPECIFIED) { @@ -112,6 +115,7 @@ public int hashCode() { } } + @ExcludeFromGeneratedCoverageReport public Known knownEnum() { return this.functionResponseSchedulingEnum; } diff --git a/src/main/java/com/google/genai/types/GeminiPreferenceExample.java b/src/main/java/com/google/genai/types/GeminiPreferenceExample.java index 53d5e2cbd7c..9ebec609555 100644 --- a/src/main/java/com/google/genai/types/GeminiPreferenceExample.java +++ b/src/main/java/com/google/genai/types/GeminiPreferenceExample.java @@ -42,6 +42,7 @@ public abstract class GeminiPreferenceExample extends JsonSerializable { public abstract Optional> contents(); /** Instantiates a builder for GeminiPreferenceExample. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GeminiPreferenceExample.Builder(); } @@ -120,6 +121,7 @@ public Builder contents(Content.Builder... contentsBuilders) { } /** Deserializes a JSON string to a GeminiPreferenceExample object. */ + @ExcludeFromGeneratedCoverageReport public static GeminiPreferenceExample fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GeminiPreferenceExample.class); } diff --git a/src/main/java/com/google/genai/types/GeminiPreferenceExampleCompletion.java b/src/main/java/com/google/genai/types/GeminiPreferenceExampleCompletion.java index 6f3ba60cd4e..5039fac18ca 100644 --- a/src/main/java/com/google/genai/types/GeminiPreferenceExampleCompletion.java +++ b/src/main/java/com/google/genai/types/GeminiPreferenceExampleCompletion.java @@ -38,6 +38,7 @@ public abstract class GeminiPreferenceExampleCompletion extends JsonSerializable public abstract Optional score(); /** Instantiates a builder for GeminiPreferenceExampleCompletion. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GeminiPreferenceExampleCompletion.Builder(); } @@ -86,6 +87,7 @@ public Builder completion(Content.Builder completionBuilder) { } /** Deserializes a JSON string to a GeminiPreferenceExampleCompletion object. */ + @ExcludeFromGeneratedCoverageReport public static GeminiPreferenceExampleCompletion fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GeminiPreferenceExampleCompletion.class); } diff --git a/src/main/java/com/google/genai/types/GenerateContentConfig.java b/src/main/java/com/google/genai/types/GenerateContentConfig.java index ed28f450e84..5be0eb0dc16 100644 --- a/src/main/java/com/google/genai/types/GenerateContentConfig.java +++ b/src/main/java/com/google/genai/types/GenerateContentConfig.java @@ -216,6 +216,7 @@ public abstract class GenerateContentConfig extends JsonSerializable { public abstract Optional thinkingConfig(); /** Instantiates a builder for GenerateContentConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateContentConfig.Builder(); } @@ -674,6 +675,7 @@ public Builder thinkingConfig(ThinkingConfig.Builder thinkingConfigBuilder) { } /** Deserializes a JSON string to a GenerateContentConfig object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateContentConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateContentConfig.class); } diff --git a/src/main/java/com/google/genai/types/GenerateContentParameters.java b/src/main/java/com/google/genai/types/GenerateContentParameters.java index 43f2ca07ed5..be550b56b61 100644 --- a/src/main/java/com/google/genai/types/GenerateContentParameters.java +++ b/src/main/java/com/google/genai/types/GenerateContentParameters.java @@ -51,6 +51,7 @@ public abstract class GenerateContentParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for GenerateContentParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateContentParameters.Builder(); } @@ -126,6 +127,7 @@ public Builder config(GenerateContentConfig.Builder configBuilder) { } /** Deserializes a JSON string to a GenerateContentParameters object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateContentParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateContentParameters.class); } diff --git a/src/main/java/com/google/genai/types/GenerateContentResponse.java b/src/main/java/com/google/genai/types/GenerateContentResponse.java index 946fda87597..33603df317b 100644 --- a/src/main/java/com/google/genai/types/GenerateContentResponse.java +++ b/src/main/java/com/google/genai/types/GenerateContentResponse.java @@ -79,6 +79,7 @@ public abstract class GenerateContentResponse extends JsonSerializable { public abstract Optional usageMetadata(); /** Instantiates a builder for GenerateContentResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateContentResponse.Builder(); } @@ -241,6 +242,7 @@ public Builder usageMetadata( } /** Deserializes a JSON string to a GenerateContentResponse object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateContentResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateContentResponse.class); } diff --git a/src/main/java/com/google/genai/types/GenerateContentResponsePromptFeedback.java b/src/main/java/com/google/genai/types/GenerateContentResponsePromptFeedback.java index 08be365950f..775e6eae374 100644 --- a/src/main/java/com/google/genai/types/GenerateContentResponsePromptFeedback.java +++ b/src/main/java/com/google/genai/types/GenerateContentResponsePromptFeedback.java @@ -47,6 +47,7 @@ public abstract class GenerateContentResponsePromptFeedback extends JsonSerializ public abstract Optional> safetyRatings(); /** Instantiates a builder for GenerateContentResponsePromptFeedback. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateContentResponsePromptFeedback.Builder(); } @@ -135,6 +136,7 @@ public Builder safetyRatings(SafetyRating.Builder... safetyRatingsBuilders) { } /** Deserializes a JSON string to a GenerateContentResponsePromptFeedback object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateContentResponsePromptFeedback fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateContentResponsePromptFeedback.class); } diff --git a/src/main/java/com/google/genai/types/GenerateContentResponseUsageMetadata.java b/src/main/java/com/google/genai/types/GenerateContentResponseUsageMetadata.java index a268283e132..8d6c25a711d 100644 --- a/src/main/java/com/google/genai/types/GenerateContentResponseUsageMetadata.java +++ b/src/main/java/com/google/genai/types/GenerateContentResponseUsageMetadata.java @@ -85,6 +85,7 @@ public abstract class GenerateContentResponseUsageMetadata extends JsonSerializa public abstract Optional trafficType(); /** Instantiates a builder for GenerateContentResponseUsageMetadata. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateContentResponseUsageMetadata.Builder(); } @@ -323,6 +324,7 @@ public Builder trafficType(String trafficType) { } /** Deserializes a JSON string to a GenerateContentResponseUsageMetadata object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateContentResponseUsageMetadata fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateContentResponseUsageMetadata.class); } diff --git a/src/main/java/com/google/genai/types/GenerateImagesConfig.java b/src/main/java/com/google/genai/types/GenerateImagesConfig.java index eda36d1880c..84ea7f680a1 100644 --- a/src/main/java/com/google/genai/types/GenerateImagesConfig.java +++ b/src/main/java/com/google/genai/types/GenerateImagesConfig.java @@ -116,6 +116,7 @@ public abstract class GenerateImagesConfig extends JsonSerializable { public abstract Optional enhancePrompt(); /** Instantiates a builder for GenerateImagesConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateImagesConfig.Builder(); } @@ -348,6 +349,7 @@ public Builder language(String language) { } /** Deserializes a JSON string to a GenerateImagesConfig object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateImagesConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateImagesConfig.class); } diff --git a/src/main/java/com/google/genai/types/GenerateImagesParameters.java b/src/main/java/com/google/genai/types/GenerateImagesParameters.java index 4810d5c730e..80fef944455 100644 --- a/src/main/java/com/google/genai/types/GenerateImagesParameters.java +++ b/src/main/java/com/google/genai/types/GenerateImagesParameters.java @@ -47,6 +47,7 @@ public abstract class GenerateImagesParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for GenerateImagesParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateImagesParameters.Builder(); } @@ -101,6 +102,7 @@ public Builder config(GenerateImagesConfig.Builder configBuilder) { } /** Deserializes a JSON string to a GenerateImagesParameters object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateImagesParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateImagesParameters.class); } diff --git a/src/main/java/com/google/genai/types/GenerateImagesResponse.java b/src/main/java/com/google/genai/types/GenerateImagesResponse.java index 0cb23e2888e..24a3fa89f98 100644 --- a/src/main/java/com/google/genai/types/GenerateImagesResponse.java +++ b/src/main/java/com/google/genai/types/GenerateImagesResponse.java @@ -45,6 +45,7 @@ public abstract class GenerateImagesResponse extends JsonSerializable { public abstract Optional positivePromptSafetyAttributes(); /** Instantiates a builder for GenerateImagesResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateImagesResponse.Builder(); } @@ -115,6 +116,7 @@ public Builder positivePromptSafetyAttributes( } /** Deserializes a JSON string to a GenerateImagesResponse object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateImagesResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateImagesResponse.class); } diff --git a/src/main/java/com/google/genai/types/GenerateVideosConfig.java b/src/main/java/com/google/genai/types/GenerateVideosConfig.java index 950d8416889..9231c66402d 100644 --- a/src/main/java/com/google/genai/types/GenerateVideosConfig.java +++ b/src/main/java/com/google/genai/types/GenerateVideosConfig.java @@ -106,6 +106,7 @@ public abstract class GenerateVideosConfig extends JsonSerializable { public abstract Optional compressionQuality(); /** Instantiates a builder for GenerateVideosConfig. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateVideosConfig.Builder(); } @@ -291,6 +292,7 @@ public Builder compressionQuality(String compressionQuality) { } /** Deserializes a JSON string to a GenerateVideosConfig object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateVideosConfig fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateVideosConfig.class); } diff --git a/src/main/java/com/google/genai/types/GenerateVideosOperation.java b/src/main/java/com/google/genai/types/GenerateVideosOperation.java index c042c79a6fe..8e8d7980379 100644 --- a/src/main/java/com/google/genai/types/GenerateVideosOperation.java +++ b/src/main/java/com/google/genai/types/GenerateVideosOperation.java @@ -63,6 +63,7 @@ public abstract class GenerateVideosOperation extends JsonSerializable { public abstract Optional response(); /** Instantiates a builder for GenerateVideosOperation. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateVideosOperation.Builder(); } @@ -138,6 +139,7 @@ public Builder response(GenerateVideosResponse.Builder responseBuilder) { } /** Deserializes a JSON string to a GenerateVideosOperation object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateVideosOperation fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateVideosOperation.class); } diff --git a/src/main/java/com/google/genai/types/GenerateVideosParameters.java b/src/main/java/com/google/genai/types/GenerateVideosParameters.java index 3382b826425..e68ed1e6124 100644 --- a/src/main/java/com/google/genai/types/GenerateVideosParameters.java +++ b/src/main/java/com/google/genai/types/GenerateVideosParameters.java @@ -55,6 +55,7 @@ public abstract class GenerateVideosParameters extends JsonSerializable { public abstract Optional config(); /** Instantiates a builder for GenerateVideosParameters. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateVideosParameters.Builder(); } @@ -145,6 +146,7 @@ public Builder config(GenerateVideosConfig.Builder configBuilder) { } /** Deserializes a JSON string to a GenerateVideosParameters object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateVideosParameters fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateVideosParameters.class); } diff --git a/src/main/java/com/google/genai/types/GenerateVideosResponse.java b/src/main/java/com/google/genai/types/GenerateVideosResponse.java index 69027d743da..258ed0a7603 100644 --- a/src/main/java/com/google/genai/types/GenerateVideosResponse.java +++ b/src/main/java/com/google/genai/types/GenerateVideosResponse.java @@ -46,6 +46,7 @@ public abstract class GenerateVideosResponse extends JsonSerializable { public abstract Optional> raiMediaFilteredReasons(); /** Instantiates a builder for GenerateVideosResponse. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GenerateVideosResponse.Builder(); } @@ -120,6 +121,7 @@ public Builder raiMediaFilteredReasons(String... raiMediaFilteredReasons) { } /** Deserializes a JSON string to a GenerateVideosResponse object. */ + @ExcludeFromGeneratedCoverageReport public static GenerateVideosResponse fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GenerateVideosResponse.class); } diff --git a/src/main/java/com/google/genai/types/GeneratedImage.java b/src/main/java/com/google/genai/types/GeneratedImage.java index bef81420d64..07ac595b010 100644 --- a/src/main/java/com/google/genai/types/GeneratedImage.java +++ b/src/main/java/com/google/genai/types/GeneratedImage.java @@ -46,6 +46,7 @@ public abstract class GeneratedImage extends JsonSerializable { public abstract Optional enhancedPrompt(); /** Instantiates a builder for GeneratedImage. */ + @ExcludeFromGeneratedCoverageReport public static Builder builder() { return new AutoValue_GeneratedImage.Builder(); } @@ -120,6 +121,7 @@ public Builder safetyAttributes(SafetyAttributes.Builder safetyAttributesBuilder } /** Deserializes a JSON string to a GeneratedImage object. */ + @ExcludeFromGeneratedCoverageReport public static GeneratedImage fromJson(String jsonString) { return JsonSerializable.fromJsonString(jsonString, GeneratedImage.class); } diff --git a/src/main/java/com/google/genai/types/GeneratedVideo.java b/src/main/java/com/google/genai/types/GeneratedVideo.java index 467d15efc77..ce45662c3d1 100644 --- a/src/main/java/com/google/genai/types/GeneratedVideo.java +++ b/src/main/java/com/google/genai/types/GeneratedVideo.java @@ -34,6 +34,7 @@ public abstract class GeneratedVideo extends JsonSerializable { public abstract Optional