From 0a4a82c1a0e10c5cf76551ae61e7aa9f6fef44c5 Mon Sep 17 00:00:00 2001 From: Ayush Agrawal Date: Tue, 11 Nov 2025 10:07:30 -0800 Subject: [PATCH] feat: Support multimodal embedding for Gemini Embedding 2.0 and MaaS models in Models.embed_content() (Vertex AI API) PiperOrigin-RevId: 830964972 --- README.md | 21 +- .../google/genai/examples/EmbedContent.java | 20 + .../genai/examples/EmbedContentAsync.java | 26 + .../java/com/google/genai/AsyncBatches.java | 6 + .../java/com/google/genai/AsyncCaches.java | 5 + .../java/com/google/genai/AsyncDocuments.java | 3 + .../google/genai/AsyncFileSearchStores.java | 6 + .../java/com/google/genai/AsyncFiles.java | 4 + .../java/com/google/genai/AsyncModels.java | 284 +++- .../com/google/genai/AsyncOperations.java | 2 + .../java/com/google/genai/AsyncTunings.java | 70 +- src/main/java/com/google/genai/Models.java | 1216 ++++++++++++----- .../java/com/google/genai/Transformers.java | 13 + src/main/java/com/google/genai/Tunings.java | 130 +- .../types/EmbedContentParametersPrivate.java | 244 ++++ .../google/genai/types/EmbeddingApiType.java | 110 ++ src/test/java/com/google/genai/TableTest.java | 14 +- 17 files changed, 1784 insertions(+), 390 deletions(-) create mode 100644 src/main/java/com/google/genai/types/EmbedContentParametersPrivate.java create mode 100644 src/main/java/com/google/genai/types/EmbeddingApiType.java diff --git a/README.md b/README.md index 312e6fbe53f..152a63802f1 100644 --- a/README.md +++ b/README.md @@ -586,12 +586,13 @@ public class ComputeTokens { #### 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. +sentences, and code, as well as multimodal content like images or videos via Vertex AI. ```java package ; import com.google.genai.Client; +import com.google.genai.types.EmbedContentConfig; import com.google.genai.types.EmbedContentResponse; public class EmbedContent { @@ -602,6 +603,24 @@ public class EmbedContent { client.models.embedContent("gemini-embedding-001", "why is the sky blue?", null); System.out.println("Embedding response: " + response); + + // Multimodal embedding with Vertex AI + Client vertexClient = Client.builder().vertexAI(true).build(); + EmbedContentConfig config = + EmbedContentConfig.builder() + .outputDimensionality(10) + .title("test_title") + .taskType("RETRIEVAL_DOCUMENT") + .build(); + + EmbedContentResponse mmResponse = + vertexClient.models.embedContent( + "gemini-embedding-2-exp-11-2025", + Content.fromParts( + Part.fromText("Hello"), + Part.fromUri("gs://cloud-samples-data/generative-ai/image/a-man-and-a-dog.png", "image/png")), + config); + System.out.println("Multimodal embedding response: " + mmResponse); } } ``` diff --git a/examples/src/main/java/com/google/genai/examples/EmbedContent.java b/examples/src/main/java/com/google/genai/examples/EmbedContent.java index 77de9bc09aa..078e0028e68 100644 --- a/examples/src/main/java/com/google/genai/examples/EmbedContent.java +++ b/examples/src/main/java/com/google/genai/examples/EmbedContent.java @@ -41,7 +41,11 @@ package com.google.genai.examples; import com.google.genai.Client; +import com.google.genai.types.Content; import com.google.genai.types.EmbedContentResponse; +import com.google.genai.types.FileData; +import com.google.genai.types.Part; +import java.util.Arrays; /** An example of using the Unified Gen AI Java SDK to embed content. */ public final class EmbedContent { @@ -73,6 +77,22 @@ public static void main(String[] args) { client.models.embedContent(modelId, "why is the sky blue?", null); System.out.println("Embedding response: " + response); + + if (client.vertexAI()) { + System.out.println("Embed content with GCS image example."); + Part textPart = Part.builder().text("What is in this image?").build(); + Part imagePart = + Part.builder() + .fileData( + FileData.builder() + .fileUri("gs://cloud-samples-data/generative-ai/image/a-man-and-a-dog.png") + .mimeType("image/png") + .build()) + .build(); + Content content = Content.builder().parts(Arrays.asList(textPart, imagePart)).build(); + response = client.models.embedContent("gemini-embedding-2-exp-11-2025", content, null); + System.out.println("Embedding response with GCS image: " + response); + } } private EmbedContent() {} diff --git a/examples/src/main/java/com/google/genai/examples/EmbedContentAsync.java b/examples/src/main/java/com/google/genai/examples/EmbedContentAsync.java index 731ec561a06..5bea63be4fc 100644 --- a/examples/src/main/java/com/google/genai/examples/EmbedContentAsync.java +++ b/examples/src/main/java/com/google/genai/examples/EmbedContentAsync.java @@ -41,7 +41,11 @@ package com.google.genai.examples; import com.google.genai.Client; +import com.google.genai.types.Content; import com.google.genai.types.EmbedContentResponse; +import com.google.genai.types.FileData; +import com.google.genai.types.Part; +import java.util.Arrays; import java.util.concurrent.CompletableFuture; /** An example of using the Unified Gen AI Java SDK to embed content asynchronously. */ @@ -79,6 +83,28 @@ public static void main(String[] args) { System.out.println("Async embedding response: " + response); }) .join(); + + // Vertex Multimodal embedding. + if (client.vertexAI()) { + System.out.println("Embed content with GCS image example."); + Part textPart = Part.builder().text("What is in this image?").build(); + Part imagePart = + Part.builder() + .fileData( + FileData.builder() + .fileUri("gs://cloud-samples-data/generative-ai/image/a-man-and-a-dog.png") + .mimeType("image/png") + .build()) + .build(); + Content content = Content.builder().parts(Arrays.asList(textPart, imagePart)).build(); + responseFuture = + client.async.models.embedContent("gemini-embedding-2-exp-11-2025", content, null); + responseFuture + .thenAccept( + response -> + System.out.println("Async embedding response with GCS image: " + response)) + .join(); + } } private EmbedContentAsync() {} diff --git a/src/main/java/com/google/genai/AsyncBatches.java b/src/main/java/com/google/genai/AsyncBatches.java index cde207a8922..a77c46ea915 100644 --- a/src/main/java/com/google/genai/AsyncBatches.java +++ b/src/main/java/com/google/genai/AsyncBatches.java @@ -49,6 +49,7 @@ public AsyncBatches(ApiClient apiClient) { CompletableFuture privateCreate( String model, BatchJobSource src, CreateBatchJobConfig config) { + BuiltRequest builtRequest = batches.buildRequestForPrivateCreate(model, src, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -62,6 +63,7 @@ CompletableFuture privateCreate( CompletableFuture privateCreateEmbeddings( String model, EmbeddingsBatchJobSource src, CreateEmbeddingsBatchJobConfig config) { + BuiltRequest builtRequest = batches.buildRequestForPrivateCreateEmbeddings(model, src, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -83,6 +85,7 @@ CompletableFuture privateCreateEmbeddings( * @return A {@link BatchJob} object that contains the info of the batch job. */ public CompletableFuture get(String name, GetBatchJobConfig config) { + BuiltRequest builtRequest = batches.buildRequestForGet(name, config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -103,6 +106,7 @@ public CompletableFuture get(String name, GetBatchJobConfig config) { * @param config A {@link CancelBatchJobConfig} for configuring the cancel request. */ public CompletableFuture cancel(String name, CancelBatchJobConfig config) { + BuiltRequest builtRequest = batches.buildRequestForCancel(name, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -113,6 +117,7 @@ public CompletableFuture cancel(String name, CancelBatchJobConfig config) } CompletableFuture privateList(ListBatchJobsConfig config) { + BuiltRequest builtRequest = batches.buildRequestForPrivateList(config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -133,6 +138,7 @@ CompletableFuture privateList(ListBatchJobsConfig config) * @param config A {@link DeleteBatchJobConfig} for configuring the delete request. */ public CompletableFuture delete(String name, DeleteBatchJobConfig config) { + BuiltRequest builtRequest = batches.buildRequestForDelete(name, config); return this.apiClient .asyncRequest( diff --git a/src/main/java/com/google/genai/AsyncCaches.java b/src/main/java/com/google/genai/AsyncCaches.java index e06059191ba..7fdb067aca5 100644 --- a/src/main/java/com/google/genai/AsyncCaches.java +++ b/src/main/java/com/google/genai/AsyncCaches.java @@ -52,6 +52,7 @@ public AsyncCaches(ApiClient apiClient) { * @return A {@link CachedContent} object that contains the info of the created resource. */ public CompletableFuture create(String model, CreateCachedContentConfig config) { + BuiltRequest builtRequest = caches.buildRequestForCreate(model, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -71,6 +72,7 @@ public CompletableFuture create(String model, CreateCachedContent * @return A {@link CachedContent} object that contains the info of the cached content. */ public CompletableFuture get(String name, GetCachedContentConfig config) { + BuiltRequest builtRequest = caches.buildRequestForGet(name, config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -90,6 +92,7 @@ public CompletableFuture get(String name, GetCachedContentConfig */ public CompletableFuture delete( String name, DeleteCachedContentConfig config) { + BuiltRequest builtRequest = caches.buildRequestForDelete(name, config); return this.apiClient .asyncRequest( @@ -110,6 +113,7 @@ public CompletableFuture delete( * @return A {@link CachedContent} object that contains the info of the updated resource. */ public CompletableFuture update(String name, UpdateCachedContentConfig config) { + BuiltRequest builtRequest = caches.buildRequestForUpdate(name, config); return this.apiClient .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -122,6 +126,7 @@ public CompletableFuture update(String name, UpdateCachedContentC } CompletableFuture privateList(ListCachedContentsConfig config) { + BuiltRequest builtRequest = caches.buildRequestForPrivateList(config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) diff --git a/src/main/java/com/google/genai/AsyncDocuments.java b/src/main/java/com/google/genai/AsyncDocuments.java index 37397094b60..fbc2917edf1 100644 --- a/src/main/java/com/google/genai/AsyncDocuments.java +++ b/src/main/java/com/google/genai/AsyncDocuments.java @@ -42,6 +42,7 @@ public AsyncDocuments(ApiClient apiClient) { } public CompletableFuture get(String name, GetDocumentConfig config) { + BuiltRequest builtRequest = documents.buildRequestForGet(name, config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -54,6 +55,7 @@ public CompletableFuture get(String name, GetDocumentConfig config) { } public CompletableFuture delete(String name, DeleteDocumentConfig config) { + BuiltRequest builtRequest = documents.buildRequestForDelete(name, config); return this.apiClient .asyncRequest( @@ -65,6 +67,7 @@ public CompletableFuture delete(String name, DeleteDocumentConfig config) } CompletableFuture privateList(String parent, ListDocumentsConfig config) { + BuiltRequest builtRequest = documents.buildRequestForPrivateList(parent, config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) diff --git a/src/main/java/com/google/genai/AsyncFileSearchStores.java b/src/main/java/com/google/genai/AsyncFileSearchStores.java index eaa6d2677d7..e73048c53c0 100644 --- a/src/main/java/com/google/genai/AsyncFileSearchStores.java +++ b/src/main/java/com/google/genai/AsyncFileSearchStores.java @@ -59,6 +59,7 @@ public AsyncFileSearchStores(ApiClient apiClient) { } public CompletableFuture create(CreateFileSearchStoreConfig config) { + BuiltRequest builtRequest = fileSearchStores.buildRequestForCreate(config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -71,6 +72,7 @@ public CompletableFuture create(CreateFileSearchStoreConfig con } public CompletableFuture get(String name, GetFileSearchStoreConfig config) { + BuiltRequest builtRequest = fileSearchStores.buildRequestForGet(name, config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -83,6 +85,7 @@ public CompletableFuture get(String name, GetFileSearchStoreCon } public CompletableFuture delete(String name, DeleteFileSearchStoreConfig config) { + BuiltRequest builtRequest = fileSearchStores.buildRequestForDelete(name, config); return this.apiClient .asyncRequest( @@ -94,6 +97,7 @@ public CompletableFuture delete(String name, DeleteFileSearchStoreConfig c } CompletableFuture privateList(ListFileSearchStoresConfig config) { + BuiltRequest builtRequest = fileSearchStores.buildRequestForPrivateList(config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -107,6 +111,7 @@ CompletableFuture privateList(ListFileSearchStores CompletableFuture privateUploadToFileSearchStore( String fileSearchStoreName, UploadToFileSearchStoreConfig config) { + BuiltRequest builtRequest = fileSearchStores.buildRequestForPrivateUploadToFileSearchStore(fileSearchStoreName, config); return this.apiClient @@ -122,6 +127,7 @@ CompletableFuture privateUploadToFileS public CompletableFuture importFile( String fileSearchStoreName, String fileName, ImportFileConfig config) { + BuiltRequest builtRequest = fileSearchStores.buildRequestForImportFile(fileSearchStoreName, fileName, config); return this.apiClient diff --git a/src/main/java/com/google/genai/AsyncFiles.java b/src/main/java/com/google/genai/AsyncFiles.java index 80aa229ce93..3cb7dcd8ac1 100644 --- a/src/main/java/com/google/genai/AsyncFiles.java +++ b/src/main/java/com/google/genai/AsyncFiles.java @@ -50,6 +50,7 @@ public AsyncFiles(ApiClient apiClient) { } CompletableFuture privateList(ListFilesConfig config) { + BuiltRequest builtRequest = files.buildRequestForPrivateList(config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -62,6 +63,7 @@ CompletableFuture privateList(ListFilesConfig config) { } CompletableFuture privateCreate(File file, CreateFileConfig config) { + BuiltRequest builtRequest = files.buildRequestForPrivateCreate(file, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -81,6 +83,7 @@ CompletableFuture privateCreate(File file, CreateFileConfig * @return A File object representing the file. */ public CompletableFuture get(String name, GetFileConfig config) { + BuiltRequest builtRequest = files.buildRequestForGet(name, config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) @@ -100,6 +103,7 @@ public CompletableFuture get(String name, GetFileConfig config) { * @return The DeleteFileResponse, the response for the delete method. */ public CompletableFuture delete(String name, DeleteFileConfig config) { + BuiltRequest builtRequest = files.buildRequestForDelete(name, config); return this.apiClient .asyncRequest( diff --git a/src/main/java/com/google/genai/AsyncModels.java b/src/main/java/com/google/genai/AsyncModels.java index d4ee0b2f946..f3c3f49ee73 100644 --- a/src/main/java/com/google/genai/AsyncModels.java +++ b/src/main/java/com/google/genai/AsyncModels.java @@ -25,39 +25,54 @@ import com.google.genai.Common.BuiltRequest; import com.google.genai.errors.GenAiIOException; import com.google.genai.types.ComputeTokensConfig; +import com.google.genai.types.ComputeTokensParameters; import com.google.genai.types.ComputeTokensResponse; import com.google.genai.types.Content; import com.google.genai.types.CountTokensConfig; +import com.google.genai.types.CountTokensParameters; import com.google.genai.types.CountTokensResponse; import com.google.genai.types.DeleteModelConfig; +import com.google.genai.types.DeleteModelParameters; import com.google.genai.types.DeleteModelResponse; import com.google.genai.types.EditImageConfig; +import com.google.genai.types.EditImageParameters; import com.google.genai.types.EditImageResponse; import com.google.genai.types.EmbedContentConfig; +import com.google.genai.types.EmbedContentParametersPrivate; import com.google.genai.types.EmbedContentResponse; +import com.google.genai.types.EmbeddingApiType; import com.google.genai.types.GenerateContentConfig; +import com.google.genai.types.GenerateContentParameters; import com.google.genai.types.GenerateContentResponse; import com.google.genai.types.GenerateImagesConfig; +import com.google.genai.types.GenerateImagesParameters; import com.google.genai.types.GenerateImagesResponse; import com.google.genai.types.GenerateVideosConfig; import com.google.genai.types.GenerateVideosOperation; +import com.google.genai.types.GenerateVideosParameters; import com.google.genai.types.GenerateVideosSource; import com.google.genai.types.GetModelConfig; +import com.google.genai.types.GetModelParameters; import com.google.genai.types.Image; import com.google.genai.types.ListModelsConfig; +import com.google.genai.types.ListModelsParameters; 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.SegmentImageConfig; +import com.google.genai.types.SegmentImageParameters; import com.google.genai.types.SegmentImageResponse; import com.google.genai.types.SegmentImageSource; import com.google.genai.types.UpdateModelConfig; +import com.google.genai.types.UpdateModelParameters; import com.google.genai.types.UpscaleImageAPIConfig; +import com.google.genai.types.UpscaleImageAPIParameters; import com.google.genai.types.UpscaleImageConfig; import com.google.genai.types.UpscaleImageResponse; import com.google.genai.types.Video; @@ -81,6 +96,18 @@ public AsyncModels(ApiClient apiClient) { CompletableFuture privateGenerateContent( String model, List contents, GenerateContentConfig config) { + GenerateContentParameters.Builder parameterBuilder = GenerateContentParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForPrivateGenerateContent(model, contents, config); return this.apiClient @@ -88,32 +115,70 @@ CompletableFuture privateGenerateContent( .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForPrivateGenerateContent(res, config); + return models.processResponseForPrivateGenerateContent(res, config, parameterNode); } }); } CompletableFuture> privateGenerateContentStream( String model, List contents, GenerateContentConfig config) { + GenerateContentParameters.Builder parameterBuilder = GenerateContentParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForPrivateGenerateContentStream(model, contents, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { - return models.processResponseForPrivateGenerateContentStream(response, config); + return models.processResponseForPrivateGenerateContentStream( + response, config, parameterNode); }); } CompletableFuture privateEmbedContent( - String model, List contents, EmbedContentConfig config) { - BuiltRequest builtRequest = models.buildRequestForPrivateEmbedContent(model, contents, config); + String model, + List contents, + Content content, + EmbeddingApiType embeddingApiType, + EmbedContentConfig config) { + EmbedContentParametersPrivate.Builder parameterBuilder = + EmbedContentParametersPrivate.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(content)) { + parameterBuilder.content(content); + } + if (!Common.isZero(embeddingApiType)) { + parameterBuilder.embeddingApiType(embeddingApiType); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + BuiltRequest builtRequest = + models.buildRequestForPrivateEmbedContent( + model, contents, content, embeddingApiType, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForPrivateEmbedContent(res, config); + return models.processResponseForPrivateEmbedContent(res, config, parameterNode); } }); } @@ -121,13 +186,25 @@ CompletableFuture privateEmbedContent( /** Asynchronously private method for generating images. */ CompletableFuture privateGenerateImages( String model, String prompt, GenerateImagesConfig config) { + GenerateImagesParameters.Builder parameterBuilder = GenerateImagesParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(prompt)) { + parameterBuilder.prompt(prompt); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForPrivateGenerateImages(model, prompt, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForPrivateGenerateImages(res, config); + return models.processResponseForPrivateGenerateImages(res, config, parameterNode); } }); } @@ -138,6 +215,21 @@ CompletableFuture privateEditImage( String prompt, List referenceImages, EditImageConfig config) { + EditImageParameters.Builder parameterBuilder = EditImageParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(prompt)) { + parameterBuilder.prompt(prompt); + } + if (!Common.isZero(referenceImages)) { + parameterBuilder.referenceImages(referenceImages); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForPrivateEditImage(model, prompt, referenceImages, config); return this.apiClient @@ -145,7 +237,7 @@ CompletableFuture privateEditImage( .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForPrivateEditImage(res, config); + return models.processResponseForPrivateEditImage(res, config, parameterNode); } }); } @@ -153,6 +245,21 @@ CompletableFuture privateEditImage( /** Asynchronously private method for upscaling an image. */ CompletableFuture privateUpscaleImage( String model, Image image, String upscaleFactor, UpscaleImageAPIConfig config) { + UpscaleImageAPIParameters.Builder parameterBuilder = UpscaleImageAPIParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(image)) { + parameterBuilder.image(image); + } + if (!Common.isZero(upscaleFactor)) { + parameterBuilder.upscaleFactor(upscaleFactor); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForPrivateUpscaleImage(model, image, upscaleFactor, config); return this.apiClient @@ -160,7 +267,7 @@ CompletableFuture privateUpscaleImage( .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForPrivateUpscaleImage(res, config); + return models.processResponseForPrivateUpscaleImage(res, config, parameterNode); } }); } @@ -187,13 +294,25 @@ CompletableFuture privateUpscaleImage( */ public CompletableFuture 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()); BuiltRequest builtRequest = models.buildRequestForRecontextImage(model, source, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForRecontextImage(res, config); + return models.processResponseForRecontextImage(res, config, parameterNode); } }); } @@ -213,13 +332,25 @@ public CompletableFuture recontextImage( */ public CompletableFuture segmentImage( String model, SegmentImageSource source, SegmentImageConfig config) { + SegmentImageParameters.Builder parameterBuilder = SegmentImageParameters.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()); BuiltRequest builtRequest = models.buildRequestForSegmentImage(model, source, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForSegmentImage(res, config); + return models.processResponseForSegmentImage(res, config, parameterNode); } }); } @@ -230,25 +361,40 @@ public CompletableFuture segmentImage( * @example ```java Model model = client.models.get("gemini-2.0-flash"); ``` */ public CompletableFuture get(String model, GetModelConfig config) { + GetModelParameters.Builder parameterBuilder = GetModelParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForGet(model, config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForGet(res, config); + return models.processResponseForGet(res, config, parameterNode); } }); } CompletableFuture privateList(ListModelsConfig config) { + ListModelsParameters.Builder parameterBuilder = ListModelsParameters.builder(); + + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForPrivateList(config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForPrivateList(res, config); + return models.processResponseForPrivateList(res, config, parameterNode); } }); } @@ -265,13 +411,22 @@ CompletableFuture privateList(ListModelsConfig config) { * description") .build()); ``` */ public CompletableFuture update(String model, UpdateModelConfig config) { + UpdateModelParameters.Builder parameterBuilder = UpdateModelParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForUpdate(model, config); return this.apiClient .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForUpdate(res, config); + return models.processResponseForUpdate(res, config, parameterNode); } }); } @@ -282,6 +437,15 @@ public CompletableFuture update(String model, UpdateModelConfig config) { * @example ```java Model model = client.models.delete("tunedModels/12345"); ``` */ public CompletableFuture delete(String model, DeleteModelConfig config) { + DeleteModelParameters.Builder parameterBuilder = DeleteModelParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForDelete(model, config); return this.apiClient .asyncRequest( @@ -289,7 +453,7 @@ public CompletableFuture delete(String model, DeleteModelCo .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForDelete(res, config); + return models.processResponseForDelete(res, config, parameterNode); } }); } @@ -306,13 +470,25 @@ public CompletableFuture delete(String model, DeleteModelCo */ public CompletableFuture countTokens( String model, List contents, CountTokensConfig config) { + CountTokensParameters.Builder parameterBuilder = CountTokensParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForCountTokens(model, contents, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForCountTokens(res, config); + return models.processResponseForCountTokens(res, config, parameterNode); } }); } @@ -329,13 +505,25 @@ public CompletableFuture countTokens( */ public CompletableFuture computeTokens( String model, List contents, ComputeTokensConfig config) { + ComputeTokensParameters.Builder parameterBuilder = ComputeTokensParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForComputeTokens(model, contents, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForComputeTokens(res, config); + return models.processResponseForComputeTokens(res, config, parameterNode); } }); } @@ -348,6 +536,27 @@ CompletableFuture privateGenerateVideos( Video video, GenerateVideosSource source, GenerateVideosConfig config) { + GenerateVideosParameters.Builder parameterBuilder = GenerateVideosParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(prompt)) { + parameterBuilder.prompt(prompt); + } + if (!Common.isZero(image)) { + parameterBuilder.image(image); + } + if (!Common.isZero(video)) { + parameterBuilder.video(video); + } + if (!Common.isZero(source)) { + parameterBuilder.source(source); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = models.buildRequestForPrivateGenerateVideos(model, prompt, image, video, source, config); return this.apiClient @@ -355,7 +564,7 @@ CompletableFuture privateGenerateVideos( .thenApplyAsync( response -> { try (ApiResponse res = response) { - return models.processResponseForPrivateGenerateVideos(res, config); + return models.processResponseForPrivateGenerateVideos(res, config, parameterNode); } }); } @@ -761,7 +970,46 @@ public CompletableFuture embedContent( for (String text : texts) { contents.add(Content.fromParts(Part.fromText(text))); } - return privateEmbedContent(model, contents, config); + Content content = null; + if (!contents.isEmpty()) { + content = contents.get(0); + } + boolean isVertexEmbedContentModel = + this.apiClient.vertexAI() && Transformers.tIsVertexEmbedContentModel(model); + if (isVertexEmbedContentModel && contents.size() > 1) { + throw new IllegalArgumentException( + "The embedContent API for this model only supports one content at a time."); + } + EmbeddingApiType apiType = + isVertexEmbedContentModel + ? new EmbeddingApiType("EMBED_CONTENT") + : new EmbeddingApiType("PREDICT"); + return privateEmbedContent(model, contents, content, apiType, config); + } + + /** + * Asynchronously embeds content given a GenAI model and a content object. + * + * @param model the name of the GenAI model to use for embedding + * @param content a {@link com.google.genai.types.Content} to send to the embedding model + * @return a {@link com.google.genai.types.EmbedContentResponse} instance that contains the + * embedding. + */ + public CompletableFuture embedContent( + String model, Content content, EmbedContentConfig config) { + List contents = new ArrayList<>(); + contents.add(content); + boolean isVertexEmbedContentModel = + this.apiClient.vertexAI() && Transformers.tIsVertexEmbedContentModel(model); + if (isVertexEmbedContentModel && contents.size() > 1) { + throw new IllegalArgumentException( + "The embedContent API for this model only supports one content at a time."); + } + EmbeddingApiType apiType = + isVertexEmbedContentModel + ? new EmbeddingApiType("EMBED_CONTENT") + : new EmbeddingApiType("PREDICT"); + return privateEmbedContent(model, contents, content, apiType, config); } /** diff --git a/src/main/java/com/google/genai/AsyncOperations.java b/src/main/java/com/google/genai/AsyncOperations.java index 7c3ac5a65f3..5a6057332db 100644 --- a/src/main/java/com/google/genai/AsyncOperations.java +++ b/src/main/java/com/google/genai/AsyncOperations.java @@ -39,6 +39,7 @@ public AsyncOperations(ApiClient apiClient) { CompletableFuture privateGetVideosOperation( String operationName, GetOperationConfig config) { + BuiltRequest builtRequest = operations.buildRequestForPrivateGetVideosOperation(operationName, config); return this.apiClient @@ -53,6 +54,7 @@ CompletableFuture privateGetVideosOperation( CompletableFuture privateFetchPredictVideosOperation( String operationName, String resourceName, FetchPredictOperationConfig config) { + BuiltRequest builtRequest = operations.buildRequestForPrivateFetchPredictVideosOperation( operationName, resourceName, config); diff --git a/src/main/java/com/google/genai/AsyncTunings.java b/src/main/java/com/google/genai/AsyncTunings.java index 5e19914fff9..9d22ab6bd83 100644 --- a/src/main/java/com/google/genai/AsyncTunings.java +++ b/src/main/java/com/google/genai/AsyncTunings.java @@ -23,11 +23,15 @@ import com.google.genai.Common.BuiltRequest; import com.google.genai.errors.GenAiIOException; import com.google.genai.types.CancelTuningJobConfig; +import com.google.genai.types.CancelTuningJobParameters; import com.google.genai.types.CancelTuningJobResponse; import com.google.genai.types.CreateTuningJobConfig; +import com.google.genai.types.CreateTuningJobParametersPrivate; import com.google.genai.types.GetTuningJobConfig; +import com.google.genai.types.GetTuningJobParameters; import com.google.genai.types.JobState; import com.google.genai.types.ListTuningJobsConfig; +import com.google.genai.types.ListTuningJobsParameters; import com.google.genai.types.ListTuningJobsResponse; import com.google.genai.types.PreTunedModel; import com.google.genai.types.TuningDataset; @@ -48,25 +52,40 @@ public AsyncTunings(ApiClient apiClient) { } CompletableFuture privateGet(String name, GetTuningJobConfig config) { + GetTuningJobParameters.Builder parameterBuilder = GetTuningJobParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = tunings.buildRequestForPrivateGet(name, config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return tunings.processResponseForPrivateGet(res, config); + return tunings.processResponseForPrivateGet(res, config, parameterNode); } }); } CompletableFuture privateList(ListTuningJobsConfig config) { + ListTuningJobsParameters.Builder parameterBuilder = ListTuningJobsParameters.builder(); + + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = tunings.buildRequestForPrivateList(config); return this.apiClient .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return tunings.processResponseForPrivateList(res, config); + return tunings.processResponseForPrivateList(res, config, parameterNode); } }); } @@ -80,13 +99,22 @@ CompletableFuture privateList(ListTuningJobsConfig confi */ public CompletableFuture cancel( String name, CancelTuningJobConfig config) { + CancelTuningJobParameters.Builder parameterBuilder = CancelTuningJobParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = tunings.buildRequestForCancel(name, config); return this.apiClient .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) .thenApplyAsync( response -> { try (ApiResponse res = response) { - return tunings.processResponseForCancel(res, config); + return tunings.processResponseForCancel(res, config, parameterNode); } }); } @@ -96,6 +124,22 @@ CompletableFuture privateTune( PreTunedModel preTunedModel, TuningDataset trainingDataset, CreateTuningJobConfig config) { + CreateTuningJobParametersPrivate.Builder parameterBuilder = + CreateTuningJobParametersPrivate.builder(); + + if (!Common.isZero(baseModel)) { + parameterBuilder.baseModel(baseModel); + } + if (!Common.isZero(preTunedModel)) { + parameterBuilder.preTunedModel(preTunedModel); + } + if (!Common.isZero(trainingDataset)) { + parameterBuilder.trainingDataset(trainingDataset); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = tunings.buildRequestForPrivateTune(baseModel, preTunedModel, trainingDataset, config); return this.apiClient @@ -103,7 +147,7 @@ CompletableFuture privateTune( .thenApplyAsync( response -> { try (ApiResponse res = response) { - return tunings.processResponseForPrivateTune(res, config); + return tunings.processResponseForPrivateTune(res, config, parameterNode); } }); } @@ -113,6 +157,22 @@ CompletableFuture privateTuneMldev( PreTunedModel preTunedModel, TuningDataset trainingDataset, CreateTuningJobConfig config) { + CreateTuningJobParametersPrivate.Builder parameterBuilder = + CreateTuningJobParametersPrivate.builder(); + + if (!Common.isZero(baseModel)) { + parameterBuilder.baseModel(baseModel); + } + if (!Common.isZero(preTunedModel)) { + parameterBuilder.preTunedModel(preTunedModel); + } + if (!Common.isZero(trainingDataset)) { + parameterBuilder.trainingDataset(trainingDataset); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = tunings.buildRequestForPrivateTuneMldev(baseModel, preTunedModel, trainingDataset, config); return this.apiClient @@ -120,7 +180,7 @@ CompletableFuture privateTuneMldev( .thenApplyAsync( response -> { try (ApiResponse res = response) { - return tunings.processResponseForPrivateTuneMldev(res, config); + return tunings.processResponseForPrivateTuneMldev(res, config, parameterNode); } }); } diff --git a/src/main/java/com/google/genai/Models.java b/src/main/java/com/google/genai/Models.java index 68ddd78a162..869e3a15a3a 100644 --- a/src/main/java/com/google/genai/Models.java +++ b/src/main/java/com/google/genai/Models.java @@ -41,8 +41,9 @@ import com.google.genai.types.EditImageParameters; import com.google.genai.types.EditImageResponse; import com.google.genai.types.EmbedContentConfig; -import com.google.genai.types.EmbedContentParameters; +import com.google.genai.types.EmbedContentParametersPrivate; import com.google.genai.types.EmbedContentResponse; +import com.google.genai.types.EmbeddingApiType; import com.google.genai.types.GenerateContentConfig; import com.google.genai.types.GenerateContentParameters; import com.google.genai.types.GenerateContentResponse; @@ -135,7 +136,7 @@ void videoGenerationReferenceTypeMldevEnumValidate(Object enumValue) { } @ExcludeFromGeneratedCoverageReport - ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"data"}) != null) { Common.setValueByPath( @@ -159,7 +160,7 @@ ObjectNode blobToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"content"}) != null) { Common.setValueByPath( @@ -175,7 +176,8 @@ ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject) { citationMetadataFromMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"citationMetadata"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"tokenCount"}) != null) { @@ -238,7 +240,8 @@ ObjectNode candidateFromMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode citationMetadataFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode citationMetadataFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"citationSources"}) != null) { Common.setValueByPath( @@ -252,7 +255,7 @@ ObjectNode citationMetadataFromMldev(JsonNode fromObject, ObjectNode parentObjec @ExcludeFromGeneratedCoverageReport ObjectNode computeTokensParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -273,7 +276,8 @@ ObjectNode computeTokensParametersToVertex( } @ExcludeFromGeneratedCoverageReport - ObjectNode computeTokensResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode computeTokensResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -293,7 +297,8 @@ ObjectNode computeTokensResponseFromVertex(JsonNode fromObject, ObjectNode paren } @ExcludeFromGeneratedCoverageReport - ObjectNode contentEmbeddingFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode contentEmbeddingFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"values"}) != null) { Common.setValueByPath( @@ -309,14 +314,16 @@ ObjectNode contentEmbeddingFromVertex(JsonNode fromObject, ObjectNode parentObje contentEmbeddingStatisticsFromVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"statistics"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode contentEmbeddingStatisticsFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode contentEmbeddingStatisticsFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"truncated"}) != null) { Common.setValueByPath( @@ -336,7 +343,7 @@ ObjectNode contentEmbeddingStatisticsFromVertex(JsonNode fromObject, ObjectNode } @ExcludeFromGeneratedCoverageReport - ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"parts"}) != null) { ArrayNode keyArray = (ArrayNode) Common.getValueByPath(fromObject, new String[] {"parts"}); @@ -344,7 +351,7 @@ ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(partToMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add(partToMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"parts"}, result); } @@ -360,7 +367,8 @@ ObjectNode contentToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode controlReferenceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode controlReferenceConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"controlType"}) != null) { Common.setValueByPath( @@ -380,7 +388,8 @@ ObjectNode controlReferenceConfigToVertex(JsonNode fromObject, ObjectNode parent } @ExcludeFromGeneratedCoverageReport - ObjectNode countTokensConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode countTokensConfigToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))) { @@ -401,7 +410,8 @@ ObjectNode countTokensConfigToMldev(JsonNode fromObject, ObjectNode parentObject } @ExcludeFromGeneratedCoverageReport - ObjectNode countTokensConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode countTokensConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"systemInstruction"}) != null) { @@ -418,7 +428,7 @@ ObjectNode countTokensConfigToVertex(JsonNode fromObject, ObjectNode parentObjec ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(toolToVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add(toolToVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(parentObject, new String[] {"tools"}, result); } @@ -430,7 +440,8 @@ ObjectNode countTokensConfigToVertex(JsonNode fromObject, ObjectNode parentObjec generationConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"generationConfig"})), - toObject)); + toObject, + rootObject)); } return toObject; @@ -438,7 +449,7 @@ ObjectNode countTokensConfigToVertex(JsonNode fromObject, ObjectNode parentObjec @ExcludeFromGeneratedCoverageReport ObjectNode countTokensParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -456,7 +467,7 @@ ObjectNode countTokensParametersToMldev( ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(contentToMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add(contentToMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"contents"}, result); } @@ -466,7 +477,8 @@ ObjectNode countTokensParametersToMldev( countTokensConfigToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; @@ -474,7 +486,7 @@ ObjectNode countTokensParametersToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode countTokensParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -496,14 +508,16 @@ ObjectNode countTokensParametersToVertex( countTokensConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode countTokensResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode countTokensResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -530,7 +544,8 @@ ObjectNode countTokensResponseFromMldev(JsonNode fromObject, ObjectNode parentOb } @ExcludeFromGeneratedCoverageReport - ObjectNode countTokensResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode countTokensResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -551,7 +566,7 @@ ObjectNode countTokensResponseFromVertex(JsonNode fromObject, ObjectNode parentO @ExcludeFromGeneratedCoverageReport ObjectNode deleteModelParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -566,7 +581,7 @@ ObjectNode deleteModelParametersToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode deleteModelParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -580,7 +595,8 @@ ObjectNode deleteModelParametersToVertex( } @ExcludeFromGeneratedCoverageReport - ObjectNode deleteModelResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode deleteModelResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -593,7 +609,8 @@ ObjectNode deleteModelResponseFromMldev(JsonNode fromObject, ObjectNode parentOb } @ExcludeFromGeneratedCoverageReport - ObjectNode deleteModelResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode deleteModelResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -606,7 +623,8 @@ ObjectNode deleteModelResponseFromVertex(JsonNode fromObject, ObjectNode parentO } @ExcludeFromGeneratedCoverageReport - ObjectNode editImageConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode editImageConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"outputGcsUri"}) != null) { @@ -733,7 +751,7 @@ ObjectNode editImageConfigToVertex(JsonNode fromObject, ObjectNode parentObject) @ExcludeFromGeneratedCoverageReport ObjectNode editImageParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -757,7 +775,8 @@ ObjectNode editImageParametersToVertex( ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(referenceImageAPIToVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + referenceImageAPIToVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"instances[0]", "referenceImages"}, result); } @@ -767,14 +786,16 @@ ObjectNode editImageParametersToVertex( editImageConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode editImageResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode editImageResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -790,7 +811,8 @@ ObjectNode editImageResponseFromVertex(JsonNode fromObject, ObjectNode parentObj ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"generatedImages"}, result); } @@ -799,7 +821,8 @@ ObjectNode editImageResponseFromVertex(JsonNode fromObject, ObjectNode parentObj } @ExcludeFromGeneratedCoverageReport - ObjectNode embedContentConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode embedContentConfigToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"taskType"}) != null) { @@ -835,50 +858,111 @@ ObjectNode embedContentConfigToMldev(JsonNode fromObject, ObjectNode parentObjec } @ExcludeFromGeneratedCoverageReport - ObjectNode embedContentConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode embedContentConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); - if (Common.getValueByPath(fromObject, new String[] {"taskType"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"instances[]", "task_type"}, - Common.getValueByPath(fromObject, new String[] {"taskType"})); + JsonNode discriminatorTaskType = + (JsonNode) Common.getValueByPath(rootObject, new String[] {"embeddingApiType"}); + String discriminatorValueTaskType = + discriminatorTaskType == null ? "PREDICT" : discriminatorTaskType.asText(); + if (discriminatorValueTaskType.equals("PREDICT")) { + if (Common.getValueByPath(fromObject, new String[] {"taskType"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"instances[]", "task_type"}, + Common.getValueByPath(fromObject, new String[] {"taskType"})); + } + } else if (discriminatorValueTaskType.equals("EMBED_CONTENT")) { + if (Common.getValueByPath(fromObject, new String[] {"taskType"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"taskType"}, + Common.getValueByPath(fromObject, new String[] {"taskType"})); + } } - if (Common.getValueByPath(fromObject, new String[] {"title"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"instances[]", "title"}, - Common.getValueByPath(fromObject, new String[] {"title"})); + JsonNode discriminatorTitle = + (JsonNode) Common.getValueByPath(rootObject, new String[] {"embeddingApiType"}); + String discriminatorValueTitle = + discriminatorTitle == null ? "PREDICT" : discriminatorTitle.asText(); + if (discriminatorValueTitle.equals("PREDICT")) { + if (Common.getValueByPath(fromObject, new String[] {"title"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"instances[]", "title"}, + Common.getValueByPath(fromObject, new String[] {"title"})); + } + } else if (discriminatorValueTitle.equals("EMBED_CONTENT")) { + if (Common.getValueByPath(fromObject, new String[] {"title"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"title"}, + Common.getValueByPath(fromObject, new String[] {"title"})); + } } - if (Common.getValueByPath(fromObject, new String[] {"outputDimensionality"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"parameters", "outputDimensionality"}, - Common.getValueByPath(fromObject, new String[] {"outputDimensionality"})); + JsonNode discriminatorOutputDimensionality = + (JsonNode) Common.getValueByPath(rootObject, new String[] {"embeddingApiType"}); + String discriminatorValueOutputDimensionality = + discriminatorOutputDimensionality == null + ? "PREDICT" + : discriminatorOutputDimensionality.asText(); + if (discriminatorValueOutputDimensionality.equals("PREDICT")) { + if (Common.getValueByPath(fromObject, new String[] {"outputDimensionality"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "outputDimensionality"}, + Common.getValueByPath(fromObject, new String[] {"outputDimensionality"})); + } + } else if (discriminatorValueOutputDimensionality.equals("EMBED_CONTENT")) { + if (Common.getValueByPath(fromObject, new String[] {"outputDimensionality"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"outputDimensionality"}, + Common.getValueByPath(fromObject, new String[] {"outputDimensionality"})); + } } - if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"instances[]", "mimeType"}, - Common.getValueByPath(fromObject, new String[] {"mimeType"})); + JsonNode discriminatorMimeType = + (JsonNode) Common.getValueByPath(rootObject, new String[] {"embeddingApiType"}); + String discriminatorValueMimeType = + discriminatorMimeType == null ? "PREDICT" : discriminatorMimeType.asText(); + if (discriminatorValueMimeType.equals("PREDICT")) { + if (Common.getValueByPath(fromObject, new String[] {"mimeType"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"instances[]", "mimeType"}, + Common.getValueByPath(fromObject, new String[] {"mimeType"})); + } } - if (Common.getValueByPath(fromObject, new String[] {"autoTruncate"}) != null) { - Common.setValueByPath( - parentObject, - new String[] {"parameters", "autoTruncate"}, - Common.getValueByPath(fromObject, new String[] {"autoTruncate"})); + JsonNode discriminatorAutoTruncate = + (JsonNode) Common.getValueByPath(rootObject, new String[] {"embeddingApiType"}); + String discriminatorValueAutoTruncate = + discriminatorAutoTruncate == null ? "PREDICT" : discriminatorAutoTruncate.asText(); + if (discriminatorValueAutoTruncate.equals("PREDICT")) { + if (Common.getValueByPath(fromObject, new String[] {"autoTruncate"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"parameters", "autoTruncate"}, + Common.getValueByPath(fromObject, new String[] {"autoTruncate"})); + } + } else if (discriminatorValueAutoTruncate.equals("EMBED_CONTENT")) { + if (Common.getValueByPath(fromObject, new String[] {"autoTruncate"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"autoTruncate"}, + Common.getValueByPath(fromObject, new String[] {"autoTruncate"})); + } } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode embedContentParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ObjectNode embedContentParametersPrivateToMldev( + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -896,12 +980,23 @@ ObjectNode embedContentParametersToMldev( this.apiClient, Common.getValueByPath(fromObject, new String[] {"contents"}))); } + if (Common.getValueByPath(fromObject, new String[] {"content"}) != null) { + JsonNode unused = + contentToMldev( + JsonSerializable.toJsonNode( + Transformers.tContent( + Common.getValueByPath(fromObject, new String[] {"content"}))), + toObject, + rootObject); + } + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { JsonNode unused = embedContentConfigToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } Common.setValueByPath( @@ -909,12 +1004,13 @@ ObjectNode embedContentParametersToMldev( new String[] {"requests[]", "model"}, Transformers.tModel( this.apiClient, Common.getValueByPath(fromObject, new String[] {"model"}))); + return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode embedContentParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ObjectNode embedContentParametersPrivateToVertex( + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -924,12 +1020,31 @@ ObjectNode embedContentParametersToVertex( this.apiClient, Common.getValueByPath(fromObject, new String[] {"model"}))); } - if (Common.getValueByPath(fromObject, new String[] {"contents"}) != null) { - Common.setValueByPath( - toObject, - new String[] {"instances[]", "content"}, - Transformers.tContentsForEmbed( - this.apiClient, Common.getValueByPath(fromObject, new String[] {"contents"}))); + JsonNode discriminatorContents = + (JsonNode) Common.getValueByPath(rootObject, new String[] {"embeddingApiType"}); + String discriminatorValueContents = + discriminatorContents == null ? "PREDICT" : discriminatorContents.asText(); + if (discriminatorValueContents.equals("PREDICT")) { + if (Common.getValueByPath(fromObject, new String[] {"contents"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"instances[]", "content"}, + Transformers.tContentsForEmbed( + this.apiClient, Common.getValueByPath(fromObject, new String[] {"contents"}))); + } + } + + JsonNode discriminatorContent = + (JsonNode) Common.getValueByPath(rootObject, new String[] {"embeddingApiType"}); + String discriminatorValueContent = + discriminatorContent == null ? "PREDICT" : discriminatorContent.asText(); + if (discriminatorValueContent.equals("EMBED_CONTENT")) { + if (Common.getValueByPath(fromObject, new String[] {"content"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"content"}, + Transformers.tContent(Common.getValueByPath(fromObject, new String[] {"content"}))); + } } if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { @@ -937,14 +1052,16 @@ ObjectNode embedContentParametersToVertex( embedContentConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode embedContentResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode embedContentResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -971,7 +1088,8 @@ ObjectNode embedContentResponseFromMldev(JsonNode fromObject, ObjectNode parentO } @ExcludeFromGeneratedCoverageReport - ObjectNode embedContentResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode embedContentResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -988,7 +1106,8 @@ ObjectNode embedContentResponseFromVertex(JsonNode fromObject, ObjectNode parent ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(contentEmbeddingFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + contentEmbeddingFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"embeddings"}, result); } @@ -1000,11 +1119,35 @@ ObjectNode embedContentResponseFromVertex(JsonNode fromObject, ObjectNode parent Common.getValueByPath(fromObject, new String[] {"metadata"})); } + if (rootObject != null + && Common.getValueByPath(rootObject, new String[] {"embeddingApiType"}) != null + && ((JsonNode) Common.getValueByPath(rootObject, new String[] {"embeddingApiType"})) + .asText() + .equals("EMBED_CONTENT")) { + JsonNode embedding = (JsonNode) Common.getValueByPath(fromObject, new String[] {"embedding"}); + JsonNode usageMetadata = + (JsonNode) Common.getValueByPath(fromObject, new String[] {"usageMetadata"}); + JsonNode truncated = (JsonNode) Common.getValueByPath(fromObject, new String[] {"truncated"}); + if (embedding != null) { + ObjectNode stats = JsonSerializable.objectMapper.createObjectNode(); + if (usageMetadata != null && usageMetadata.get("promptTokenCount") != null) { + stats.set("token_count", usageMetadata.get("promptTokenCount")); + } + if (truncated != null) { + stats.set("truncated", truncated); + } + ((ObjectNode) embedding).set("statistics", stats); + ArrayNode embeddings = JsonSerializable.objectMapper.createArrayNode(); + embeddings.add(embedding); + Common.setValueByPath(toObject, new String[] {"embeddings"}, embeddings); + } + } + return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode endpointFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode endpointFromVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"endpoint"}) != null) { Common.setValueByPath( @@ -1024,7 +1167,7 @@ ObjectNode endpointFromVertex(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"displayName"}))) { throw new IllegalArgumentException("displayName parameter is not supported in Gemini API."); @@ -1048,7 +1191,8 @@ ObjectNode fileDataToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode functionCallToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"id"}) != null) { Common.setValueByPath( @@ -1081,7 +1225,8 @@ ObjectNode functionCallToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode functionCallingConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode functionCallingConfigToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"mode"}) != null) { Common.setValueByPath( @@ -1107,7 +1252,8 @@ ObjectNode functionCallingConfigToMldev(JsonNode fromObject, ObjectNode parentOb } @ExcludeFromGeneratedCoverageReport - ObjectNode functionDeclarationToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode functionDeclarationToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"behavior"}))) { throw new IllegalArgumentException("behavior parameter is not supported in Vertex AI."); @@ -1160,7 +1306,7 @@ ObjectNode functionDeclarationToVertex(JsonNode fromObject, ObjectNode parentObj @ExcludeFromGeneratedCoverageReport ObjectNode generateContentConfigToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"systemInstruction"}) != null) { @@ -1171,7 +1317,8 @@ ObjectNode generateContentConfigToMldev( JsonSerializable.toJsonNode( Transformers.tContent( Common.getValueByPath(fromObject, new String[] {"systemInstruction"}))), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"temperature"}) != null) { @@ -1288,7 +1435,7 @@ ObjectNode generateContentConfigToMldev( ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(safetySettingToMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add(safetySettingToMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(parentObject, new String[] {"safetySettings"}, result); } @@ -1301,7 +1448,9 @@ ObjectNode generateContentConfigToMldev( ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(toolToMldev(JsonSerializable.toJsonNode(Transformers.tTool(item)), toObject)); + result.add( + toolToMldev( + JsonSerializable.toJsonNode(Transformers.tTool(item)), toObject, rootObject)); } Common.setValueByPath(parentObject, new String[] {"tools"}, result); } @@ -1313,7 +1462,8 @@ ObjectNode generateContentConfigToMldev( toolConfigToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"toolConfig"})), - toObject)); + toObject, + rootObject)); } if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"labels"}))) { @@ -1369,7 +1519,8 @@ ObjectNode generateContentConfigToMldev( imageConfigToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"imageConfig"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"enableEnhancedCivicAnswers"}) != null) { @@ -1384,7 +1535,7 @@ ObjectNode generateContentConfigToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode generateContentConfigToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"systemInstruction"}) != null) { @@ -1522,7 +1673,9 @@ ObjectNode generateContentConfigToVertex( ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(toolToVertex(JsonSerializable.toJsonNode(Transformers.tTool(item)), toObject)); + result.add( + toolToVertex( + JsonSerializable.toJsonNode(Transformers.tTool(item)), toObject, rootObject)); } Common.setValueByPath(parentObject, new String[] {"tools"}, result); } @@ -1571,7 +1724,8 @@ ObjectNode generateContentConfigToVertex( JsonSerializable.toJsonNode( Transformers.tSpeechConfig( Common.getValueByPath(fromObject, new String[] {"speechConfig"}))), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"audioTimestamp"}) != null) { @@ -1595,7 +1749,8 @@ ObjectNode generateContentConfigToVertex( imageConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"imageConfig"})), - toObject)); + toObject, + rootObject)); } if (!Common.isZero( @@ -1609,7 +1764,7 @@ ObjectNode generateContentConfigToVertex( @ExcludeFromGeneratedCoverageReport ObjectNode generateContentParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -1627,7 +1782,7 @@ ObjectNode generateContentParametersToMldev( ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(contentToMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add(contentToMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"contents"}, result); } @@ -1640,7 +1795,8 @@ ObjectNode generateContentParametersToMldev( apiClient, JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject)); + toObject, + rootObject)); } return toObject; @@ -1648,7 +1804,7 @@ ObjectNode generateContentParametersToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode generateContentParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -1673,14 +1829,16 @@ ObjectNode generateContentParametersToVertex( apiClient, JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generateContentResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateContentResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -1696,7 +1854,7 @@ ObjectNode generateContentResponseFromMldev(JsonNode fromObject, ObjectNode pare ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(candidateFromMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add(candidateFromMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"candidates"}, result); } @@ -1733,7 +1891,8 @@ ObjectNode generateContentResponseFromMldev(JsonNode fromObject, ObjectNode pare } @ExcludeFromGeneratedCoverageReport - ObjectNode generateContentResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateContentResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -1788,7 +1947,8 @@ ObjectNode generateContentResponseFromVertex(JsonNode fromObject, ObjectNode par } @ExcludeFromGeneratedCoverageReport - ObjectNode generateImagesConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateImagesConfigToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"outputGcsUri"}))) { @@ -1901,7 +2061,8 @@ ObjectNode generateImagesConfigToMldev(JsonNode fromObject, ObjectNode parentObj } @ExcludeFromGeneratedCoverageReport - ObjectNode generateImagesConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateImagesConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"outputGcsUri"}) != null) { @@ -2028,7 +2189,7 @@ ObjectNode generateImagesConfigToVertex(JsonNode fromObject, ObjectNode parentOb @ExcludeFromGeneratedCoverageReport ObjectNode generateImagesParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -2050,7 +2211,8 @@ ObjectNode generateImagesParametersToMldev( generateImagesConfigToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; @@ -2058,7 +2220,7 @@ ObjectNode generateImagesParametersToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode generateImagesParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -2080,14 +2242,16 @@ ObjectNode generateImagesParametersToVertex( generateImagesConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generateImagesResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateImagesResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -2103,7 +2267,8 @@ ObjectNode generateImagesResponseFromMldev(JsonNode fromObject, ObjectNode paren ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(generatedImageFromMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add( + generatedImageFromMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"generatedImages"}, result); } @@ -2117,14 +2282,16 @@ ObjectNode generateImagesResponseFromMldev(JsonNode fromObject, ObjectNode paren JsonSerializable.toJsonNode( Common.getValueByPath( fromObject, new String[] {"positivePromptSafetyAttributes"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generateImagesResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateImagesResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -2140,7 +2307,8 @@ ObjectNode generateImagesResponseFromVertex(JsonNode fromObject, ObjectNode pare ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"generatedImages"}, result); } @@ -2154,14 +2322,16 @@ ObjectNode generateImagesResponseFromVertex(JsonNode fromObject, ObjectNode pare JsonSerializable.toJsonNode( Common.getValueByPath( fromObject, new String[] {"positivePromptSafetyAttributes"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generateVideosConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateVideosConfigToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"numberOfVideos"}) != null) { @@ -2240,7 +2410,8 @@ ObjectNode generateVideosConfigToMldev(JsonNode fromObject, ObjectNode parentObj imageToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"lastFrame"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"referenceImages"}) != null) { @@ -2251,7 +2422,8 @@ ObjectNode generateVideosConfigToMldev(JsonNode fromObject, ObjectNode parentObj for (JsonNode item : keyArray) { result.add( - videoGenerationReferenceImageToMldev(JsonSerializable.toJsonNode(item), toObject)); + videoGenerationReferenceImageToMldev( + JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(parentObject, new String[] {"instances[0]", "referenceImages"}, result); } @@ -2269,7 +2441,8 @@ ObjectNode generateVideosConfigToMldev(JsonNode fromObject, ObjectNode parentObj } @ExcludeFromGeneratedCoverageReport - ObjectNode generateVideosConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateVideosConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"numberOfVideos"}) != null) { @@ -2363,7 +2536,8 @@ ObjectNode generateVideosConfigToVertex(JsonNode fromObject, ObjectNode parentOb imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"lastFrame"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"referenceImages"}) != null) { @@ -2374,7 +2548,8 @@ ObjectNode generateVideosConfigToVertex(JsonNode fromObject, ObjectNode parentOb for (JsonNode item : keyArray) { result.add( - videoGenerationReferenceImageToVertex(JsonSerializable.toJsonNode(item), toObject)); + videoGenerationReferenceImageToVertex( + JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(parentObject, new String[] {"instances[0]", "referenceImages"}, result); } @@ -2385,7 +2560,8 @@ ObjectNode generateVideosConfigToVertex(JsonNode fromObject, ObjectNode parentOb new String[] {"instances[0]", "mask"}, videoGenerationMaskToVertex( JsonSerializable.toJsonNode(Common.getValueByPath(fromObject, new String[] {"mask"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"compressionQuality"}) != null) { @@ -2399,7 +2575,8 @@ ObjectNode generateVideosConfigToVertex(JsonNode fromObject, ObjectNode parentOb } @ExcludeFromGeneratedCoverageReport - ObjectNode generateVideosOperationFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateVideosOperationFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( @@ -2438,14 +2615,16 @@ ObjectNode generateVideosOperationFromMldev(JsonNode fromObject, ObjectNode pare JsonSerializable.toJsonNode( Common.getValueByPath( fromObject, new String[] {"response", "generateVideoResponse"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generateVideosOperationFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateVideosOperationFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( @@ -2482,7 +2661,8 @@ ObjectNode generateVideosOperationFromVertex(JsonNode fromObject, ObjectNode par generateVideosResponseFromVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"response"})), - toObject)); + toObject, + rootObject)); } return toObject; @@ -2490,7 +2670,7 @@ ObjectNode generateVideosOperationFromVertex(JsonNode fromObject, ObjectNode par @ExcludeFromGeneratedCoverageReport ObjectNode generateVideosParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -2514,7 +2694,8 @@ ObjectNode generateVideosParametersToMldev( imageToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"video"}) != null) { @@ -2524,7 +2705,8 @@ ObjectNode generateVideosParametersToMldev( videoToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"video"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"source"}) != null) { @@ -2532,7 +2714,8 @@ ObjectNode generateVideosParametersToMldev( generateVideosSourceToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"source"})), - toObject); + toObject, + rootObject); } if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { @@ -2540,7 +2723,8 @@ ObjectNode generateVideosParametersToMldev( generateVideosConfigToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; @@ -2548,7 +2732,7 @@ ObjectNode generateVideosParametersToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode generateVideosParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -2572,7 +2756,8 @@ ObjectNode generateVideosParametersToVertex( imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"video"}) != null) { @@ -2582,7 +2767,8 @@ ObjectNode generateVideosParametersToVertex( videoToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"video"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"source"}) != null) { @@ -2590,7 +2776,8 @@ ObjectNode generateVideosParametersToVertex( generateVideosSourceToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"source"})), - toObject); + toObject, + rootObject); } if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { @@ -2598,14 +2785,16 @@ ObjectNode generateVideosParametersToVertex( generateVideosConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generateVideosResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateVideosResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"generatedSamples"}) != null) { ArrayNode keyArray = @@ -2614,7 +2803,8 @@ ObjectNode generateVideosResponseFromMldev(JsonNode fromObject, ObjectNode paren ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(generatedVideoFromMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add( + generatedVideoFromMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"generatedVideos"}, result); } @@ -2637,7 +2827,8 @@ ObjectNode generateVideosResponseFromMldev(JsonNode fromObject, ObjectNode paren } @ExcludeFromGeneratedCoverageReport - ObjectNode generateVideosResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateVideosResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"videos"}) != null) { ArrayNode keyArray = (ArrayNode) Common.getValueByPath(fromObject, new String[] {"videos"}); @@ -2645,7 +2836,8 @@ ObjectNode generateVideosResponseFromVertex(JsonNode fromObject, ObjectNode pare ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(generatedVideoFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + generatedVideoFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"generatedVideos"}, result); } @@ -2668,7 +2860,8 @@ ObjectNode generateVideosResponseFromVertex(JsonNode fromObject, ObjectNode pare } @ExcludeFromGeneratedCoverageReport - ObjectNode generateVideosSourceToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateVideosSourceToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"prompt"}) != null) { Common.setValueByPath( @@ -2684,7 +2877,8 @@ ObjectNode generateVideosSourceToMldev(JsonNode fromObject, ObjectNode parentObj imageToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"video"}) != null) { @@ -2694,14 +2888,16 @@ ObjectNode generateVideosSourceToMldev(JsonNode fromObject, ObjectNode parentObj videoToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"video"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generateVideosSourceToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generateVideosSourceToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"prompt"}) != null) { Common.setValueByPath( @@ -2717,7 +2913,8 @@ ObjectNode generateVideosSourceToVertex(JsonNode fromObject, ObjectNode parentOb imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"video"}) != null) { @@ -2727,14 +2924,16 @@ ObjectNode generateVideosSourceToVertex(JsonNode fromObject, ObjectNode parentOb videoToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"video"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generatedImageFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generatedImageFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"_self"}) != null) { Common.setValueByPath( @@ -2743,7 +2942,8 @@ ObjectNode generatedImageFromMldev(JsonNode fromObject, ObjectNode parentObject) imageFromMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"_self"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"raiFilteredReason"}) != null) { @@ -2760,14 +2960,16 @@ ObjectNode generatedImageFromMldev(JsonNode fromObject, ObjectNode parentObject) safetyAttributesFromMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"_self"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generatedImageFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generatedImageFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"_self"}) != null) { Common.setValueByPath( @@ -2776,7 +2978,8 @@ ObjectNode generatedImageFromVertex(JsonNode fromObject, ObjectNode parentObject imageFromVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"_self"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"raiFilteredReason"}) != null) { @@ -2793,7 +2996,8 @@ ObjectNode generatedImageFromVertex(JsonNode fromObject, ObjectNode parentObject safetyAttributesFromVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"_self"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"prompt"}) != null) { @@ -2807,7 +3011,8 @@ ObjectNode generatedImageFromVertex(JsonNode fromObject, ObjectNode parentObject } @ExcludeFromGeneratedCoverageReport - ObjectNode generatedImageMaskFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generatedImageMaskFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"_self"}) != null) { Common.setValueByPath( @@ -2816,7 +3021,8 @@ ObjectNode generatedImageMaskFromVertex(JsonNode fromObject, ObjectNode parentOb imageFromVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"_self"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { @@ -2830,7 +3036,8 @@ ObjectNode generatedImageMaskFromVertex(JsonNode fromObject, ObjectNode parentOb } @ExcludeFromGeneratedCoverageReport - ObjectNode generatedVideoFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generatedVideoFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"video"}) != null) { Common.setValueByPath( @@ -2839,14 +3046,16 @@ ObjectNode generatedVideoFromMldev(JsonNode fromObject, ObjectNode parentObject) videoFromMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"video"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generatedVideoFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generatedVideoFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"_self"}) != null) { Common.setValueByPath( @@ -2855,14 +3064,16 @@ ObjectNode generatedVideoFromVertex(JsonNode fromObject, ObjectNode parentObject videoFromVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"_self"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode generationConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"modelSelectionConfig"}) != null) { Common.setValueByPath( @@ -2983,7 +3194,8 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject speechConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"speechConfig"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"stopSequences"}) != null) { @@ -3032,7 +3244,7 @@ ObjectNode generationConfigToVertex(JsonNode fromObject, ObjectNode parentObject @ExcludeFromGeneratedCoverageReport ObjectNode getModelParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -3047,7 +3259,7 @@ ObjectNode getModelParametersToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode getModelParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -3061,7 +3273,7 @@ ObjectNode getModelParametersToVertex( } @ExcludeFromGeneratedCoverageReport - ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"authConfig"}))) { throw new IllegalArgumentException("authConfig parameter is not supported in Gemini API."); @@ -3078,7 +3290,8 @@ ObjectNode googleMapsToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode googleSearchToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"excludeDomains"}))) { throw new IllegalArgumentException( @@ -3101,7 +3314,7 @@ ObjectNode googleSearchToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"aspectRatio"}) != null) { Common.setValueByPath( @@ -3132,7 +3345,8 @@ ObjectNode imageConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode imageConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode imageConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"aspectRatio"}) != null) { Common.setValueByPath( @@ -3166,7 +3380,7 @@ ObjectNode imageConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode imageFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode imageFromMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"bytesBase64Encoded"}) != null) { @@ -3188,7 +3402,7 @@ ObjectNode imageFromMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode imageFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode imageFromVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"gcsUri"}) != null) { Common.setValueByPath( @@ -3216,7 +3430,7 @@ ObjectNode imageFromVertex(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode imageToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode imageToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (!Common.isZero(Common.getValueByPath(fromObject, new String[] {"gcsUri"}))) { throw new IllegalArgumentException("gcsUri parameter is not supported in Gemini API."); @@ -3240,7 +3454,7 @@ ObjectNode imageToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode imageToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode imageToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"gcsUri"}) != null) { Common.setValueByPath( @@ -3268,7 +3482,7 @@ ObjectNode imageToVertex(JsonNode fromObject, ObjectNode parentObject) { @ExcludeFromGeneratedCoverageReport ObjectNode listModelsConfigToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { @@ -3305,7 +3519,7 @@ ObjectNode listModelsConfigToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode listModelsConfigToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { @@ -3342,7 +3556,7 @@ ObjectNode listModelsConfigToVertex( @ExcludeFromGeneratedCoverageReport ObjectNode listModelsParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { JsonNode unused = @@ -3350,7 +3564,8 @@ ObjectNode listModelsParametersToMldev( apiClient, JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; @@ -3358,7 +3573,7 @@ ObjectNode listModelsParametersToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode listModelsParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { JsonNode unused = @@ -3366,14 +3581,16 @@ ObjectNode listModelsParametersToVertex( apiClient, JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode listModelsResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode listModelsResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -3398,7 +3615,7 @@ ObjectNode listModelsResponseFromMldev(JsonNode fromObject, ObjectNode parentObj ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(modelFromMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add(modelFromMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"models"}, result); } @@ -3407,7 +3624,8 @@ ObjectNode listModelsResponseFromMldev(JsonNode fromObject, ObjectNode parentObj } @ExcludeFromGeneratedCoverageReport - ObjectNode listModelsResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode listModelsResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -3432,7 +3650,7 @@ ObjectNode listModelsResponseFromVertex(JsonNode fromObject, ObjectNode parentOb ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(modelFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add(modelFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"models"}, result); } @@ -3441,7 +3659,8 @@ ObjectNode listModelsResponseFromVertex(JsonNode fromObject, ObjectNode parentOb } @ExcludeFromGeneratedCoverageReport - ObjectNode maskReferenceConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode maskReferenceConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"maskMode"}) != null) { Common.setValueByPath( @@ -3468,7 +3687,7 @@ ObjectNode maskReferenceConfigToVertex(JsonNode fromObject, ObjectNode parentObj } @ExcludeFromGeneratedCoverageReport - ObjectNode modelFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode modelFromMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( @@ -3565,7 +3784,7 @@ ObjectNode modelFromMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode modelFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode modelFromVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( @@ -3602,7 +3821,7 @@ ObjectNode modelFromVertex(JsonNode fromObject, ObjectNode parentObject) { ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(endpointFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add(endpointFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"endpoints"}, result); } @@ -3621,7 +3840,8 @@ ObjectNode modelFromVertex(JsonNode fromObject, ObjectNode parentObject) { tunedModelInfoFromVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"_self"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"defaultCheckpointId"}) != null) { @@ -3642,7 +3862,7 @@ ObjectNode modelFromVertex(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"mediaResolution"}) != null) { Common.setValueByPath( @@ -3672,7 +3892,8 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { fileDataToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"fileData"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"functionCall"}) != null) { @@ -3682,7 +3903,8 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { functionCallToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"functionCall"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"functionResponse"}) != null) { @@ -3699,7 +3921,8 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { blobToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"inlineData"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"text"}) != null) { @@ -3734,7 +3957,8 @@ ObjectNode partToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode productImageToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode productImageToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"productImage"}) != null) { Common.setValueByPath( @@ -3743,14 +3967,16 @@ ObjectNode productImageToVertex(JsonNode fromObject, ObjectNode parentObject) { imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"productImage"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode recontextImageConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode recontextImageConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"numberOfImages"}) != null) { @@ -3835,7 +4061,7 @@ ObjectNode recontextImageConfigToVertex(JsonNode fromObject, ObjectNode parentOb @ExcludeFromGeneratedCoverageReport ObjectNode recontextImageParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -3850,7 +4076,8 @@ ObjectNode recontextImageParametersToVertex( recontextImageSourceToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"source"})), - toObject); + toObject, + rootObject); } if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { @@ -3858,14 +4085,16 @@ ObjectNode recontextImageParametersToVertex( recontextImageConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode recontextImageResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode recontextImageResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"predictions"}) != null) { ArrayNode keyArray = @@ -3874,7 +4103,8 @@ ObjectNode recontextImageResponseFromVertex(JsonNode fromObject, ObjectNode pare ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"generatedImages"}, result); } @@ -3883,7 +4113,8 @@ ObjectNode recontextImageResponseFromVertex(JsonNode fromObject, ObjectNode pare } @ExcludeFromGeneratedCoverageReport - ObjectNode recontextImageSourceToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode recontextImageSourceToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"prompt"}) != null) { Common.setValueByPath( @@ -3899,7 +4130,8 @@ ObjectNode recontextImageSourceToVertex(JsonNode fromObject, ObjectNode parentOb imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"personImage"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"productImages"}) != null) { @@ -3909,7 +4141,7 @@ ObjectNode recontextImageSourceToVertex(JsonNode fromObject, ObjectNode parentOb ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(productImageToVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add(productImageToVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(parentObject, new String[] {"instances[0]", "productImages"}, result); } @@ -3918,7 +4150,8 @@ ObjectNode recontextImageSourceToVertex(JsonNode fromObject, ObjectNode parentOb } @ExcludeFromGeneratedCoverageReport - ObjectNode referenceImageAPIToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode referenceImageAPIToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"referenceImage"}) != null) { Common.setValueByPath( @@ -3927,7 +4160,8 @@ ObjectNode referenceImageAPIToVertex(JsonNode fromObject, ObjectNode parentObjec imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"referenceImage"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"referenceId"}) != null) { @@ -3951,7 +4185,8 @@ ObjectNode referenceImageAPIToVertex(JsonNode fromObject, ObjectNode parentObjec maskReferenceConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"maskImageConfig"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"controlImageConfig"}) != null) { @@ -3961,7 +4196,8 @@ ObjectNode referenceImageAPIToVertex(JsonNode fromObject, ObjectNode parentObjec controlReferenceConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"controlImageConfig"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"styleImageConfig"}) != null) { @@ -3982,7 +4218,8 @@ ObjectNode referenceImageAPIToVertex(JsonNode fromObject, ObjectNode parentObjec } @ExcludeFromGeneratedCoverageReport - ObjectNode safetyAttributesFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode safetyAttributesFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"safetyAttributes", "categories"}) != null) { @@ -4010,7 +4247,8 @@ ObjectNode safetyAttributesFromMldev(JsonNode fromObject, ObjectNode parentObjec } @ExcludeFromGeneratedCoverageReport - ObjectNode safetyAttributesFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode safetyAttributesFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"safetyAttributes", "categories"}) != null) { @@ -4038,7 +4276,8 @@ ObjectNode safetyAttributesFromVertex(JsonNode fromObject, ObjectNode parentObje } @ExcludeFromGeneratedCoverageReport - ObjectNode safetySettingToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode safetySettingToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"category"}) != null) { Common.setValueByPath( @@ -4062,7 +4301,8 @@ ObjectNode safetySettingToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode scribbleImageToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode scribbleImageToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"image"}) != null) { Common.setValueByPath( @@ -4071,14 +4311,16 @@ ObjectNode scribbleImageToVertex(JsonNode fromObject, ObjectNode parentObject) { imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode segmentImageConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode segmentImageConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"mode"}) != null) { @@ -4128,7 +4370,7 @@ ObjectNode segmentImageConfigToVertex(JsonNode fromObject, ObjectNode parentObje @ExcludeFromGeneratedCoverageReport ObjectNode segmentImageParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -4143,7 +4385,8 @@ ObjectNode segmentImageParametersToVertex( segmentImageSourceToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"source"})), - toObject); + toObject, + rootObject); } if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { @@ -4151,14 +4394,16 @@ ObjectNode segmentImageParametersToVertex( segmentImageConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode segmentImageResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode segmentImageResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"predictions"}) != null) { ArrayNode keyArray = @@ -4167,7 +4412,8 @@ ObjectNode segmentImageResponseFromVertex(JsonNode fromObject, ObjectNode parent ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(generatedImageMaskFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + generatedImageMaskFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"generatedMasks"}, result); } @@ -4176,7 +4422,8 @@ ObjectNode segmentImageResponseFromVertex(JsonNode fromObject, ObjectNode parent } @ExcludeFromGeneratedCoverageReport - ObjectNode segmentImageSourceToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode segmentImageSourceToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"prompt"}) != null) { Common.setValueByPath( @@ -4192,7 +4439,8 @@ ObjectNode segmentImageSourceToVertex(JsonNode fromObject, ObjectNode parentObje imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"scribbleImage"}) != null) { @@ -4202,14 +4450,16 @@ ObjectNode segmentImageSourceToVertex(JsonNode fromObject, ObjectNode parentObje scribbleImageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"scribbleImage"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode speechConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode speechConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"voiceConfig"}) != null) { Common.setValueByPath( @@ -4235,7 +4485,7 @@ ObjectNode speechConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"}) != null) { Common.setValueByPath( @@ -4244,7 +4494,8 @@ ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { functionCallingConfigToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"functionCallingConfig"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"retrievalConfig"}) != null) { @@ -4258,7 +4509,7 @@ ObjectNode toolConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { Common.setValueByPath( @@ -4311,7 +4562,8 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { googleMapsToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"googleMaps"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"googleSearch"}) != null) { @@ -4321,7 +4573,8 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { googleSearchToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"googleSearch"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"urlContext"}) != null) { @@ -4335,7 +4588,7 @@ ObjectNode toolToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"functionDeclarations"}) != null) { ArrayNode keyArray = @@ -4344,7 +4597,8 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(functionDeclarationToVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + functionDeclarationToVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"functionDeclarations"}, result); } @@ -4413,7 +4667,8 @@ ObjectNode toolToVertex(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode tunedModelInfoFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode tunedModelInfoFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath( fromObject, new String[] {"labels", "google-vertex-llm-tuning-base-model-id"}) @@ -4443,7 +4698,8 @@ ObjectNode tunedModelInfoFromVertex(JsonNode fromObject, ObjectNode parentObject } @ExcludeFromGeneratedCoverageReport - ObjectNode updateModelConfigToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode updateModelConfigToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { @@ -4471,7 +4727,8 @@ ObjectNode updateModelConfigToMldev(JsonNode fromObject, ObjectNode parentObject } @ExcludeFromGeneratedCoverageReport - ObjectNode updateModelConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode updateModelConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { @@ -4500,7 +4757,7 @@ ObjectNode updateModelConfigToVertex(JsonNode fromObject, ObjectNode parentObjec @ExcludeFromGeneratedCoverageReport ObjectNode updateModelParametersToMldev( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -4515,7 +4772,8 @@ ObjectNode updateModelParametersToMldev( updateModelConfigToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; @@ -4523,7 +4781,7 @@ ObjectNode updateModelParametersToMldev( @ExcludeFromGeneratedCoverageReport ObjectNode updateModelParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -4538,14 +4796,16 @@ ObjectNode updateModelParametersToVertex( updateModelConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode upscaleImageAPIConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode upscaleImageAPIConfigToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"outputGcsUri"}) != null) { @@ -4630,7 +4890,7 @@ ObjectNode upscaleImageAPIConfigToVertex(JsonNode fromObject, ObjectNode parentO @ExcludeFromGeneratedCoverageReport ObjectNode upscaleImageAPIParametersToVertex( - ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) { + ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"model"}) != null) { Common.setValueByPath( @@ -4647,7 +4907,8 @@ ObjectNode upscaleImageAPIParametersToVertex( imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"upscaleFactor"}) != null) { @@ -4662,14 +4923,16 @@ ObjectNode upscaleImageAPIParametersToVertex( upscaleImageAPIConfigToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"config"})), - toObject); + toObject, + rootObject); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode upscaleImageResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode upscaleImageResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -4685,7 +4948,8 @@ ObjectNode upscaleImageResponseFromVertex(JsonNode fromObject, ObjectNode parent ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add( + generatedImageFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"generatedImages"}, result); } @@ -4694,7 +4958,7 @@ ObjectNode upscaleImageResponseFromVertex(JsonNode fromObject, ObjectNode parent } @ExcludeFromGeneratedCoverageReport - ObjectNode videoFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode videoFromMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"uri"}) != null) { Common.setValueByPath( @@ -4719,7 +4983,7 @@ ObjectNode videoFromMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode videoFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode videoFromVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"gcsUri"}) != null) { Common.setValueByPath( @@ -4747,7 +5011,8 @@ ObjectNode videoFromVertex(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode videoGenerationMaskToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode videoGenerationMaskToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"image"}) != null) { Common.setValueByPath( @@ -4756,7 +5021,8 @@ ObjectNode videoGenerationMaskToVertex(JsonNode fromObject, ObjectNode parentObj imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"maskMode"}) != null) { @@ -4770,7 +5036,8 @@ ObjectNode videoGenerationMaskToVertex(JsonNode fromObject, ObjectNode parentObj } @ExcludeFromGeneratedCoverageReport - ObjectNode videoGenerationReferenceImageToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode videoGenerationReferenceImageToMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"image"}) != null) { Common.setValueByPath( @@ -4779,7 +5046,8 @@ ObjectNode videoGenerationReferenceImageToMldev(JsonNode fromObject, ObjectNode imageToMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"referenceType"}) != null) { @@ -4795,7 +5063,8 @@ ObjectNode videoGenerationReferenceImageToMldev(JsonNode fromObject, ObjectNode } @ExcludeFromGeneratedCoverageReport - ObjectNode videoGenerationReferenceImageToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode videoGenerationReferenceImageToVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"image"}) != null) { Common.setValueByPath( @@ -4804,7 +5073,8 @@ ObjectNode videoGenerationReferenceImageToVertex(JsonNode fromObject, ObjectNode imageToVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"image"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"referenceType"}) != null) { @@ -4818,7 +5088,7 @@ ObjectNode videoGenerationReferenceImageToVertex(JsonNode fromObject, ObjectNode } @ExcludeFromGeneratedCoverageReport - ObjectNode videoToMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode videoToMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"uri"}) != null) { Common.setValueByPath( @@ -4843,7 +5113,7 @@ ObjectNode videoToMldev(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode videoToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode videoToVertex(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"uri"}) != null) { Common.setValueByPath( @@ -4889,10 +5159,10 @@ BuiltRequest buildRequestForPrivateGenerateContent( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = generateContentParametersToVertex(this.apiClient, parameterNode, null); + body = generateContentParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:generateContent", body.get("_url")); } else { - body = generateContentParametersToMldev(this.apiClient, parameterNode, null); + body = generateContentParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{model}:generateContent", body.get("_url")); } else { @@ -4918,7 +5188,7 @@ BuiltRequest buildRequestForPrivateGenerateContent( /** A shared processResponse function for both sync and async methods. */ GenerateContentResponse processResponseForPrivateGenerateContent( - ApiResponse response, GenerateContentConfig config) { + ApiResponse response, GenerateContentConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -4946,11 +5216,11 @@ GenerateContentResponse processResponseForPrivateGenerateContent( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = generateContentResponseFromVertex(responseNode, null); + responseNode = generateContentResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = generateContentResponseFromMldev(responseNode, null); + responseNode = generateContentResponseFromMldev(responseNode, null, parameterNode); } GenerateContentResponse sdkResponse = @@ -4968,12 +5238,24 @@ GenerateContentResponse processResponseForPrivateGenerateContent( GenerateContentResponse privateGenerateContent( String model, List contents, GenerateContentConfig config) { + GenerateContentParameters.Builder parameterBuilder = GenerateContentParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateGenerateContent(model, contents, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateGenerateContent(response, config); + return processResponseForPrivateGenerateContent(response, config, parameterNode); } } @@ -4997,10 +5279,10 @@ BuiltRequest buildRequestForPrivateGenerateContentStream( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = generateContentParametersToVertex(this.apiClient, parameterNode, null); + body = generateContentParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:streamGenerateContent?alt=sse", body.get("_url")); } else { - body = generateContentParametersToMldev(this.apiClient, parameterNode, null); + body = generateContentParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{model}:streamGenerateContent?alt=sse", body.get("_url")); } else { @@ -5026,7 +5308,7 @@ BuiltRequest buildRequestForPrivateGenerateContentStream( /** A shared processResponse function for both sync and async methods. */ ResponseStream processResponseForPrivateGenerateContentStream( - ApiResponse response, GenerateContentConfig config) { + ApiResponse response, GenerateContentConfig config, JsonNode parameterNode) { String converterName; if (this.apiClient.vertexAI()) { @@ -5035,25 +5317,42 @@ ResponseStream processResponseForPrivateGenerateContent converterName = "generateContentResponseFromMldev"; } return new ResponseStream( - GenerateContentResponse.class, response, this, converterName, false, true); + GenerateContentResponse.class, response, this, converterName, true, true); } ResponseStream privateGenerateContentStream( String model, List contents, GenerateContentConfig config) { + GenerateContentParameters.Builder parameterBuilder = GenerateContentParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateGenerateContentStream(model, contents, config); ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()); - return processResponseForPrivateGenerateContentStream(response, config); + return processResponseForPrivateGenerateContentStream(response, config, parameterNode); } /** A shared buildRequest method for both sync and async methods. */ BuiltRequest buildRequestForPrivateEmbedContent( - String model, List contents, EmbedContentConfig config) { + String model, + List contents, + Content content, + EmbeddingApiType embeddingApiType, + EmbedContentConfig config) { - EmbedContentParameters.Builder parameterBuilder = EmbedContentParameters.builder(); + EmbedContentParametersPrivate.Builder parameterBuilder = + EmbedContentParametersPrivate.builder(); if (!Common.isZero(model)) { parameterBuilder.model(model); @@ -5061,6 +5360,12 @@ BuiltRequest buildRequestForPrivateEmbedContent( if (!Common.isZero(contents)) { parameterBuilder.contents(contents); } + if (!Common.isZero(content)) { + parameterBuilder.content(content); + } + if (!Common.isZero(embeddingApiType)) { + parameterBuilder.embeddingApiType(embeddingApiType); + } if (!Common.isZero(config)) { parameterBuilder.config(config); } @@ -5069,10 +5374,17 @@ BuiltRequest buildRequestForPrivateEmbedContent( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = embedContentParametersToVertex(this.apiClient, parameterNode, null); - path = Common.formatMap("{model}:predict", body.get("_url")); + body = + embedContentParametersPrivateToVertex(this.apiClient, parameterNode, null, parameterNode); + String endpointUrl = + Transformers.tIsVertexEmbedContentModel( + Common.getValueByPath(parameterNode, new String[] {"model"}).toString()) + ? "{model}:embedContent" + : "{model}:predict"; + path = Common.formatMap(endpointUrl, body.get("_url")); } else { - body = embedContentParametersToMldev(this.apiClient, parameterNode, null); + body = + embedContentParametersPrivateToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{model}:batchEmbedContents", body.get("_url")); } else { @@ -5098,7 +5410,7 @@ BuiltRequest buildRequestForPrivateEmbedContent( /** A shared processResponse function for both sync and async methods. */ EmbedContentResponse processResponseForPrivateEmbedContent( - ApiResponse response, EmbedContentConfig config) { + ApiResponse response, EmbedContentConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5110,11 +5422,11 @@ EmbedContentResponse processResponseForPrivateEmbedContent( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = embedContentResponseFromVertex(responseNode, null); + responseNode = embedContentResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = embedContentResponseFromMldev(responseNode, null); + responseNode = embedContentResponseFromMldev(responseNode, null, parameterNode); } EmbedContentResponse sdkResponse = @@ -5131,13 +5443,37 @@ EmbedContentResponse processResponseForPrivateEmbedContent( } EmbedContentResponse privateEmbedContent( - String model, List contents, EmbedContentConfig config) { - BuiltRequest builtRequest = buildRequestForPrivateEmbedContent(model, contents, config); + String model, + List contents, + Content content, + EmbeddingApiType embeddingApiType, + EmbedContentConfig config) { + EmbedContentParametersPrivate.Builder parameterBuilder = + EmbedContentParametersPrivate.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(content)) { + parameterBuilder.content(content); + } + if (!Common.isZero(embeddingApiType)) { + parameterBuilder.embeddingApiType(embeddingApiType); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + BuiltRequest builtRequest = + buildRequestForPrivateEmbedContent(model, contents, content, embeddingApiType, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateEmbedContent(response, config); + return processResponseForPrivateEmbedContent(response, config, parameterNode); } } @@ -5161,10 +5497,10 @@ BuiltRequest buildRequestForPrivateGenerateImages( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = generateImagesParametersToVertex(this.apiClient, parameterNode, null); + body = generateImagesParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:predict", body.get("_url")); } else { - body = generateImagesParametersToMldev(this.apiClient, parameterNode, null); + body = generateImagesParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{model}:predict", body.get("_url")); } else { @@ -5190,7 +5526,7 @@ BuiltRequest buildRequestForPrivateGenerateImages( /** A shared processResponse function for both sync and async methods. */ GenerateImagesResponse processResponseForPrivateGenerateImages( - ApiResponse response, GenerateImagesConfig config) { + ApiResponse response, GenerateImagesConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5202,11 +5538,11 @@ GenerateImagesResponse processResponseForPrivateGenerateImages( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = generateImagesResponseFromVertex(responseNode, null); + responseNode = generateImagesResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = generateImagesResponseFromMldev(responseNode, null); + responseNode = generateImagesResponseFromMldev(responseNode, null, parameterNode); } GenerateImagesResponse sdkResponse = @@ -5225,12 +5561,24 @@ GenerateImagesResponse processResponseForPrivateGenerateImages( /** Private method for generating images. */ GenerateImagesResponse privateGenerateImages( String model, String prompt, GenerateImagesConfig config) { + GenerateImagesParameters.Builder parameterBuilder = GenerateImagesParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(prompt)) { + parameterBuilder.prompt(prompt); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateGenerateImages(model, prompt, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateGenerateImages(response, config); + return processResponseForPrivateGenerateImages(response, config, parameterNode); } } @@ -5260,7 +5608,7 @@ BuiltRequest buildRequestForPrivateEditImage( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = editImageParametersToVertex(this.apiClient, parameterNode, null); + body = editImageParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:predict", body.get("_url")); } else { throw new UnsupportedOperationException( @@ -5285,7 +5633,7 @@ BuiltRequest buildRequestForPrivateEditImage( /** A shared processResponse function for both sync and async methods. */ EditImageResponse processResponseForPrivateEditImage( - ApiResponse response, EditImageConfig config) { + ApiResponse response, EditImageConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5297,7 +5645,7 @@ EditImageResponse processResponseForPrivateEditImage( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = editImageResponseFromVertex(responseNode, null); + responseNode = editImageResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { @@ -5324,13 +5672,28 @@ EditImageResponse privateEditImage( String prompt, List referenceImages, EditImageConfig config) { + EditImageParameters.Builder parameterBuilder = EditImageParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(prompt)) { + parameterBuilder.prompt(prompt); + } + if (!Common.isZero(referenceImages)) { + parameterBuilder.referenceImages(referenceImages); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateEditImage(model, prompt, referenceImages, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateEditImage(response, config); + return processResponseForPrivateEditImage(response, config, parameterNode); } } @@ -5357,7 +5720,7 @@ BuiltRequest buildRequestForPrivateUpscaleImage( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = upscaleImageAPIParametersToVertex(this.apiClient, parameterNode, null); + body = upscaleImageAPIParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:predict", body.get("_url")); } else { throw new UnsupportedOperationException( @@ -5382,7 +5745,7 @@ BuiltRequest buildRequestForPrivateUpscaleImage( /** A shared processResponse function for both sync and async methods. */ UpscaleImageResponse processResponseForPrivateUpscaleImage( - ApiResponse response, UpscaleImageAPIConfig config) { + ApiResponse response, UpscaleImageAPIConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5394,7 +5757,7 @@ UpscaleImageResponse processResponseForPrivateUpscaleImage( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = upscaleImageResponseFromVertex(responseNode, null); + responseNode = upscaleImageResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { @@ -5418,13 +5781,28 @@ UpscaleImageResponse processResponseForPrivateUpscaleImage( /** Private method for upscaling an image. */ UpscaleImageResponse privateUpscaleImage( String model, Image image, String upscaleFactor, UpscaleImageAPIConfig config) { + UpscaleImageAPIParameters.Builder parameterBuilder = UpscaleImageAPIParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(image)) { + parameterBuilder.image(image); + } + if (!Common.isZero(upscaleFactor)) { + parameterBuilder.upscaleFactor(upscaleFactor); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateUpscaleImage(model, image, upscaleFactor, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateUpscaleImage(response, config); + return processResponseForPrivateUpscaleImage(response, config, parameterNode); } } @@ -5448,7 +5826,7 @@ BuiltRequest buildRequestForRecontextImage( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = recontextImageParametersToVertex(this.apiClient, parameterNode, null); + body = recontextImageParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:predict", body.get("_url")); } else { throw new UnsupportedOperationException( @@ -5473,7 +5851,7 @@ BuiltRequest buildRequestForRecontextImage( /** A shared processResponse function for both sync and async methods. */ RecontextImageResponse processResponseForRecontextImage( - ApiResponse response, RecontextImageConfig config) { + ApiResponse response, RecontextImageConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5485,7 +5863,7 @@ RecontextImageResponse processResponseForRecontextImage( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = recontextImageResponseFromVertex(responseNode, null); + responseNode = recontextImageResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { @@ -5518,12 +5896,24 @@ RecontextImageResponse processResponseForRecontextImage( */ 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()); BuiltRequest builtRequest = buildRequestForRecontextImage(model, source, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForRecontextImage(response, config); + return processResponseForRecontextImage(response, config, parameterNode); } } @@ -5547,7 +5937,7 @@ BuiltRequest buildRequestForSegmentImage( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = segmentImageParametersToVertex(this.apiClient, parameterNode, null); + body = segmentImageParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:predict", body.get("_url")); } else { throw new UnsupportedOperationException( @@ -5572,7 +5962,7 @@ BuiltRequest buildRequestForSegmentImage( /** A shared processResponse function for both sync and async methods. */ SegmentImageResponse processResponseForSegmentImage( - ApiResponse response, SegmentImageConfig config) { + ApiResponse response, SegmentImageConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5584,7 +5974,7 @@ SegmentImageResponse processResponseForSegmentImage( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = segmentImageResponseFromVertex(responseNode, null); + responseNode = segmentImageResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { @@ -5610,12 +6000,24 @@ SegmentImageResponse processResponseForSegmentImage( */ public SegmentImageResponse segmentImage( String model, SegmentImageSource source, SegmentImageConfig config) { + SegmentImageParameters.Builder parameterBuilder = SegmentImageParameters.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()); BuiltRequest builtRequest = buildRequestForSegmentImage(model, source, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForSegmentImage(response, config); + return processResponseForSegmentImage(response, config, parameterNode); } } @@ -5635,10 +6037,10 @@ BuiltRequest buildRequestForGet(String model, GetModelConfig config) { ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = getModelParametersToVertex(this.apiClient, parameterNode, null); + body = getModelParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{name}", body.get("_url")); } else { - body = getModelParametersToMldev(this.apiClient, parameterNode, null); + body = getModelParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{name}", body.get("_url")); } else { @@ -5663,7 +6065,7 @@ BuiltRequest buildRequestForGet(String model, GetModelConfig config) { } /** A shared processResponse function for both sync and async methods. */ - Model processResponseForGet(ApiResponse response, GetModelConfig config) { + Model processResponseForGet(ApiResponse response, GetModelConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5675,11 +6077,11 @@ Model processResponseForGet(ApiResponse response, GetModelConfig config) { JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = modelFromVertex(responseNode, null); + responseNode = modelFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = modelFromMldev(responseNode, null); + responseNode = modelFromMldev(responseNode, null, parameterNode); } return JsonSerializable.fromJsonNode(responseNode, Model.class); @@ -5691,12 +6093,21 @@ Model processResponseForGet(ApiResponse response, GetModelConfig config) { * @example ```java Model model = client.models.get("gemini-2.0-flash"); ``` */ public Model get(String model, GetModelConfig config) { + GetModelParameters.Builder parameterBuilder = GetModelParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForGet(model, config); try (ApiResponse response = this.apiClient.request( "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForGet(response, config); + return processResponseForGet(response, config, parameterNode); } } @@ -5713,10 +6124,10 @@ BuiltRequest buildRequestForPrivateList(ListModelsConfig config) { ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = listModelsParametersToVertex(this.apiClient, parameterNode, null); + body = listModelsParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{models_url}", body.get("_url")); } else { - body = listModelsParametersToMldev(this.apiClient, parameterNode, null); + body = listModelsParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{models_url}", body.get("_url")); } else { @@ -5741,7 +6152,8 @@ BuiltRequest buildRequestForPrivateList(ListModelsConfig config) { } /** A shared processResponse function for both sync and async methods. */ - ListModelsResponse processResponseForPrivateList(ApiResponse response, ListModelsConfig config) { + ListModelsResponse processResponseForPrivateList( + ApiResponse response, ListModelsConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5753,11 +6165,11 @@ ListModelsResponse processResponseForPrivateList(ApiResponse response, ListModel JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = listModelsResponseFromVertex(responseNode, null); + responseNode = listModelsResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = listModelsResponseFromMldev(responseNode, null); + responseNode = listModelsResponseFromMldev(responseNode, null, parameterNode); } ListModelsResponse sdkResponse = @@ -5774,12 +6186,18 @@ ListModelsResponse processResponseForPrivateList(ApiResponse response, ListModel } ListModelsResponse privateList(ListModelsConfig config) { + ListModelsParameters.Builder parameterBuilder = ListModelsParameters.builder(); + + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateList(config); try (ApiResponse response = this.apiClient.request( "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateList(response, config); + return processResponseForPrivateList(response, config, parameterNode); } } @@ -5799,10 +6217,10 @@ BuiltRequest buildRequestForUpdate(String model, UpdateModelConfig config) { ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = updateModelParametersToVertex(this.apiClient, parameterNode, null); + body = updateModelParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}", body.get("_url")); } else { - body = updateModelParametersToMldev(this.apiClient, parameterNode, null); + body = updateModelParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{name}", body.get("_url")); } else { @@ -5827,7 +6245,8 @@ BuiltRequest buildRequestForUpdate(String model, UpdateModelConfig config) { } /** A shared processResponse function for both sync and async methods. */ - Model processResponseForUpdate(ApiResponse response, UpdateModelConfig config) { + Model processResponseForUpdate( + ApiResponse response, UpdateModelConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5839,11 +6258,11 @@ Model processResponseForUpdate(ApiResponse response, UpdateModelConfig config) { JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = modelFromVertex(responseNode, null); + responseNode = modelFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = modelFromMldev(responseNode, null); + responseNode = modelFromMldev(responseNode, null, parameterNode); } return JsonSerializable.fromJsonNode(responseNode, Model.class); @@ -5861,12 +6280,21 @@ Model processResponseForUpdate(ApiResponse response, UpdateModelConfig config) { * description") .build()); ``` */ public Model update(String model, UpdateModelConfig config) { + UpdateModelParameters.Builder parameterBuilder = UpdateModelParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForUpdate(model, config); try (ApiResponse response = this.apiClient.request( "patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForUpdate(response, config); + return processResponseForUpdate(response, config, parameterNode); } } @@ -5886,10 +6314,10 @@ BuiltRequest buildRequestForDelete(String model, DeleteModelConfig config) { ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = deleteModelParametersToVertex(this.apiClient, parameterNode, null); + body = deleteModelParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{name}", body.get("_url")); } else { - body = deleteModelParametersToMldev(this.apiClient, parameterNode, null); + body = deleteModelParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{name}", body.get("_url")); } else { @@ -5914,7 +6342,8 @@ BuiltRequest buildRequestForDelete(String model, DeleteModelConfig config) { } /** A shared processResponse function for both sync and async methods. */ - DeleteModelResponse processResponseForDelete(ApiResponse response, DeleteModelConfig config) { + DeleteModelResponse processResponseForDelete( + ApiResponse response, DeleteModelConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -5926,11 +6355,11 @@ DeleteModelResponse processResponseForDelete(ApiResponse response, DeleteModelCo JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = deleteModelResponseFromVertex(responseNode, null); + responseNode = deleteModelResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = deleteModelResponseFromMldev(responseNode, null); + responseNode = deleteModelResponseFromMldev(responseNode, null, parameterNode); } DeleteModelResponse sdkResponse = @@ -5952,12 +6381,21 @@ DeleteModelResponse processResponseForDelete(ApiResponse response, DeleteModelCo * @example ```java Model model = client.models.delete("tunedModels/12345"); ``` */ public DeleteModelResponse delete(String model, DeleteModelConfig config) { + DeleteModelParameters.Builder parameterBuilder = DeleteModelParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForDelete(model, config); try (ApiResponse response = this.apiClient.request( "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForDelete(response, config); + return processResponseForDelete(response, config, parameterNode); } } @@ -5981,10 +6419,10 @@ BuiltRequest buildRequestForCountTokens( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = countTokensParametersToVertex(this.apiClient, parameterNode, null); + body = countTokensParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:countTokens", body.get("_url")); } else { - body = countTokensParametersToMldev(this.apiClient, parameterNode, null); + body = countTokensParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{model}:countTokens", body.get("_url")); } else { @@ -6010,7 +6448,7 @@ BuiltRequest buildRequestForCountTokens( /** A shared processResponse function for both sync and async methods. */ CountTokensResponse processResponseForCountTokens( - ApiResponse response, CountTokensConfig config) { + ApiResponse response, CountTokensConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -6022,11 +6460,11 @@ CountTokensResponse processResponseForCountTokens( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = countTokensResponseFromVertex(responseNode, null); + responseNode = countTokensResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = countTokensResponseFromMldev(responseNode, null); + responseNode = countTokensResponseFromMldev(responseNode, null, parameterNode); } CountTokensResponse sdkResponse = @@ -6054,12 +6492,24 @@ CountTokensResponse processResponseForCountTokens( */ public CountTokensResponse countTokens( String model, List contents, CountTokensConfig config) { + CountTokensParameters.Builder parameterBuilder = CountTokensParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForCountTokens(model, contents, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForCountTokens(response, config); + return processResponseForCountTokens(response, config, parameterNode); } } @@ -6083,7 +6533,7 @@ BuiltRequest buildRequestForComputeTokens( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = computeTokensParametersToVertex(this.apiClient, parameterNode, null); + body = computeTokensParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:computeTokens", body.get("_url")); } else { throw new UnsupportedOperationException( @@ -6108,7 +6558,7 @@ BuiltRequest buildRequestForComputeTokens( /** A shared processResponse function for both sync and async methods. */ ComputeTokensResponse processResponseForComputeTokens( - ApiResponse response, ComputeTokensConfig config) { + ApiResponse response, ComputeTokensConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -6120,7 +6570,7 @@ ComputeTokensResponse processResponseForComputeTokens( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = computeTokensResponseFromVertex(responseNode, null); + responseNode = computeTokensResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { @@ -6153,12 +6603,24 @@ ComputeTokensResponse processResponseForComputeTokens( */ public ComputeTokensResponse computeTokens( String model, List contents, ComputeTokensConfig config) { + ComputeTokensParameters.Builder parameterBuilder = ComputeTokensParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForComputeTokens(model, contents, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForComputeTokens(response, config); + return processResponseForComputeTokens(response, config, parameterNode); } } @@ -6196,10 +6658,10 @@ BuiltRequest buildRequestForPrivateGenerateVideos( ObjectNode body; String path; if (this.apiClient.vertexAI()) { - body = generateVideosParametersToVertex(this.apiClient, parameterNode, null); + body = generateVideosParametersToVertex(this.apiClient, parameterNode, null, parameterNode); path = Common.formatMap("{model}:predictLongRunning", body.get("_url")); } else { - body = generateVideosParametersToMldev(this.apiClient, parameterNode, null); + body = generateVideosParametersToMldev(this.apiClient, parameterNode, null, parameterNode); if (body.get("_url") != null) { path = Common.formatMap("{model}:predictLongRunning", body.get("_url")); } else { @@ -6225,7 +6687,7 @@ BuiltRequest buildRequestForPrivateGenerateVideos( /** A shared processResponse function for both sync and async methods. */ GenerateVideosOperation processResponseForPrivateGenerateVideos( - ApiResponse response, GenerateVideosConfig config) { + ApiResponse response, GenerateVideosConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -6237,11 +6699,11 @@ GenerateVideosOperation processResponseForPrivateGenerateVideos( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = generateVideosOperationFromVertex(responseNode, null); + responseNode = generateVideosOperationFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = generateVideosOperationFromMldev(responseNode, null); + responseNode = generateVideosOperationFromMldev(responseNode, null, parameterNode); } return JsonSerializable.fromJsonNode(responseNode, GenerateVideosOperation.class); @@ -6255,13 +6717,34 @@ GenerateVideosOperation privateGenerateVideos( Video video, GenerateVideosSource source, GenerateVideosConfig config) { + GenerateVideosParameters.Builder parameterBuilder = GenerateVideosParameters.builder(); + + if (!Common.isZero(model)) { + parameterBuilder.model(model); + } + if (!Common.isZero(prompt)) { + parameterBuilder.prompt(prompt); + } + if (!Common.isZero(image)) { + parameterBuilder.image(image); + } + if (!Common.isZero(video)) { + parameterBuilder.video(video); + } + if (!Common.isZero(source)) { + parameterBuilder.source(source); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateGenerateVideos(model, prompt, image, video, source, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateGenerateVideos(response, config); + return processResponseForPrivateGenerateVideos(response, config, parameterNode); } } @@ -6704,6 +7187,31 @@ public EmbedContentResponse embedContent(String model, String text, EmbedContent return embedContent(model, ImmutableList.of(text), config); } + /** + * Embeds content given a GenAI model and a content object. + * + * @param model the name of the GenAI model to use for embedding + * @param content the {@link com.google.genai.types.Content} to send to the embedding model + * @return a {@link com.google.genai.types.EmbedContentResponse} instance that contains the + * embedding. + */ + public EmbedContentResponse embedContent( + String model, Content content, EmbedContentConfig config) { + List contents = new ArrayList<>(); + contents.add(content); + boolean isVertexEmbedContentModel = + this.apiClient.vertexAI() && Transformers.tIsVertexEmbedContentModel(model); + if (isVertexEmbedContentModel && contents.size() > 1) { + throw new IllegalArgumentException( + "The embedContent API for this model only supports one content at a time."); + } + EmbeddingApiType apiType = + isVertexEmbedContentModel + ? new EmbeddingApiType("EMBED_CONTENT") + : new EmbeddingApiType("PREDICT"); + return privateEmbedContent(model, contents, content, apiType, config); + } + /** * Embeds content given a GenAI model and a list of text strings. * @@ -6718,7 +7226,55 @@ public EmbedContentResponse embedContent( for (String text : texts) { contents.add(Content.fromParts(Part.fromText(text))); } - return privateEmbedContent(model, contents, config); + Content content = null; + if (!contents.isEmpty()) { + content = contents.get(0); + } + boolean isVertexEmbedContentModel = + this.apiClient.vertexAI() && Transformers.tIsVertexEmbedContentModel(model); + if (isVertexEmbedContentModel && contents.size() > 1) { + throw new IllegalArgumentException( + "The embedContent API for this model only supports one content at a time."); + } + EmbeddingApiType apiType = + isVertexEmbedContentModel + ? new EmbeddingApiType("EMBED_CONTENT") + : new EmbeddingApiType("PREDICT"); + return privateEmbedContent(model, contents, content, apiType, config); + } + + /** + * Private method for embedding content, taking either a single content object or a list of + * content objects. + */ + EmbedContentResponse embedContentTest(String model, Object contents, EmbedContentConfig config) { + List contentList = new ArrayList<>(); + if (contents instanceof String) { + contentList.add(Content.fromParts(Part.fromText((String) contents))); + } else if (contents instanceof List) { + List contentsObjectList = (List) contents; + for (Object item : contentsObjectList) { + contentList.add(JsonSerializable.objectMapper.convertValue(item, Content.class)); + } + } else { + throw new IllegalArgumentException("Unsupported contents type: " + contents.getClass()); + } + + Content content = null; + if (contentList != null && !contentList.isEmpty()) { + content = contentList.get(0); + } + boolean isVertexEmbedContentModel = + this.apiClient.vertexAI() && Transformers.tIsVertexEmbedContentModel(model); + if (isVertexEmbedContentModel && contentList.size() > 1) { + throw new IllegalArgumentException( + "The embedContent API for this model only supports one content at a time."); + } + EmbeddingApiType apiType = + isVertexEmbedContentModel + ? new EmbeddingApiType("EMBED_CONTENT") + : new EmbeddingApiType("PREDICT"); + return privateEmbedContent(model, contentList, content, apiType, config); } /** diff --git a/src/main/java/com/google/genai/Transformers.java b/src/main/java/com/google/genai/Transformers.java index 65eab1ed837..102617dc9a7 100644 --- a/src/main/java/com/google/genai/Transformers.java +++ b/src/main/java/com/google/genai/Transformers.java @@ -800,4 +800,17 @@ public static ArrayNode tMetrics(Object metrics) { } return arrayNode; } + + /** + * Checks if a given model name is a Vertex AI embed content model. + * + * @param model The model name to check. + * @return True if the model is a Vertex AI embed content model, false otherwise. + */ + public static boolean tIsVertexEmbedContentModel(String model) { + // Gemini Embeddings except gemini-embedding-001. + return (model.contains("gemini") && !model.equals("gemini-embedding-001")) + // Open-source MaaS embedding models. + || model.contains("maas"); + } } diff --git a/src/main/java/com/google/genai/Tunings.java b/src/main/java/com/google/genai/Tunings.java index 25384775eb3..fcc966446b1 100644 --- a/src/main/java/com/google/genai/Tunings.java +++ b/src/main/java/com/google/genai/Tunings.java @@ -86,7 +86,8 @@ ObjectNode cancelTuningJobParametersToVertex( } @ExcludeFromGeneratedCoverageReport - ObjectNode cancelTuningJobResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode cancelTuningJobResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -99,7 +100,8 @@ ObjectNode cancelTuningJobResponseFromMldev(JsonNode fromObject, ObjectNode pare } @ExcludeFromGeneratedCoverageReport - ObjectNode cancelTuningJobResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode cancelTuningJobResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -462,7 +464,8 @@ ObjectNode createTuningJobParametersPrivateToVertex( } @ExcludeFromGeneratedCoverageReport - ObjectNode evaluationConfigFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode evaluationConfigFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"metrics"}) != null) { Common.setValueByPath( @@ -635,7 +638,8 @@ ObjectNode listTuningJobsParametersToVertex( } @ExcludeFromGeneratedCoverageReport - ObjectNode listTuningJobsResponseFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode listTuningJobsResponseFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -658,7 +662,7 @@ ObjectNode listTuningJobsResponseFromMldev(JsonNode fromObject, ObjectNode paren ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(tuningJobFromMldev(JsonSerializable.toJsonNode(item), toObject)); + result.add(tuningJobFromMldev(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"tuningJobs"}, result); } @@ -667,7 +671,8 @@ ObjectNode listTuningJobsResponseFromMldev(JsonNode fromObject, ObjectNode paren } @ExcludeFromGeneratedCoverageReport - ObjectNode listTuningJobsResponseFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode listTuningJobsResponseFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -690,7 +695,7 @@ ObjectNode listTuningJobsResponseFromVertex(JsonNode fromObject, ObjectNode pare ArrayNode result = objectMapper.createArrayNode(); for (JsonNode item : keyArray) { - result.add(tuningJobFromVertex(JsonSerializable.toJsonNode(item), toObject)); + result.add(tuningJobFromVertex(JsonSerializable.toJsonNode(item), toObject, rootObject)); } Common.setValueByPath(toObject, new String[] {"tuningJobs"}, result); } @@ -699,7 +704,8 @@ ObjectNode listTuningJobsResponseFromVertex(JsonNode fromObject, ObjectNode pare } @ExcludeFromGeneratedCoverageReport - ObjectNode tunedModelFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode tunedModelFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { Common.setValueByPath( @@ -795,7 +801,7 @@ ObjectNode tuningDatasetToVertex( } @ExcludeFromGeneratedCoverageReport - ObjectNode tuningJobFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode tuningJobFromMldev(JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -867,14 +873,16 @@ ObjectNode tuningJobFromMldev(JsonNode fromObject, ObjectNode parentObject) { tunedModelFromMldev( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"_self"})), - toObject)); + toObject, + rootObject)); } return toObject; } @ExcludeFromGeneratedCoverageReport - ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode tuningJobFromVertex( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -1002,7 +1010,8 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { evaluationConfigFromVertex( JsonSerializable.toJsonNode( Common.getValueByPath(fromObject, new String[] {"evaluationConfig"})), - toObject)); + toObject, + rootObject)); } if (Common.getValueByPath(fromObject, new String[] {"customBaseModel"}) != null) { @@ -1065,7 +1074,8 @@ ObjectNode tuningJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { } @ExcludeFromGeneratedCoverageReport - ObjectNode tuningOperationFromMldev(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode tuningOperationFromMldev( + JsonNode fromObject, ObjectNode parentObject, JsonNode rootObject) { ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); if (Common.getValueByPath(fromObject, new String[] {"sdkHttpResponse"}) != null) { Common.setValueByPath( @@ -1170,7 +1180,8 @@ BuiltRequest buildRequestForPrivateGet(String name, GetTuningJobConfig config) { } /** A shared processResponse function for both sync and async methods. */ - TuningJob processResponseForPrivateGet(ApiResponse response, GetTuningJobConfig config) { + TuningJob processResponseForPrivateGet( + ApiResponse response, GetTuningJobConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -1182,11 +1193,11 @@ TuningJob processResponseForPrivateGet(ApiResponse response, GetTuningJobConfig JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = tuningJobFromVertex(responseNode, null); + responseNode = tuningJobFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = tuningJobFromMldev(responseNode, null); + responseNode = tuningJobFromMldev(responseNode, null, parameterNode); } TuningJob sdkResponse = JsonSerializable.fromJsonNode(responseNode, TuningJob.class); @@ -1202,12 +1213,21 @@ TuningJob processResponseForPrivateGet(ApiResponse response, GetTuningJobConfig } TuningJob privateGet(String name, GetTuningJobConfig config) { + GetTuningJobParameters.Builder parameterBuilder = GetTuningJobParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateGet(name, config); try (ApiResponse response = this.apiClient.request( "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateGet(response, config); + return processResponseForPrivateGet(response, config, parameterNode); } } @@ -1253,7 +1273,7 @@ BuiltRequest buildRequestForPrivateList(ListTuningJobsConfig config) { /** A shared processResponse function for both sync and async methods. */ ListTuningJobsResponse processResponseForPrivateList( - ApiResponse response, ListTuningJobsConfig config) { + ApiResponse response, ListTuningJobsConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -1265,11 +1285,11 @@ ListTuningJobsResponse processResponseForPrivateList( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = listTuningJobsResponseFromVertex(responseNode, null); + responseNode = listTuningJobsResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = listTuningJobsResponseFromMldev(responseNode, null); + responseNode = listTuningJobsResponseFromMldev(responseNode, null, parameterNode); } ListTuningJobsResponse sdkResponse = @@ -1286,12 +1306,18 @@ ListTuningJobsResponse processResponseForPrivateList( } ListTuningJobsResponse privateList(ListTuningJobsConfig config) { + ListTuningJobsParameters.Builder parameterBuilder = ListTuningJobsParameters.builder(); + + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateList(config); try (ApiResponse response = this.apiClient.request( "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateList(response, config); + return processResponseForPrivateList(response, config, parameterNode); } } @@ -1340,7 +1366,7 @@ BuiltRequest buildRequestForCancel(String name, CancelTuningJobConfig config) { /** A shared processResponse function for both sync and async methods. */ CancelTuningJobResponse processResponseForCancel( - ApiResponse response, CancelTuningJobConfig config) { + ApiResponse response, CancelTuningJobConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -1352,11 +1378,11 @@ CancelTuningJobResponse processResponseForCancel( JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = cancelTuningJobResponseFromVertex(responseNode, null); + responseNode = cancelTuningJobResponseFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { - responseNode = cancelTuningJobResponseFromMldev(responseNode, null); + responseNode = cancelTuningJobResponseFromMldev(responseNode, null, parameterNode); } CancelTuningJobResponse sdkResponse = @@ -1380,12 +1406,21 @@ CancelTuningJobResponse processResponseForCancel( * @param config A {@link CancelTuningJobConfig} for configuring the cancel request. */ public CancelTuningJobResponse cancel(String name, CancelTuningJobConfig config) { + CancelTuningJobParameters.Builder parameterBuilder = CancelTuningJobParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForCancel(name, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForCancel(response, config); + return processResponseForCancel(response, config, parameterNode); } } @@ -1440,7 +1475,8 @@ BuiltRequest buildRequestForPrivateTune( } /** A shared processResponse function for both sync and async methods. */ - TuningJob processResponseForPrivateTune(ApiResponse response, CreateTuningJobConfig config) { + TuningJob processResponseForPrivateTune( + ApiResponse response, CreateTuningJobConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -1452,7 +1488,7 @@ TuningJob processResponseForPrivateTune(ApiResponse response, CreateTuningJobCon JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); if (this.apiClient.vertexAI()) { - responseNode = tuningJobFromVertex(responseNode, null); + responseNode = tuningJobFromVertex(responseNode, null, parameterNode); } if (!this.apiClient.vertexAI()) { @@ -1477,13 +1513,29 @@ TuningJob privateTune( PreTunedModel preTunedModel, TuningDataset trainingDataset, CreateTuningJobConfig config) { + CreateTuningJobParametersPrivate.Builder parameterBuilder = + CreateTuningJobParametersPrivate.builder(); + + if (!Common.isZero(baseModel)) { + parameterBuilder.baseModel(baseModel); + } + if (!Common.isZero(preTunedModel)) { + parameterBuilder.preTunedModel(preTunedModel); + } + if (!Common.isZero(trainingDataset)) { + parameterBuilder.trainingDataset(trainingDataset); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateTune(baseModel, preTunedModel, trainingDataset, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateTune(response, config); + return processResponseForPrivateTune(response, config, parameterNode); } } @@ -1543,7 +1595,7 @@ BuiltRequest buildRequestForPrivateTuneMldev( /** A shared processResponse function for both sync and async methods. */ TuningOperation processResponseForPrivateTuneMldev( - ApiResponse response, CreateTuningJobConfig config) { + ApiResponse response, CreateTuningJobConfig config, JsonNode parameterNode) { ResponseBody responseBody = response.getBody(); String responseString; try { @@ -1560,7 +1612,7 @@ TuningOperation processResponseForPrivateTuneMldev( } if (!this.apiClient.vertexAI()) { - responseNode = tuningOperationFromMldev(responseNode, null); + responseNode = tuningOperationFromMldev(responseNode, null, parameterNode); } TuningOperation sdkResponse = @@ -1581,13 +1633,29 @@ TuningOperation privateTuneMldev( PreTunedModel preTunedModel, TuningDataset trainingDataset, CreateTuningJobConfig config) { + CreateTuningJobParametersPrivate.Builder parameterBuilder = + CreateTuningJobParametersPrivate.builder(); + + if (!Common.isZero(baseModel)) { + parameterBuilder.baseModel(baseModel); + } + if (!Common.isZero(preTunedModel)) { + parameterBuilder.preTunedModel(preTunedModel); + } + if (!Common.isZero(trainingDataset)) { + parameterBuilder.trainingDataset(trainingDataset); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); BuiltRequest builtRequest = buildRequestForPrivateTuneMldev(baseModel, preTunedModel, trainingDataset, config); try (ApiResponse response = this.apiClient.request( "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { - return processResponseForPrivateTuneMldev(response, config); + return processResponseForPrivateTuneMldev(response, config, parameterNode); } } diff --git a/src/main/java/com/google/genai/types/EmbedContentParametersPrivate.java b/src/main/java/com/google/genai/types/EmbedContentParametersPrivate.java new file mode 100644 index 00000000000..caa644578df --- /dev/null +++ b/src/main/java/com/google/genai/types/EmbedContentParametersPrivate.java @@ -0,0 +1,244 @@ +/* + * 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.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Parameters for the _embed_content method. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = EmbedContentParametersPrivate.Builder.class) +public abstract class EmbedContentParametersPrivate extends JsonSerializable { + /** + * ID of the model to use. For a list of models, see `Google models + * `_. + */ + @JsonProperty("model") + public abstract Optional model(); + + /** The content to embed. Only the `parts.text` fields will be counted. */ + @JsonProperty("contents") + public abstract Optional> contents(); + + /** The single content to embed. Only the `parts.text` fields will be counted. */ + @JsonProperty("content") + public abstract Optional content(); + + /** The Vertex embedding API to use. */ + @JsonProperty("embeddingApiType") + public abstract Optional embeddingApiType(); + + /** Configuration that contains optional parameters. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for EmbedContentParametersPrivate. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EmbedContentParametersPrivate.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EmbedContentParametersPrivate. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `EmbedContentParametersPrivate.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_EmbedContentParametersPrivate.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); + + @ExcludeFromGeneratedCoverageReport + abstract Builder model(Optional model); + + /** Clears the value of model field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModel() { + return model(Optional.empty()); + } + + /** + * Setter for contents. + * + *

contents: The content to embed. Only the `parts.text` fields will be counted. + */ + @JsonProperty("contents") + public abstract Builder contents(List contents); + + /** + * Setter for contents. + * + *

contents: The content to embed. Only the `parts.text` fields will be counted. + */ + @CanIgnoreReturnValue + public Builder contents(Content... contents) { + return contents(Arrays.asList(contents)); + } + + /** + * Setter for contents builder. + * + *

contents: The content to embed. Only the `parts.text` fields will be counted. + */ + @CanIgnoreReturnValue + public Builder contents(Content.Builder... contentsBuilders) { + return contents( + Arrays.asList(contentsBuilders).stream() + .map(Content.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contents(Optional> contents); + + /** Clears the value of contents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContents() { + return contents(Optional.empty()); + } + + /** + * Setter for content. + * + *

content: The single content to embed. Only the `parts.text` fields will be counted. + */ + @JsonProperty("content") + public abstract Builder content(Content content); + + /** + * Setter for content builder. + * + *

content: The single content to embed. Only the `parts.text` fields will be counted. + */ + @CanIgnoreReturnValue + public Builder content(Content.Builder contentBuilder) { + return content(contentBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + /** + * Setter for embeddingApiType. + * + *

embeddingApiType: The Vertex embedding API to use. + */ + @JsonProperty("embeddingApiType") + public abstract Builder embeddingApiType(EmbeddingApiType embeddingApiType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder embeddingApiType(Optional embeddingApiType); + + /** Clears the value of embeddingApiType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEmbeddingApiType() { + return embeddingApiType(Optional.empty()); + } + + /** + * Setter for embeddingApiType given a known enum. + * + *

embeddingApiType: The Vertex embedding API to use. + */ + @CanIgnoreReturnValue + public Builder embeddingApiType(EmbeddingApiType.Known knownType) { + return embeddingApiType(new EmbeddingApiType(knownType)); + } + + /** + * Setter for embeddingApiType given a string. + * + *

embeddingApiType: The Vertex embedding API to use. + */ + @CanIgnoreReturnValue + public Builder embeddingApiType(String embeddingApiType) { + return embeddingApiType(new EmbeddingApiType(embeddingApiType)); + } + + /** + * Setter for config. + * + *

config: Configuration that contains optional parameters. + */ + @JsonProperty("config") + public abstract Builder config(EmbedContentConfig config); + + /** + * Setter for config builder. + * + *

config: Configuration that contains optional parameters. + */ + @CanIgnoreReturnValue + public Builder config(EmbedContentConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract EmbedContentParametersPrivate build(); + } + + /** Deserializes a JSON string to a EmbedContentParametersPrivate object. */ + @ExcludeFromGeneratedCoverageReport + public static EmbedContentParametersPrivate fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EmbedContentParametersPrivate.class); + } +} diff --git a/src/main/java/com/google/genai/types/EmbeddingApiType.java b/src/main/java/com/google/genai/types/EmbeddingApiType.java new file mode 100644 index 00000000000..e50efe36d79 --- /dev/null +++ b/src/main/java/com/google/genai/types/EmbeddingApiType.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.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Enum representing the Vertex embedding API to use. */ +public class EmbeddingApiType { + + /** Enum representing the known values for EmbeddingApiType. */ + public enum Known { + /** predict API endpoint (default) */ + PREDICT, + + /** embedContent API Endpoint */ + EMBED_CONTENT, + + EMBEDDING_API_TYPE_UNSPECIFIED + } + + private Known embeddingApiTypeEnum; + private final String value; + + @JsonCreator + public EmbeddingApiType(String value) { + this.value = value; + for (Known embeddingApiTypeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(embeddingApiTypeEnum.toString(), value)) { + this.embeddingApiTypeEnum = embeddingApiTypeEnum; + break; + } + } + if (this.embeddingApiTypeEnum == null) { + this.embeddingApiTypeEnum = Known.EMBEDDING_API_TYPE_UNSPECIFIED; + } + } + + public EmbeddingApiType(Known knownValue) { + this.embeddingApiTypeEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof EmbeddingApiType)) { + return false; + } + + EmbeddingApiType other = (EmbeddingApiType) o; + + if (this.embeddingApiTypeEnum != Known.EMBEDDING_API_TYPE_UNSPECIFIED + && other.embeddingApiTypeEnum != Known.EMBEDDING_API_TYPE_UNSPECIFIED) { + return this.embeddingApiTypeEnum == other.embeddingApiTypeEnum; + } else if (this.embeddingApiTypeEnum == Known.EMBEDDING_API_TYPE_UNSPECIFIED + && other.embeddingApiTypeEnum == Known.EMBEDDING_API_TYPE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.embeddingApiTypeEnum != Known.EMBEDDING_API_TYPE_UNSPECIFIED) { + return this.embeddingApiTypeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.embeddingApiTypeEnum; + } +} diff --git a/src/test/java/com/google/genai/TableTest.java b/src/test/java/com/google/genai/TableTest.java index d89b1adf4b2..26a5aa9fabf 100644 --- a/src/test/java/com/google/genai/TableTest.java +++ b/src/test/java/com/google/genai/TableTest.java @@ -69,6 +69,10 @@ private static Collection createTableTests(String path, boolean ver String originalMethodName = segments[segments.length - 1]; String methodName = Common.snakeToCamel(originalMethodName); + if (methodName.equals("embedContent")) { + methodName = "embedContentTest"; + } + List modulePath = new ArrayList<>(); for (int i = 0; i < segments.length - 1; i++) { modulePath.add(segments[i]); @@ -104,11 +108,7 @@ private static Collection createTableTests(String path, boolean ver if (candidate.getName().equals(methodName)) { methods.add(candidate); } - if (methodName.equals("embedContent") - && candidate.getName().equals("privateEmbedContent")) { - candidate.setAccessible(true); - methods.add(candidate); - } else if (methodName.equals("generateVideos") + if (methodName.equals("generateVideos") && candidate.getName().equals("privateGenerateVideos")) { candidate.setAccessible(true); methods.add(candidate); @@ -178,6 +178,10 @@ private static Collection createTestCases( String msg = " => Test skipped: replay tests are not supported for edit_image"; return Collections.singletonList(DynamicTest.dynamicTest(testName + msg, () -> {})); } + if (testName.contains("models.embed_content.test_vertex_new_api_inline_pdf")) { + String msg = " => Test skipped: inline byte deserialization fails"; + return Collections.singletonList(DynamicTest.dynamicTest(testName + msg, () -> {})); + } // TODO(b/457846189): Support models.list filter parameter if (testName.contains("models.list.test_tuned_models_with_filter") || testName.contains("models.list.test_tuned_models.vertex")) {