From 855643bd308204b15ab6aa60064aad295365e347 Mon Sep 17 00:00:00 2001 From: Matthew Tang Date: Wed, 1 Apr 2026 14:37:13 -0700 Subject: [PATCH] feat: Add AgentEngine Memories Revisions module PiperOrigin-RevId: 893119137 --- .../cloud/vertexai/genai/AgentEngines.java | 4 + .../vertexai/genai/AsyncAgentEngines.java | 4 + .../cloud/vertexai/genai/AsyncMemories.java | 240 +++ .../vertexai/genai/AsyncMemoryRevisions.java | 68 + .../cloud/vertexai/genai/AsyncSandboxes.java | 136 ++ .../google/cloud/vertexai/genai/Memories.java | 1529 +++++++++++++++++ .../cloud/vertexai/genai/MemoryRevisions.java | 257 +++ .../cloud/vertexai/genai/Sandboxes.java | 671 ++++++++ .../AgentEngineGenerateMemoriesOperation.java | 201 +++ .../genai/types/AgentEngineMemoryConfig.java | 382 ++++ .../types/AgentEngineMemoryOperation.java | 198 +++ .../AgentEnginePurgeMemoriesOperation.java | 201 +++ .../AgentEngineRollbackMemoryOperation.java | 169 ++ .../types/AgentEngineSandboxOperation.java | 198 +++ .../cloud/vertexai/genai/types/Chunk.java | 139 ++ ...ateAgentEngineMemoryRequestParameters.java | 180 ++ .../types/CreateAgentEngineSandboxConfig.java | 173 ++ ...teAgentEngineSandboxRequestParameters.java | 151 ++ .../types/DeleteAgentEngineMemoryConfig.java | 84 + .../DeleteAgentEngineMemoryOperation.java | 169 ++ ...eteAgentEngineMemoryRequestParameters.java | 119 ++ .../types/DeleteAgentEngineSandboxConfig.java | 84 + .../DeleteAgentEngineSandboxOperation.java | 169 ++ ...teAgentEngineSandboxRequestParameters.java | 119 ++ .../ExecuteCodeAgentEngineSandboxConfig.java | 85 + ...deAgentEngineSandboxRequestParameters.java | 168 ++ .../ExecuteSandboxEnvironmentResponse.java | 111 ++ .../GenerateAgentEngineMemoriesConfig.java | 313 ++++ ...eAgentEngineMemoriesRequestParameters.java | 257 +++ ...teMemoriesRequestDirectContentsSource.java | 114 ++ ...oriesRequestDirectContentsSourceEvent.java | 86 + ...teMemoriesRequestDirectMemoriesSource.java | 123 ++ ...questDirectMemoriesSourceDirectMemory.java | 138 ++ ...ateMemoriesRequestVertexSessionSource.java | 139 ++ .../genai/types/GenerateMemoriesResponse.java | 111 ++ ...nerateMemoriesResponseGeneratedMemory.java | 167 ++ ...MemoriesResponseGeneratedMemoryAction.java | 129 ++ ...neGenerateMemoriesOperationParameters.java | 119 ++ .../types/GetAgentEngineMemoryConfig.java | 82 + ...tAgentEngineMemoryOperationParameters.java | 119 ++ ...GetAgentEngineMemoryRequestParameters.java | 118 ++ .../GetAgentEngineMemoryRevisionConfig.java | 85 + ...EngineMemoryRevisionRequestParameters.java | 119 ++ .../types/GetAgentEngineSandboxConfig.java | 82 + ...AgentEngineSandboxOperationParameters.java | 119 ++ ...etAgentEngineSandboxRequestParameters.java | 119 ++ .../types/IntermediateExtractedMemory.java | 81 + .../cloud/vertexai/genai/types/Language.java | 111 ++ .../types/ListAgentEngineMemoryConfig.java | 184 ++ ...istAgentEngineMemoryRequestParameters.java | 119 ++ .../ListAgentEngineMemoryRevisionsConfig.java | 155 ++ ...ngineMemoryRevisionsRequestParameters.java | 119 ++ ...istAgentEngineMemoryRevisionsResponse.java | 157 ++ .../types/ListAgentEngineSandboxesConfig.java | 154 ++ ...AgentEngineSandboxesRequestParameters.java | 119 ++ .../ListAgentEngineSandboxesResponse.java | 156 ++ .../ListReasoningEnginesMemoriesResponse.java | 156 ++ .../vertexai/genai/types/MachineConfig.java | 108 ++ .../cloud/vertexai/genai/types/Memory.java | 452 +++++ .../genai/types/MemoryConjunctionFilter.java | 108 ++ .../vertexai/genai/types/MemoryFilter.java | 181 ++ .../types/MemoryMetadataMergeStrategy.java | 125 ++ .../genai/types/MemoryMetadataValue.java | 151 ++ .../vertexai/genai/types/MemoryRevision.java | 244 +++ .../vertexai/genai/types/MemoryTopicId.java | 5 +- .../cloud/vertexai/genai/types/Metadata.java | 87 + .../cloud/vertexai/genai/types/Operator.java | 114 ++ .../types/PurgeAgentEngineMemoriesConfig.java | 106 ++ ...eAgentEngineMemoriesRequestParameters.java | 254 +++ .../genai/types/PurgeMemoriesResponse.java | 81 + .../RetrieveAgentEngineMemoriesConfig.java | 198 +++ ...eAgentEngineMemoriesRequestParameters.java | 220 +++ ...MemoriesRequestSimilaritySearchParams.java | 119 ++ ...eMemoriesRequestSimpleRetrievalParams.java | 117 ++ .../genai/types/RetrieveMemoriesResponse.java | 139 ++ ...trieveMemoriesResponseRetrievedMemory.java | 121 ++ .../RollbackAgentEngineMemoryConfig.java | 106 ++ ...ackAgentEngineMemoryRequestParameters.java | 141 ++ .../genai/types/SandboxEnvironment.java | 304 ++++ .../SandboxEnvironmentConnectionInfo.java | 128 ++ .../genai/types/SandboxEnvironmentSpec.java | 130 ++ ...vironmentSpecCodeExecutionEnvironment.java | 147 ++ ...EnvironmentSpecComputerUseEnvironment.java | 60 + .../cloud/vertexai/genai/types/State.java | 119 ++ .../types/UpdateAgentEngineMemoryConfig.java | 410 +++++ ...ateAgentEngineMemoryRequestParameters.java | 180 ++ .../AgentEnginesMemoriesRevisionsTest.java | 64 + .../genai/AgentEnginesMemoriesTest.java | 213 +++ .../genai/AgentEnginesSandboxesTest.java | 158 ++ 89 files changed, 15145 insertions(+), 4 deletions(-) create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemories.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemoryRevisions.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSandboxes.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Memories.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/MemoryRevisions.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sandboxes.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineGenerateMemoriesOperation.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryOperation.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEnginePurgeMemoriesOperation.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineRollbackMemoryOperation.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSandboxOperation.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Chunk.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineMemoryRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryOperation.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxOperation.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteSandboxEnvironmentResponse.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSource.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSourceEvent.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSource.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestVertexSessionSource.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponse.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemory.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemoryAction.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineGenerateMemoriesOperationParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryOperationParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxOperationParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IntermediateExtractedMemory.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Language.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsResponse.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesResponse.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesMemoriesResponse.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Memory.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryConjunctionFilter.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryFilter.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryMetadataMergeStrategy.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryMetadataValue.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryRevision.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metadata.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Operator.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeAgentEngineMemoriesConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeAgentEngineMemoriesRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeMemoriesResponse.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimilaritySearchParams.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimpleRetrievalParams.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponse.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponseRetrievedMemory.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryRequestParameters.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironment.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentConnectionInfo.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpec.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecCodeExecutionEnvironment.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecComputerUseEnvironment.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/State.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryConfig.java create mode 100644 google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryRequestParameters.java create mode 100644 google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesMemoriesRevisionsTest.java create mode 100644 google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesMemoriesTest.java create mode 100644 google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesSandboxesTest.java diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java index dd81a7d..eff9ef1 100644 --- a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java @@ -52,12 +52,16 @@ public final class AgentEngines { public final Sessions sessions; + public final Sandboxes sandboxes; + public final Memories memories; final ApiClient apiClient; public AgentEngines(ApiClient apiClient) { this.apiClient = apiClient; this.sessions = new Sessions(apiClient); + this.sandboxes = new Sandboxes(apiClient); + this.memories = new Memories(apiClient); } @ExcludeFromGeneratedCoverageReport diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncAgentEngines.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncAgentEngines.java index 70c9450..c88371b 100644 --- a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncAgentEngines.java +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncAgentEngines.java @@ -38,6 +38,8 @@ /** Async module of {@link AgentEngines} */ public final class AsyncAgentEngines { public final AsyncSessions sessions; + public final AsyncSandboxes sandboxes; + public final AsyncMemories memories; AgentEngines agentEngines; ApiClient apiClient; @@ -47,6 +49,8 @@ public AsyncAgentEngines(ApiClient apiClient) { this.agentEngines = new AgentEngines(apiClient); this.sessions = new AsyncSessions(apiClient); + this.sandboxes = new AsyncSandboxes(apiClient); + this.memories = new AsyncMemories(apiClient); } CompletableFuture privateCreate(CreateAgentEngineConfig config) { diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemories.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemories.java new file mode 100644 index 0000000..bccf1ce --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemories.java @@ -0,0 +1,240 @@ +/* + * 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.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.AgentEngineGenerateMemoriesOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.AgentEnginePurgeMemoriesOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineRollbackMemoryOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.GenerateAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestDirectContentsSource; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestDirectMemoriesSource; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestVertexSessionSource; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesMemoriesResponse; +import com.google.cloud.vertexai.genai.types.Memory; +import com.google.cloud.vertexai.genai.types.MemoryConjunctionFilter; +import com.google.cloud.vertexai.genai.types.PurgeAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.RetrieveAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesRequestSimilaritySearchParams; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesRequestSimpleRetrievalParams; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesResponse; +import com.google.cloud.vertexai.genai.types.RollbackAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineMemoryConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link Memories} */ +public final class AsyncMemories { + public final AsyncMemoryRevisions revisions; + + Memories memories; + ApiClient apiClient; + + public AsyncMemories(ApiClient apiClient) { + this.apiClient = apiClient; + this.memories = new Memories(apiClient); + + this.revisions = new AsyncMemoryRevisions(apiClient); + } + + CompletableFuture privateCreate( + String name, String fact, Map scope, AgentEngineMemoryConfig config) { + + BuiltRequest builtRequest = memories.buildRequestForPrivateCreate(name, fact, scope, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateCreate(res, config); + } + }); + } + + public CompletableFuture delete( + String name, DeleteAgentEngineMemoryConfig config) { + + BuiltRequest builtRequest = memories.buildRequestForDelete(name, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForDelete(res, config); + } + }); + } + + CompletableFuture privateGenerate( + String name, + GenerateMemoriesRequestVertexSessionSource vertexSessionSource, + GenerateMemoriesRequestDirectContentsSource directContentsSource, + GenerateMemoriesRequestDirectMemoriesSource directMemoriesSource, + Map scope, + GenerateAgentEngineMemoriesConfig config) { + + BuiltRequest builtRequest = + memories.buildRequestForPrivateGenerate( + name, vertexSessionSource, directContentsSource, directMemoriesSource, scope, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateGenerate(res, config); + } + }); + } + + public CompletableFuture get(String name, GetAgentEngineMemoryConfig config) { + + BuiltRequest builtRequest = memories.buildRequestForGet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForGet(res, config); + } + }); + } + + CompletableFuture privateList( + String name, ListAgentEngineMemoryConfig config) { + + BuiltRequest builtRequest = memories.buildRequestForPrivateList(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateList(res, config); + } + }); + } + + CompletableFuture privateGetMemoryOperation( + String operationName, GetAgentEngineOperationConfig config) { + + BuiltRequest builtRequest = + memories.buildRequestForPrivateGetMemoryOperation(operationName, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateGetMemoryOperation(res, config); + } + }); + } + + CompletableFuture privateGetGenerateMemoriesOperation( + String operationName, GetAgentEngineOperationConfig config) { + + BuiltRequest builtRequest = + memories.buildRequestForPrivateGetGenerateMemoriesOperation(operationName, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateGetGenerateMemoriesOperation(res, config); + } + }); + } + + CompletableFuture privateRetrieve( + String name, + Map scope, + RetrieveMemoriesRequestSimilaritySearchParams similaritySearchParams, + RetrieveMemoriesRequestSimpleRetrievalParams simpleRetrievalParams, + RetrieveAgentEngineMemoriesConfig config) { + + BuiltRequest builtRequest = + memories.buildRequestForPrivateRetrieve( + name, scope, similaritySearchParams, simpleRetrievalParams, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateRetrieve(res, config); + } + }); + } + + CompletableFuture privateRollback( + String name, String targetRevisionId, RollbackAgentEngineMemoryConfig config) { + + BuiltRequest builtRequest = + memories.buildRequestForPrivateRollback(name, targetRevisionId, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateRollback(res, config); + } + }); + } + + CompletableFuture privateUpdate( + String name, String fact, Map scope, UpdateAgentEngineMemoryConfig config) { + + BuiltRequest builtRequest = memories.buildRequestForPrivateUpdate(name, fact, scope, config); + return this.apiClient + .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateUpdate(res, config); + } + }); + } + + CompletableFuture privatePurge( + String name, + String filter, + List filterGroups, + boolean force, + PurgeAgentEngineMemoriesConfig config) { + + BuiltRequest builtRequest = + memories.buildRequestForPrivatePurge(name, filter, filterGroups, force, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivatePurge(res, config); + } + }); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemoryRevisions.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemoryRevisions.java new file mode 100644 index 0000000..f7c58e0 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemoryRevisions.java @@ -0,0 +1,68 @@ +/* + * 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.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryRevisionConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsResponse; +import com.google.cloud.vertexai.genai.types.MemoryRevision; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link MemoryRevisions} */ +public final class AsyncMemoryRevisions { + + MemoryRevisions memoryRevisions; + ApiClient apiClient; + + public AsyncMemoryRevisions(ApiClient apiClient) { + this.apiClient = apiClient; + this.memoryRevisions = new MemoryRevisions(apiClient); + } + + public CompletableFuture get( + String name, GetAgentEngineMemoryRevisionConfig config) { + + BuiltRequest builtRequest = memoryRevisions.buildRequestForGet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memoryRevisions.processResponseForGet(res, config); + } + }); + } + + CompletableFuture privateList( + String name, ListAgentEngineMemoryRevisionsConfig config) { + + BuiltRequest builtRequest = memoryRevisions.buildRequestForPrivateList(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memoryRevisions.processResponseForPrivateList(res, config); + } + }); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSandboxes.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSandboxes.java new file mode 100644 index 0000000..5aa59ad --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSandboxes.java @@ -0,0 +1,136 @@ +/* + * 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.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.AgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.Chunk; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.ExecuteCodeAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.ExecuteSandboxEnvironmentResponse; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesResponse; +import com.google.cloud.vertexai.genai.types.SandboxEnvironment; +import com.google.cloud.vertexai.genai.types.SandboxEnvironmentSpec; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link Sandboxes} */ +public final class AsyncSandboxes { + + Sandboxes sandboxes; + ApiClient apiClient; + + public AsyncSandboxes(ApiClient apiClient) { + this.apiClient = apiClient; + this.sandboxes = new Sandboxes(apiClient); + } + + CompletableFuture privateCreate( + String name, SandboxEnvironmentSpec spec, CreateAgentEngineSandboxConfig config) { + + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateCreate(name, spec, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateCreate(res, config); + } + }); + } + + CompletableFuture privateDelete( + String name, DeleteAgentEngineSandboxConfig config) { + + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateDelete(name, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateDelete(res, config); + } + }); + } + + CompletableFuture privateExecuteCode( + String name, List inputs, ExecuteCodeAgentEngineSandboxConfig config) { + + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateExecuteCode(name, inputs, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateExecuteCode(res, config); + } + }); + } + + CompletableFuture privateGet( + String name, GetAgentEngineSandboxConfig config) { + + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateGet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateGet(res, config); + } + }); + } + + CompletableFuture privateList( + String name, ListAgentEngineSandboxesConfig config) { + + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateList(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateList(res, config); + } + }); + } + + CompletableFuture privateGetSandboxOperation( + String operationName, GetAgentEngineOperationConfig config) { + + BuiltRequest builtRequest = + sandboxes.buildRequestForPrivateGetSandboxOperation(operationName, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateGetSandboxOperation(res, config); + } + }); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Memories.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Memories.java new file mode 100644 index 0000000..8f14892 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Memories.java @@ -0,0 +1,1529 @@ +/* + * 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.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.AgentEngineGenerateMemoriesOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.AgentEnginePurgeMemoriesOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineRollbackMemoryOperation; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.GenerateAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.GenerateAgentEngineMemoriesRequestParameters; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestDirectContentsSource; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestDirectMemoriesSource; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestVertexSessionSource; +import com.google.cloud.vertexai.genai.types.GetAgentEngineGenerateMemoriesOperationParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryOperationParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesMemoriesResponse; +import com.google.cloud.vertexai.genai.types.Memory; +import com.google.cloud.vertexai.genai.types.MemoryConjunctionFilter; +import com.google.cloud.vertexai.genai.types.PurgeAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.PurgeAgentEngineMemoriesRequestParameters; +import com.google.cloud.vertexai.genai.types.RetrieveAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.RetrieveAgentEngineMemoriesRequestParameters; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesRequestSimilaritySearchParams; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesRequestSimpleRetrievalParams; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesResponse; +import com.google.cloud.vertexai.genai.types.RollbackAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.RollbackAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineMemoryRequestParameters; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class Memories { + public final MemoryRevisions revisions; + + final ApiClient apiClient; + + public Memories(ApiClient apiClient) { + this.apiClient = apiClient; + this.revisions = new MemoryRevisions(apiClient); + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode agentEngineMemoryConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"ttl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"ttl"}, + Common.getValueByPath(fromObject, new String[] {"ttl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"expireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"expireTime"}, + Common.getValueByPath(fromObject, new String[] {"expireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionExpireTime"}, + Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionTtl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionTtl"}, + Common.getValueByPath(fromObject, new String[] {"revisionTtl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"disableMemoryRevisions"}, + Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"topics"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"topics"}, + Common.getValueByPath(fromObject, new String[] {"topics"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"memoryId"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "memoryId"}, + Common.getValueByPath(fromObject, new String[] {"memoryId"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"fact"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"fact"}, + Common.getValueByPath(fromObject, new String[] {"fact"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"scope"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"scope"}, + Common.getValueByPath(fromObject, new String[] {"scope"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + JsonNode unused = + agentEngineMemoryConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deleteAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode generateAgentEngineMemoriesConfigToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"disableConsolidation"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"disableConsolidation"}, + Common.getValueByPath(fromObject, new String[] {"disableConsolidation"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionLabels"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionLabels"}, + Common.getValueByPath(fromObject, new String[] {"revisionLabels"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionExpireTime"}, + Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionTtl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionTtl"}, + Common.getValueByPath(fromObject, new String[] {"revisionTtl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"disableMemoryRevisions"}, + Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadataMergeStrategy"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"metadataMergeStrategy"}, + Common.getValueByPath(fromObject, new String[] {"metadataMergeStrategy"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode generateAgentEngineMemoriesRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"vertexSessionSource"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"vertexSessionSource"}, + Common.getValueByPath(fromObject, new String[] {"vertexSessionSource"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"directContentsSource"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"directContentsSource"}, + Common.getValueByPath(fromObject, new String[] {"directContentsSource"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"directMemoriesSource"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"directMemoriesSource"}, + Common.getValueByPath(fromObject, new String[] {"directMemoriesSource"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"scope"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"scope"}, + Common.getValueByPath(fromObject, new String[] {"scope"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + JsonNode unused = + generateAgentEngineMemoriesConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineGenerateMemoriesOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"operationName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operationName"}, + Common.getValueByPath(fromObject, new String[] {"operationName"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineMemoryOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"operationName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operationName"}, + Common.getValueByPath(fromObject, new String[] {"operationName"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineMemoryConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"orderBy"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "orderBy"}, + Common.getValueByPath(fromObject, new String[] {"orderBy"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + JsonNode unused = + listAgentEngineMemoryConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode purgeAgentEngineMemoriesRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filterGroups"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"filterGroups"}, + Common.getValueByPath(fromObject, new String[] {"filterGroups"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"force"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"force"}, + Common.getValueByPath(fromObject, new String[] {"force"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode retrieveAgentEngineMemoriesConfigToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filterGroups"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"filterGroups"}, + Common.getValueByPath(fromObject, new String[] {"filterGroups"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode retrieveAgentEngineMemoriesRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"scope"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"scope"}, + Common.getValueByPath(fromObject, new String[] {"scope"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"similaritySearchParams"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"similaritySearchParams"}, + Common.getValueByPath(fromObject, new String[] {"similaritySearchParams"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"simpleRetrievalParams"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"simpleRetrievalParams"}, + Common.getValueByPath(fromObject, new String[] {"simpleRetrievalParams"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + JsonNode unused = + retrieveAgentEngineMemoriesConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode rollbackAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"targetRevisionId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"targetRevisionId"}, + Common.getValueByPath(fromObject, new String[] {"targetRevisionId"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateAgentEngineMemoryConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"ttl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"ttl"}, + Common.getValueByPath(fromObject, new String[] {"ttl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"expireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"expireTime"}, + Common.getValueByPath(fromObject, new String[] {"expireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionExpireTime"}, + Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionTtl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionTtl"}, + Common.getValueByPath(fromObject, new String[] {"revisionTtl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"disableMemoryRevisions"}, + Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"topics"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"topics"}, + Common.getValueByPath(fromObject, new String[] {"topics"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"memoryId"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "memoryId"}, + Common.getValueByPath(fromObject, new String[] {"memoryId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"updateMask"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "updateMask"}, + Common.getValueByPath(fromObject, new String[] {"updateMask"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"fact"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"fact"}, + Common.getValueByPath(fromObject, new String[] {"fact"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"scope"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"scope"}, + Common.getValueByPath(fromObject, new String[] {"scope"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + JsonNode unused = + updateAgentEngineMemoryConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreate( + String name, String fact, Map scope, AgentEngineMemoryConfig config) { + + CreateAgentEngineMemoryRequestParameters.Builder parameterBuilder = + CreateAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(fact)) { + parameterBuilder.fact(fact); + } + if (!Common.isZero(scope)) { + parameterBuilder.scope(scope); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineMemoryOperation processResponseForPrivateCreate( + ApiResponse response, AgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineMemoryOperation.class); + } + + public AgentEngineMemoryOperation privateCreate( + String name, String fact, Map scope, AgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateCreate(name, fact, scope, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForDelete(String name, DeleteAgentEngineMemoryConfig config) { + + DeleteAgentEngineMemoryRequestParameters.Builder parameterBuilder = + DeleteAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deleteAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DeleteAgentEngineMemoryOperation processResponseForDelete( + ApiResponse response, DeleteAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DeleteAgentEngineMemoryOperation.class); + } + + public DeleteAgentEngineMemoryOperation delete( + String name, DeleteAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForDelete(name, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForDelete(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGenerate( + String name, + GenerateMemoriesRequestVertexSessionSource vertexSessionSource, + GenerateMemoriesRequestDirectContentsSource directContentsSource, + GenerateMemoriesRequestDirectMemoriesSource directMemoriesSource, + Map scope, + GenerateAgentEngineMemoriesConfig config) { + + GenerateAgentEngineMemoriesRequestParameters.Builder parameterBuilder = + GenerateAgentEngineMemoriesRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(vertexSessionSource)) { + parameterBuilder.vertexSessionSource(vertexSessionSource); + } + if (!Common.isZero(directContentsSource)) { + parameterBuilder.directContentsSource(directContentsSource); + } + if (!Common.isZero(directMemoriesSource)) { + parameterBuilder.directMemoriesSource(directMemoriesSource); + } + if (!Common.isZero(scope)) { + parameterBuilder.scope(scope); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = generateAgentEngineMemoriesRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories:generate", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineGenerateMemoriesOperation processResponseForPrivateGenerate( + ApiResponse response, GenerateAgentEngineMemoriesConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineGenerateMemoriesOperation.class); + } + + public AgentEngineGenerateMemoriesOperation privateGenerate( + String name, + GenerateMemoriesRequestVertexSessionSource vertexSessionSource, + GenerateMemoriesRequestDirectContentsSource directContentsSource, + GenerateMemoriesRequestDirectMemoriesSource directMemoriesSource, + Map scope, + GenerateAgentEngineMemoriesConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateGenerate( + name, vertexSessionSource, directContentsSource, directMemoriesSource, scope, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGenerate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForGet(String name, GetAgentEngineMemoryConfig config) { + + GetAgentEngineMemoryRequestParameters.Builder parameterBuilder = + GetAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + Memory processResponseForGet(ApiResponse response, GetAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, Memory.class); + } + + public Memory get(String name, GetAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForGet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForGet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateList(String name, ListAgentEngineMemoryConfig config) { + + ListAgentEngineMemoryRequestParameters.Builder parameterBuilder = + ListAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListReasoningEnginesMemoriesResponse processResponseForPrivateList( + ApiResponse response, ListAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListReasoningEnginesMemoriesResponse.class); + } + + public ListReasoningEnginesMemoriesResponse privateList( + String name, ListAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateList(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateList(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetMemoryOperation( + String operationName, GetAgentEngineOperationConfig config) { + + GetAgentEngineMemoryOperationParameters.Builder parameterBuilder = + GetAgentEngineMemoryOperationParameters.builder(); + + if (!Common.isZero(operationName)) { + parameterBuilder.operationName(operationName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineMemoryOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("{operationName}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineMemoryOperation processResponseForPrivateGetMemoryOperation( + ApiResponse response, GetAgentEngineOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineMemoryOperation.class); + } + + public AgentEngineMemoryOperation privateGetMemoryOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetMemoryOperation(operationName, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetMemoryOperation(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetGenerateMemoriesOperation( + String operationName, GetAgentEngineOperationConfig config) { + + GetAgentEngineGenerateMemoriesOperationParameters.Builder parameterBuilder = + GetAgentEngineGenerateMemoriesOperationParameters.builder(); + + if (!Common.isZero(operationName)) { + parameterBuilder.operationName(operationName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineGenerateMemoriesOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("{operationName}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineGenerateMemoriesOperation processResponseForPrivateGetGenerateMemoriesOperation( + ApiResponse response, GetAgentEngineOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineGenerateMemoriesOperation.class); + } + + public AgentEngineGenerateMemoriesOperation privateGetGenerateMemoriesOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateGetGenerateMemoriesOperation(operationName, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetGenerateMemoriesOperation(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateRetrieve( + String name, + Map scope, + RetrieveMemoriesRequestSimilaritySearchParams similaritySearchParams, + RetrieveMemoriesRequestSimpleRetrievalParams simpleRetrievalParams, + RetrieveAgentEngineMemoriesConfig config) { + + RetrieveAgentEngineMemoriesRequestParameters.Builder parameterBuilder = + RetrieveAgentEngineMemoriesRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(scope)) { + parameterBuilder.scope(scope); + } + if (!Common.isZero(similaritySearchParams)) { + parameterBuilder.similaritySearchParams(similaritySearchParams); + } + if (!Common.isZero(simpleRetrievalParams)) { + parameterBuilder.simpleRetrievalParams(simpleRetrievalParams); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = retrieveAgentEngineMemoriesRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories:retrieve", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + RetrieveMemoriesResponse processResponseForPrivateRetrieve( + ApiResponse response, RetrieveAgentEngineMemoriesConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, RetrieveMemoriesResponse.class); + } + + public RetrieveMemoriesResponse privateRetrieve( + String name, + Map scope, + RetrieveMemoriesRequestSimilaritySearchParams similaritySearchParams, + RetrieveMemoriesRequestSimpleRetrievalParams simpleRetrievalParams, + RetrieveAgentEngineMemoriesConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateRetrieve( + name, scope, similaritySearchParams, simpleRetrievalParams, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateRetrieve(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateRollback( + String name, String targetRevisionId, RollbackAgentEngineMemoryConfig config) { + + RollbackAgentEngineMemoryRequestParameters.Builder parameterBuilder = + RollbackAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(targetRevisionId)) { + parameterBuilder.targetRevisionId(targetRevisionId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = rollbackAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}:rollback", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineRollbackMemoryOperation processResponseForPrivateRollback( + ApiResponse response, RollbackAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineRollbackMemoryOperation.class); + } + + public AgentEngineRollbackMemoryOperation privateRollback( + String name, String targetRevisionId, RollbackAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateRollback(name, targetRevisionId, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateRollback(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateUpdate( + String name, String fact, Map scope, UpdateAgentEngineMemoryConfig config) { + + UpdateAgentEngineMemoryRequestParameters.Builder parameterBuilder = + UpdateAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(fact)) { + parameterBuilder.fact(fact); + } + if (!Common.isZero(scope)) { + parameterBuilder.scope(scope); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = updateAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineMemoryOperation processResponseForPrivateUpdate( + ApiResponse response, UpdateAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineMemoryOperation.class); + } + + public AgentEngineMemoryOperation privateUpdate( + String name, String fact, Map scope, UpdateAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateUpdate(name, fact, scope, config); + + try (ApiResponse response = + this.apiClient.request( + "patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateUpdate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivatePurge( + String name, + String filter, + List filterGroups, + boolean force, + PurgeAgentEngineMemoriesConfig config) { + + PurgeAgentEngineMemoriesRequestParameters.Builder parameterBuilder = + PurgeAgentEngineMemoriesRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(filter)) { + parameterBuilder.filter(filter); + } + if (!Common.isZero(filterGroups)) { + parameterBuilder.filterGroups(filterGroups); + } + if (!Common.isZero(force)) { + parameterBuilder.force(force); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = purgeAgentEngineMemoriesRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories:purge", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEnginePurgeMemoriesOperation processResponseForPrivatePurge( + ApiResponse response, PurgeAgentEngineMemoriesConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEnginePurgeMemoriesOperation.class); + } + + public AgentEnginePurgeMemoriesOperation privatePurge( + String name, + String filter, + List filterGroups, + boolean force, + PurgeAgentEngineMemoriesConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivatePurge(name, filter, filterGroups, force, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivatePurge(response, config); + } + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/MemoryRevisions.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/MemoryRevisions.java new file mode 100644 index 0000000..53a43c7 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/MemoryRevisions.java @@ -0,0 +1,257 @@ +/* + * 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.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryRevisionConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryRevisionRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsResponse; +import com.google.cloud.vertexai.genai.types.MemoryRevision; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class MemoryRevisions { + + final ApiClient apiClient; + + public MemoryRevisions(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineMemoryRevisionRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineMemoryRevisionsConfigToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineMemoryRevisionsRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + JsonNode unused = + listAgentEngineMemoryRevisionsConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForGet(String name, GetAgentEngineMemoryRevisionConfig config) { + + GetAgentEngineMemoryRevisionRequestParameters.Builder parameterBuilder = + GetAgentEngineMemoryRevisionRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineMemoryRevisionRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + MemoryRevision processResponseForGet( + ApiResponse response, GetAgentEngineMemoryRevisionConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, MemoryRevision.class); + } + + public MemoryRevision get(String name, GetAgentEngineMemoryRevisionConfig config) { + BuiltRequest builtRequest = buildRequestForGet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForGet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateList( + String name, ListAgentEngineMemoryRevisionsConfig config) { + + ListAgentEngineMemoryRevisionsRequestParameters.Builder parameterBuilder = + ListAgentEngineMemoryRevisionsRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listAgentEngineMemoryRevisionsRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/revisions", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListAgentEngineMemoryRevisionsResponse processResponseForPrivateList( + ApiResponse response, ListAgentEngineMemoryRevisionsConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode( + responseNode, ListAgentEngineMemoryRevisionsResponse.class); + } + + public ListAgentEngineMemoryRevisionsResponse privateList( + String name, ListAgentEngineMemoryRevisionsConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateList(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateList(response, config); + } + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sandboxes.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sandboxes.java new file mode 100644 index 0000000..4f38ab6 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sandboxes.java @@ -0,0 +1,671 @@ +/* + * 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.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.AgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.Chunk; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSandboxRequestParameters; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxRequestParameters; +import com.google.cloud.vertexai.genai.types.ExecuteCodeAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.ExecuteCodeAgentEngineSandboxRequestParameters; +import com.google.cloud.vertexai.genai.types.ExecuteSandboxEnvironmentResponse; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSandboxOperationParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSandboxRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesResponse; +import com.google.cloud.vertexai.genai.types.SandboxEnvironment; +import com.google.cloud.vertexai.genai.types.SandboxEnvironmentSpec; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class Sandboxes { + + final ApiClient apiClient; + + public Sandboxes(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineSandboxConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"ttl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"ttl"}, + Common.getValueByPath(fromObject, new String[] {"ttl"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineSandboxRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"spec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"spec"}, + Common.getValueByPath(fromObject, new String[] {"spec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + JsonNode unused = + createAgentEngineSandboxConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deleteAgentEngineSandboxRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode executeCodeAgentEngineSandboxRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"inputs"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"inputs"}, + Common.getValueByPath(fromObject, new String[] {"inputs"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineSandboxOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"operationName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operationName"}, + Common.getValueByPath(fromObject, new String[] {"operationName"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineSandboxRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineSandboxesConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineSandboxesRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + JsonNode unused = + listAgentEngineSandboxesConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreate( + String name, SandboxEnvironmentSpec spec, CreateAgentEngineSandboxConfig config) { + + CreateAgentEngineSandboxRequestParameters.Builder parameterBuilder = + CreateAgentEngineSandboxRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(spec)) { + parameterBuilder.spec(spec); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createAgentEngineSandboxRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/sandboxEnvironments", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineSandboxOperation processResponseForPrivateCreate( + ApiResponse response, CreateAgentEngineSandboxConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineSandboxOperation.class); + } + + public AgentEngineSandboxOperation privateCreate( + String name, SandboxEnvironmentSpec spec, CreateAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateCreate(name, spec, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateDelete(String name, DeleteAgentEngineSandboxConfig config) { + + DeleteAgentEngineSandboxRequestParameters.Builder parameterBuilder = + DeleteAgentEngineSandboxRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deleteAgentEngineSandboxRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DeleteAgentEngineSandboxOperation processResponseForPrivateDelete( + ApiResponse response, DeleteAgentEngineSandboxConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DeleteAgentEngineSandboxOperation.class); + } + + public DeleteAgentEngineSandboxOperation privateDelete( + String name, DeleteAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateDelete(name, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateDelete(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateExecuteCode( + String name, List inputs, ExecuteCodeAgentEngineSandboxConfig config) { + + ExecuteCodeAgentEngineSandboxRequestParameters.Builder parameterBuilder = + ExecuteCodeAgentEngineSandboxRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(inputs)) { + parameterBuilder.inputs(inputs); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = executeCodeAgentEngineSandboxRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/:execute", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ExecuteSandboxEnvironmentResponse processResponseForPrivateExecuteCode( + ApiResponse response, ExecuteCodeAgentEngineSandboxConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ExecuteSandboxEnvironmentResponse.class); + } + + public ExecuteSandboxEnvironmentResponse privateExecuteCode( + String name, List inputs, ExecuteCodeAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateExecuteCode(name, inputs, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateExecuteCode(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGet(String name, GetAgentEngineSandboxConfig config) { + + GetAgentEngineSandboxRequestParameters.Builder parameterBuilder = + GetAgentEngineSandboxRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineSandboxRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + SandboxEnvironment processResponseForPrivateGet( + ApiResponse response, GetAgentEngineSandboxConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, SandboxEnvironment.class); + } + + public SandboxEnvironment privateGet(String name, GetAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateList(String name, ListAgentEngineSandboxesConfig config) { + + ListAgentEngineSandboxesRequestParameters.Builder parameterBuilder = + ListAgentEngineSandboxesRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listAgentEngineSandboxesRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/sandboxEnvironments", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListAgentEngineSandboxesResponse processResponseForPrivateList( + ApiResponse response, ListAgentEngineSandboxesConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListAgentEngineSandboxesResponse.class); + } + + public ListAgentEngineSandboxesResponse privateList( + String name, ListAgentEngineSandboxesConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateList(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateList(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetSandboxOperation( + String operationName, GetAgentEngineOperationConfig config) { + + GetAgentEngineSandboxOperationParameters.Builder parameterBuilder = + GetAgentEngineSandboxOperationParameters.builder(); + + if (!Common.isZero(operationName)) { + parameterBuilder.operationName(operationName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineSandboxOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("{operationName}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineSandboxOperation processResponseForPrivateGetSandboxOperation( + ApiResponse response, GetAgentEngineOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineSandboxOperation.class); + } + + public AgentEngineSandboxOperation privateGetSandboxOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetSandboxOperation(operationName, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetSandboxOperation(response, config); + } + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineGenerateMemoriesOperation.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineGenerateMemoriesOperation.java new file mode 100644 index 0000000..a150287 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineGenerateMemoriesOperation.java @@ -0,0 +1,201 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that generates memories for an agent engine. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineGenerateMemoriesOperation.Builder.class) +public abstract class AgentEngineGenerateMemoriesOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The response for generating memories. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEngineGenerateMemoriesOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineGenerateMemoriesOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineGenerateMemoriesOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `AgentEngineGenerateMemoriesOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineGenerateMemoriesOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The response for generating memories. + */ + @JsonProperty("response") + public abstract Builder response(GenerateMemoriesResponse response); + + /** + * Setter for response builder. + * + *

response: The response for generating memories. + */ + @CanIgnoreReturnValue + public Builder response(GenerateMemoriesResponse.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEngineGenerateMemoriesOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineGenerateMemoriesOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineGenerateMemoriesOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineGenerateMemoriesOperation.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryConfig.java new file mode 100644 index 0000000..a8977cb --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryConfig.java @@ -0,0 +1,382 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Config for creating a Memory. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineMemoryConfig.Builder.class) +public abstract class AgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name of the memory. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the memory. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** + * Optional. Timestamp of when this resource is considered expired. This is *always* provided on + * output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Optional. Input only. Timestamp of when the revision is considered expired. If not set, the + * memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Optional revisionExpireTime(); + + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + @JsonProperty("revisionTtl") + public abstract Optional revisionTtl(); + + /** Optional. Input only. If true, no revision will be created for this request. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** Optional. The topics of the memory. */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** + * Optional. User-provided metadata for the Memory. This information was provided when creating, + * updating, or generating the Memory. It was not generated by Memory Bank. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * Optional. The user defined ID to use for memory, which will become the final component of the + * memory resource name. If not provided, Vertex AI will generate a value for this ID. This value + * may be up to 63 characters, and valid characters are `[a-z0-9-]`. The first character must be a + * letter, and the last character must be a letter or number. + */ + @JsonProperty("memoryId") + public abstract Optional memoryId(); + + /** Instantiates a builder for AgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineMemoryConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the memory. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the memory. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this resource is considered expired. This is + * *always* provided on output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for revisionExpireTime. + * + *

revisionExpireTime: Optional. Input only. Timestamp of when the revision is considered + * expired. If not set, the memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Builder revisionExpireTime(Instant revisionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionExpireTime(Optional revisionExpireTime); + + /** Clears the value of revisionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionExpireTime() { + return revisionExpireTime(Optional.empty()); + } + + /** + * Setter for revisionTtl. + * + *

revisionTtl: Optional. Input only. The TTL for the revision. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("revisionTtl") + public abstract Builder revisionTtl(Duration revisionTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionTtl(Optional revisionTtl); + + /** Clears the value of revisionTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionTtl() { + return revisionTtl(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: Optional. Input only. If true, no revision will be created for + * this request. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The topics of the memory. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The topics of the memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The topics of the memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Optional. User-provided metadata for the Memory. This information was provided + * when creating, updating, or generating the Memory. It was not generated by Memory Bank. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for memoryId. + * + *

memoryId: Optional. The user defined ID to use for memory, which will become the final + * component of the memory resource name. If not provided, Vertex AI will generate a value for + * this ID. This value may be up to 63 characters, and valid characters are `[a-z0-9-]`. The + * first character must be a letter, and the last character must be a letter or number. + */ + @JsonProperty("memoryId") + public abstract Builder memoryId(String memoryId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder memoryId(Optional memoryId); + + /** Clears the value of memoryId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemoryId() { + return memoryId(Optional.empty()); + } + + public abstract AgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a AgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineMemoryConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryOperation.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryOperation.java new file mode 100644 index 0000000..56700ba --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryOperation.java @@ -0,0 +1,198 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that has an agent engine memory as a response. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineMemoryOperation.Builder.class) +public abstract class AgentEngineMemoryOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The Agent Engine Memory. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEngineMemoryOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineMemoryOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineMemoryOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineMemoryOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineMemoryOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The Agent Engine Memory. + */ + @JsonProperty("response") + public abstract Builder response(Memory response); + + /** + * Setter for response builder. + * + *

response: The Agent Engine Memory. + */ + @CanIgnoreReturnValue + public Builder response(Memory.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEngineMemoryOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineMemoryOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineMemoryOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineMemoryOperation.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEnginePurgeMemoriesOperation.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEnginePurgeMemoriesOperation.java new file mode 100644 index 0000000..2a04546 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEnginePurgeMemoriesOperation.java @@ -0,0 +1,201 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that purges memories from an agent engine. */ +@AutoValue +@JsonDeserialize(builder = AgentEnginePurgeMemoriesOperation.Builder.class) +public abstract class AgentEnginePurgeMemoriesOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The response for purging memories. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEnginePurgeMemoriesOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEnginePurgeMemoriesOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEnginePurgeMemoriesOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `AgentEnginePurgeMemoriesOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEnginePurgeMemoriesOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The response for purging memories. + */ + @JsonProperty("response") + public abstract Builder response(PurgeMemoriesResponse response); + + /** + * Setter for response builder. + * + *

response: The response for purging memories. + */ + @CanIgnoreReturnValue + public Builder response(PurgeMemoriesResponse.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEnginePurgeMemoriesOperation build(); + } + + /** Deserializes a JSON string to a AgentEnginePurgeMemoriesOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEnginePurgeMemoriesOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEnginePurgeMemoriesOperation.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineRollbackMemoryOperation.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineRollbackMemoryOperation.java new file mode 100644 index 0000000..bd2e312 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineRollbackMemoryOperation.java @@ -0,0 +1,169 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that rolls back a memory. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineRollbackMemoryOperation.Builder.class) +public abstract class AgentEngineRollbackMemoryOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for AgentEngineRollbackMemoryOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineRollbackMemoryOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineRollbackMemoryOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `AgentEngineRollbackMemoryOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineRollbackMemoryOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract AgentEngineRollbackMemoryOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineRollbackMemoryOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineRollbackMemoryOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineRollbackMemoryOperation.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSandboxOperation.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSandboxOperation.java new file mode 100644 index 0000000..add419b --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSandboxOperation.java @@ -0,0 +1,198 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that has an agent engine sandbox as a response. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineSandboxOperation.Builder.class) +public abstract class AgentEngineSandboxOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The Agent Engine Sandbox. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEngineSandboxOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineSandboxOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineSandboxOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineSandboxOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineSandboxOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The Agent Engine Sandbox. + */ + @JsonProperty("response") + public abstract Builder response(SandboxEnvironment response); + + /** + * Setter for response builder. + * + *

response: The Agent Engine Sandbox. + */ + @CanIgnoreReturnValue + public Builder response(SandboxEnvironment.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEngineSandboxOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineSandboxOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineSandboxOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineSandboxOperation.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Chunk.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Chunk.java new file mode 100644 index 0000000..2bd4d20 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Chunk.java @@ -0,0 +1,139 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A chunk of data. */ +@AutoValue +@JsonDeserialize(builder = Chunk.Builder.class) +public abstract class Chunk extends JsonSerializable { + /** Required. The data in the chunk. */ + @JsonProperty("data") + public abstract Optional data(); + + /** Optional. Metadata that is associated with the data in the payload. */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** + * Required. Mime type of the chunk data. See + * https://www.iana.org/assignments/media-types/media-types.xhtml for the full list. + */ + @JsonProperty("mimeType") + public abstract Optional mimeType(); + + /** Instantiates a builder for Chunk. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Chunk.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Chunk. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Chunk.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Chunk.Builder(); + } + + /** + * Setter for data. + * + *

data: Required. The data in the chunk. + */ + @JsonProperty("data") + public abstract Builder data(byte[] data); + + @ExcludeFromGeneratedCoverageReport + abstract Builder data(Optional data); + + /** Clears the value of data field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearData() { + return data(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Optional. Metadata that is associated with the data in the payload. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Metadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: Optional. Metadata that is associated with the data in the payload. + */ + @CanIgnoreReturnValue + public Builder metadata(Metadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for mimeType. + * + *

mimeType: Required. Mime type of the chunk data. See + * https://www.iana.org/assignments/media-types/media-types.xhtml for the full list. + */ + @JsonProperty("mimeType") + public abstract Builder mimeType(String mimeType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder mimeType(Optional mimeType); + + /** Clears the value of mimeType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMimeType() { + return mimeType(Optional.empty()); + } + + public abstract Chunk build(); + } + + /** Deserializes a JSON string to a Chunk object. */ + @ExcludeFromGeneratedCoverageReport + public static Chunk fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Chunk.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineMemoryRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineMemoryRequestParameters.java new file mode 100644 index 0000000..4fdc673 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineMemoryRequestParameters.java @@ -0,0 +1,180 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Parameters for creating Agent Engine Memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateAgentEngineMemoryRequestParameters.Builder.class) +public abstract class CreateAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine to create the memory under. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * The fact of the memory. + * + *

This is the semantic knowledge extracted from the source content). + */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * The scope of the memory. + * + *

Memories are isolated within their scope. The scope is defined when creating or generating + * memories. Up to 5 key-value pairs are accepted, andscope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to create the memory under. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for fact. + * + *

fact: The fact of the memory. + * + *

This is the semantic knowledge extracted from the source content). + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: The scope of the memory. + * + *

Memories are isolated within their scope. The scope is defined when creating or generating + * memories. Up to 5 key-value pairs are accepted, andscope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(AgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(AgentEngineMemoryConfig.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 CreateAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, CreateAgentEngineMemoryRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxConfig.java new file mode 100644 index 0000000..729657b --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxConfig.java @@ -0,0 +1,173 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.util.Optional; + +/** Config for creating a Sandbox. */ +@AutoValue +@JsonDeserialize(builder = CreateAgentEngineSandboxConfig.Builder.class) +public abstract class CreateAgentEngineSandboxConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name of the sandbox. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the sandbox. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** The TTL for this resource. The expiration time is computed: now + TTL. */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** Instantiates a builder for CreateAgentEngineSandboxConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineSandboxConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineSandboxConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineSandboxConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineSandboxConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the sandbox. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the sandbox. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: The TTL for this resource. The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + public abstract CreateAgentEngineSandboxConfig build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineSandboxConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineSandboxConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateAgentEngineSandboxConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxRequestParameters.java new file mode 100644 index 0000000..86e3700 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxRequestParameters.java @@ -0,0 +1,151 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for creating Agent Engine Sandboxes. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateAgentEngineSandboxRequestParameters.Builder.class) +public abstract class CreateAgentEngineSandboxRequestParameters extends JsonSerializable { + /** Name of the agent engine to create the sandbox under. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The specification of the sandbox. */ + @JsonProperty("spec") + public abstract Optional spec(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateAgentEngineSandboxRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineSandboxRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineSandboxRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineSandboxRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineSandboxRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to create the sandbox under. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for spec. + * + *

spec: The specification of the sandbox. + */ + @JsonProperty("spec") + public abstract Builder spec(SandboxEnvironmentSpec spec); + + /** + * Setter for spec builder. + * + *

spec: The specification of the sandbox. + */ + @CanIgnoreReturnValue + public Builder spec(SandboxEnvironmentSpec.Builder specBuilder) { + return spec(specBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder spec(Optional spec); + + /** Clears the value of spec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSpec() { + return spec(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateAgentEngineSandboxConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateAgentEngineSandboxConfig.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 CreateAgentEngineSandboxRequestParameters build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineSandboxRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineSandboxRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, CreateAgentEngineSandboxRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryConfig.java new file mode 100644 index 0000000..f58296e --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryConfig.java @@ -0,0 +1,84 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for deleting an Agent Engine Memory. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineMemoryConfig.Builder.class) +public abstract class DeleteAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for DeleteAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineMemoryConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract DeleteAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineMemoryConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryOperation.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryOperation.java new file mode 100644 index 0000000..9e93751 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryOperation.java @@ -0,0 +1,169 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation for deleting agent engines. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineMemoryOperation.Builder.class) +public abstract class DeleteAgentEngineMemoryOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for DeleteAgentEngineMemoryOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineMemoryOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineMemoryOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineMemoryOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineMemoryOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract DeleteAgentEngineMemoryOperation build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineMemoryOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineMemoryOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineMemoryOperation.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryRequestParameters.java new file mode 100644 index 0000000..7eee923 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeleteAgentEngineMemoryRequestParameters.Builder.class) +public abstract class DeleteAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine memory to delete. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeleteAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine memory to delete. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(DeleteAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(DeleteAgentEngineMemoryConfig.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 DeleteAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, DeleteAgentEngineMemoryRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxConfig.java new file mode 100644 index 0000000..b6b5884 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxConfig.java @@ -0,0 +1,84 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for deleting an Agent Engine Sandbox. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineSandboxConfig.Builder.class) +public abstract class DeleteAgentEngineSandboxConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for DeleteAgentEngineSandboxConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSandboxConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSandboxConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSandboxConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSandboxConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract DeleteAgentEngineSandboxConfig build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSandboxConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSandboxConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineSandboxConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxOperation.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxOperation.java new file mode 100644 index 0000000..3fbe570 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxOperation.java @@ -0,0 +1,169 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation for deleting agent engines. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineSandboxOperation.Builder.class) +public abstract class DeleteAgentEngineSandboxOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for DeleteAgentEngineSandboxOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSandboxOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSandboxOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSandboxOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSandboxOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract DeleteAgentEngineSandboxOperation build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSandboxOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSandboxOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineSandboxOperation.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxRequestParameters.java new file mode 100644 index 0000000..8b26476 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeleteAgentEngineSandboxRequestParameters.Builder.class) +public abstract class DeleteAgentEngineSandboxRequestParameters extends JsonSerializable { + /** Name of the agent engine sandbox to delete. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeleteAgentEngineSandboxRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSandboxRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSandboxRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSandboxRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSandboxRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine sandbox to delete. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(DeleteAgentEngineSandboxConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(DeleteAgentEngineSandboxConfig.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 DeleteAgentEngineSandboxRequestParameters build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSandboxRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSandboxRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, DeleteAgentEngineSandboxRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxConfig.java new file mode 100644 index 0000000..93fbf16 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxConfig.java @@ -0,0 +1,85 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for executing code in an Agent Engine sandbox. */ +@AutoValue +@JsonDeserialize(builder = ExecuteCodeAgentEngineSandboxConfig.Builder.class) +public abstract class ExecuteCodeAgentEngineSandboxConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for ExecuteCodeAgentEngineSandboxConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExecuteCodeAgentEngineSandboxConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExecuteCodeAgentEngineSandboxConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ExecuteCodeAgentEngineSandboxConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExecuteCodeAgentEngineSandboxConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract ExecuteCodeAgentEngineSandboxConfig build(); + } + + /** Deserializes a JSON string to a ExecuteCodeAgentEngineSandboxConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ExecuteCodeAgentEngineSandboxConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExecuteCodeAgentEngineSandboxConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxRequestParameters.java new file mode 100644 index 0000000..10faf25 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxRequestParameters.java @@ -0,0 +1,168 @@ +/* + * 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.cloud.vertexai.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 executing code in an agent engine sandbox. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ExecuteCodeAgentEngineSandboxRequestParameters.Builder.class) +public abstract class ExecuteCodeAgentEngineSandboxRequestParameters extends JsonSerializable { + /** Name of the agent engine sandbox to execute code in. */ + @JsonProperty("name") + public abstract Optional name(); + + /** Inputs to the code execution. */ + @JsonProperty("inputs") + public abstract Optional> inputs(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ExecuteCodeAgentEngineSandboxRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExecuteCodeAgentEngineSandboxRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExecuteCodeAgentEngineSandboxRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ExecuteCodeAgentEngineSandboxRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExecuteCodeAgentEngineSandboxRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine sandbox to execute code in. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for inputs. + * + *

inputs: Inputs to the code execution. + */ + @JsonProperty("inputs") + public abstract Builder inputs(List inputs); + + /** + * Setter for inputs. + * + *

inputs: Inputs to the code execution. + */ + @CanIgnoreReturnValue + public Builder inputs(Chunk... inputs) { + return inputs(Arrays.asList(inputs)); + } + + /** + * Setter for inputs builder. + * + *

inputs: Inputs to the code execution. + */ + @CanIgnoreReturnValue + public Builder inputs(Chunk.Builder... inputsBuilders) { + return inputs( + Arrays.asList(inputsBuilders).stream() + .map(Chunk.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputs(Optional> inputs); + + /** Clears the value of inputs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputs() { + return inputs(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ExecuteCodeAgentEngineSandboxConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ExecuteCodeAgentEngineSandboxConfig.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 ExecuteCodeAgentEngineSandboxRequestParameters build(); + } + + /** Deserializes a JSON string to a ExecuteCodeAgentEngineSandboxRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ExecuteCodeAgentEngineSandboxRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ExecuteCodeAgentEngineSandboxRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteSandboxEnvironmentResponse.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteSandboxEnvironmentResponse.java new file mode 100644 index 0000000..5908af1 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteSandboxEnvironmentResponse.java @@ -0,0 +1,111 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The response for executing a sandbox environment. */ +@AutoValue +@JsonDeserialize(builder = ExecuteSandboxEnvironmentResponse.Builder.class) +public abstract class ExecuteSandboxEnvironmentResponse extends JsonSerializable { + /** The outputs from the sandbox environment. */ + @JsonProperty("outputs") + public abstract Optional> outputs(); + + /** Instantiates a builder for ExecuteSandboxEnvironmentResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExecuteSandboxEnvironmentResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExecuteSandboxEnvironmentResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ExecuteSandboxEnvironmentResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExecuteSandboxEnvironmentResponse.Builder(); + } + + /** + * Setter for outputs. + * + *

outputs: The outputs from the sandbox environment. + */ + @JsonProperty("outputs") + public abstract Builder outputs(List outputs); + + /** + * Setter for outputs. + * + *

outputs: The outputs from the sandbox environment. + */ + @CanIgnoreReturnValue + public Builder outputs(Chunk... outputs) { + return outputs(Arrays.asList(outputs)); + } + + /** + * Setter for outputs builder. + * + *

outputs: The outputs from the sandbox environment. + */ + @CanIgnoreReturnValue + public Builder outputs(Chunk.Builder... outputsBuilders) { + return outputs( + Arrays.asList(outputsBuilders).stream() + .map(Chunk.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder outputs(Optional> outputs); + + /** Clears the value of outputs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutputs() { + return outputs(Optional.empty()); + } + + public abstract ExecuteSandboxEnvironmentResponse build(); + } + + /** Deserializes a JSON string to a ExecuteSandboxEnvironmentResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ExecuteSandboxEnvironmentResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExecuteSandboxEnvironmentResponse.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesConfig.java new file mode 100644 index 0000000..32110d5 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesConfig.java @@ -0,0 +1,313 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** Config for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateAgentEngineMemoriesConfig.Builder.class) +public abstract class GenerateAgentEngineMemoriesConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * Whether to disable consolidation of memories. + * + *

If true, generated memories will not be consolidated with existing memories; all generated + * memories will be added as new memories regardless of whether they are duplicates of or + * contradictory to existing memories. By default, memory consolidation is enabled. + */ + @JsonProperty("disableConsolidation") + public abstract Optional disableConsolidation(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * Labels to apply to the memory revision. For example, you can use this to label a revision with + * its data source. + */ + @JsonProperty("revisionLabels") + public abstract Optional> revisionLabels(); + + /** + * Optional. Input only. Timestamp of when the revision is considered expired. If not set, the + * memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Optional revisionExpireTime(); + + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + @JsonProperty("revisionTtl") + public abstract Optional revisionTtl(); + + /** Optional. Input only. If true, no revisions will be created for this request. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** + * Optional. User-provided metadata for the generated memories. This is not generated by Memory + * Bank. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** Optional. The strategy to use when applying metadata to existing memories. */ + @JsonProperty("metadataMergeStrategy") + public abstract Optional metadataMergeStrategy(); + + /** Instantiates a builder for GenerateAgentEngineMemoriesConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateAgentEngineMemoriesConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateAgentEngineMemoriesConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateAgentEngineMemoriesConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateAgentEngineMemoriesConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for disableConsolidation. + * + *

disableConsolidation: Whether to disable consolidation of memories. + * + *

If true, generated memories will not be consolidated with existing memories; all generated + * memories will be added as new memories regardless of whether they are duplicates of or + * contradictory to existing memories. By default, memory consolidation is enabled. + */ + @JsonProperty("disableConsolidation") + public abstract Builder disableConsolidation(boolean disableConsolidation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableConsolidation(Optional disableConsolidation); + + /** Clears the value of disableConsolidation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableConsolidation() { + return disableConsolidation(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for revisionLabels. + * + *

revisionLabels: Labels to apply to the memory revision. For example, you can use this to + * label a revision with its data source. + */ + @JsonProperty("revisionLabels") + public abstract Builder revisionLabels(Map revisionLabels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionLabels(Optional> revisionLabels); + + /** Clears the value of revisionLabels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionLabels() { + return revisionLabels(Optional.empty()); + } + + /** + * Setter for revisionExpireTime. + * + *

revisionExpireTime: Optional. Input only. Timestamp of when the revision is considered + * expired. If not set, the memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Builder revisionExpireTime(Instant revisionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionExpireTime(Optional revisionExpireTime); + + /** Clears the value of revisionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionExpireTime() { + return revisionExpireTime(Optional.empty()); + } + + /** + * Setter for revisionTtl. + * + *

revisionTtl: Optional. Input only. The TTL for the revision. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("revisionTtl") + public abstract Builder revisionTtl(Duration revisionTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionTtl(Optional revisionTtl); + + /** Clears the value of revisionTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionTtl() { + return revisionTtl(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: Optional. Input only. If true, no revisions will be created for + * this request. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Optional. User-provided metadata for the generated memories. This is not + * generated by Memory Bank. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for metadataMergeStrategy. + * + *

metadataMergeStrategy: Optional. The strategy to use when applying metadata to existing + * memories. + */ + @JsonProperty("metadataMergeStrategy") + public abstract Builder metadataMergeStrategy( + MemoryMetadataMergeStrategy metadataMergeStrategy); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadataMergeStrategy( + Optional metadataMergeStrategy); + + /** Clears the value of metadataMergeStrategy field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadataMergeStrategy() { + return metadataMergeStrategy(Optional.empty()); + } + + /** + * Setter for metadataMergeStrategy given a known enum. + * + *

metadataMergeStrategy: Optional. The strategy to use when applying metadata to existing + * memories. + */ + @CanIgnoreReturnValue + public Builder metadataMergeStrategy(MemoryMetadataMergeStrategy.Known knownType) { + return metadataMergeStrategy(new MemoryMetadataMergeStrategy(knownType)); + } + + /** + * Setter for metadataMergeStrategy given a string. + * + *

metadataMergeStrategy: Optional. The strategy to use when applying metadata to existing + * memories. + */ + @CanIgnoreReturnValue + public Builder metadataMergeStrategy(String metadataMergeStrategy) { + return metadataMergeStrategy(new MemoryMetadataMergeStrategy(metadataMergeStrategy)); + } + + public abstract GenerateAgentEngineMemoriesConfig build(); + } + + /** Deserializes a JSON string to a GenerateAgentEngineMemoriesConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateAgentEngineMemoriesConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GenerateAgentEngineMemoriesConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesRequestParameters.java new file mode 100644 index 0000000..21f325b --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesRequestParameters.java @@ -0,0 +1,257 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Parameters for generating agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GenerateAgentEngineMemoriesRequestParameters.Builder.class) +public abstract class GenerateAgentEngineMemoriesRequestParameters extends JsonSerializable { + /** Name of the agent engine to generate memories for. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The vertex session source of the memories that should be generated. */ + @JsonProperty("vertexSessionSource") + public abstract Optional vertexSessionSource(); + + /** The direct contents source of the memories that should be generated. */ + @JsonProperty("directContentsSource") + public abstract Optional directContentsSource(); + + /** The direct memories source of the memories that should be generated. */ + @JsonProperty("directMemoriesSource") + public abstract Optional directMemoriesSource(); + + /** + * The scope of the memories that should be generated. + * + *

Memories will be consolidated across memories with the same scope. Must be provided unless + * the scope is defined in the source content. If `scope` is provided, it will override the scope + * defined in the source content. Scope values cannot contain the wildcard character '*'. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GenerateAgentEngineMemoriesRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateAgentEngineMemoriesRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateAgentEngineMemoriesRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateAgentEngineMemoriesRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateAgentEngineMemoriesRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to generate memories for. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for vertexSessionSource. + * + *

vertexSessionSource: The vertex session source of the memories that should be generated. + */ + @JsonProperty("vertexSessionSource") + public abstract Builder vertexSessionSource( + GenerateMemoriesRequestVertexSessionSource vertexSessionSource); + + /** + * Setter for vertexSessionSource builder. + * + *

vertexSessionSource: The vertex session source of the memories that should be generated. + */ + @CanIgnoreReturnValue + public Builder vertexSessionSource( + GenerateMemoriesRequestVertexSessionSource.Builder vertexSessionSourceBuilder) { + return vertexSessionSource(vertexSessionSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder vertexSessionSource( + Optional vertexSessionSource); + + /** Clears the value of vertexSessionSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVertexSessionSource() { + return vertexSessionSource(Optional.empty()); + } + + /** + * Setter for directContentsSource. + * + *

directContentsSource: The direct contents source of the memories that should be generated. + */ + @JsonProperty("directContentsSource") + public abstract Builder directContentsSource( + GenerateMemoriesRequestDirectContentsSource directContentsSource); + + /** + * Setter for directContentsSource builder. + * + *

directContentsSource: The direct contents source of the memories that should be generated. + */ + @CanIgnoreReturnValue + public Builder directContentsSource( + GenerateMemoriesRequestDirectContentsSource.Builder directContentsSourceBuilder) { + return directContentsSource(directContentsSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder directContentsSource( + Optional directContentsSource); + + /** Clears the value of directContentsSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDirectContentsSource() { + return directContentsSource(Optional.empty()); + } + + /** + * Setter for directMemoriesSource. + * + *

directMemoriesSource: The direct memories source of the memories that should be generated. + */ + @JsonProperty("directMemoriesSource") + public abstract Builder directMemoriesSource( + GenerateMemoriesRequestDirectMemoriesSource directMemoriesSource); + + /** + * Setter for directMemoriesSource builder. + * + *

directMemoriesSource: The direct memories source of the memories that should be generated. + */ + @CanIgnoreReturnValue + public Builder directMemoriesSource( + GenerateMemoriesRequestDirectMemoriesSource.Builder directMemoriesSourceBuilder) { + return directMemoriesSource(directMemoriesSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder directMemoriesSource( + Optional directMemoriesSource); + + /** Clears the value of directMemoriesSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDirectMemoriesSource() { + return directMemoriesSource(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: The scope of the memories that should be generated. + * + *

Memories will be consolidated across memories with the same scope. Must be provided unless + * the scope is defined in the source content. If `scope` is provided, it will override the + * scope defined in the source content. Scope values cannot contain the wildcard character '*'. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GenerateAgentEngineMemoriesConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GenerateAgentEngineMemoriesConfig.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 GenerateAgentEngineMemoriesRequestParameters build(); + } + + /** Deserializes a JSON string to a GenerateAgentEngineMemoriesRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateAgentEngineMemoriesRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateAgentEngineMemoriesRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSource.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSource.java new file mode 100644 index 0000000..2063e04 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSource.java @@ -0,0 +1,114 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The direct contents source for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestDirectContentsSource.Builder.class) +public abstract class GenerateMemoriesRequestDirectContentsSource extends JsonSerializable { + /** Required. The source content (i.e. chat history) to generate memories from. */ + @JsonProperty("events") + public abstract Optional> events(); + + /** Instantiates a builder for GenerateMemoriesRequestDirectContentsSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestDirectContentsSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestDirectContentsSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesRequestDirectContentsSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestDirectContentsSource.Builder(); + } + + /** + * Setter for events. + * + *

events: Required. The source content (i.e. chat history) to generate memories from. + */ + @JsonProperty("events") + public abstract Builder events(List events); + + /** + * Setter for events. + * + *

events: Required. The source content (i.e. chat history) to generate memories from. + */ + @CanIgnoreReturnValue + public Builder events(GenerateMemoriesRequestDirectContentsSourceEvent... events) { + return events(Arrays.asList(events)); + } + + /** + * Setter for events builder. + * + *

events: Required. The source content (i.e. chat history) to generate memories from. + */ + @CanIgnoreReturnValue + public Builder events( + GenerateMemoriesRequestDirectContentsSourceEvent.Builder... eventsBuilders) { + return events( + Arrays.asList(eventsBuilders).stream() + .map(GenerateMemoriesRequestDirectContentsSourceEvent.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder events( + Optional> events); + + /** Clears the value of events field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvents() { + return events(Optional.empty()); + } + + public abstract GenerateMemoriesRequestDirectContentsSource build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesRequestDirectContentsSource object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestDirectContentsSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestDirectContentsSource.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSourceEvent.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSourceEvent.java new file mode 100644 index 0000000..d853943 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSourceEvent.java @@ -0,0 +1,86 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Optional; + +/** None */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestDirectContentsSourceEvent.Builder.class) +public abstract class GenerateMemoriesRequestDirectContentsSourceEvent extends JsonSerializable { + /** Required. A single piece of content from which to generate memories. */ + @JsonProperty("content") + public abstract Optional content(); + + /** Instantiates a builder for GenerateMemoriesRequestDirectContentsSourceEvent. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestDirectContentsSourceEvent.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestDirectContentsSourceEvent. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesRequestDirectContentsSourceEvent.builder()` + * for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestDirectContentsSourceEvent.Builder(); + } + + /** + * Setter for content. + * + *

content: Required. A single piece of content from which to generate memories. + */ + @JsonProperty("content") + public abstract Builder content(Content content); + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + public abstract GenerateMemoriesRequestDirectContentsSourceEvent build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesRequestDirectContentsSourceEvent object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestDirectContentsSourceEvent fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestDirectContentsSourceEvent.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSource.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSource.java new file mode 100644 index 0000000..357b34d --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSource.java @@ -0,0 +1,123 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The direct memories source for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestDirectMemoriesSource.Builder.class) +public abstract class GenerateMemoriesRequestDirectMemoriesSource extends JsonSerializable { + /** + * Required. The direct memories to upload to Memory Bank. At most 5 direct memories are allowed + * per request. + */ + @JsonProperty("directMemories") + public abstract Optional> + directMemories(); + + /** Instantiates a builder for GenerateMemoriesRequestDirectMemoriesSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestDirectMemoriesSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestDirectMemoriesSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesRequestDirectMemoriesSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestDirectMemoriesSource.Builder(); + } + + /** + * Setter for directMemories. + * + *

directMemories: Required. The direct memories to upload to Memory Bank. At most 5 direct + * memories are allowed per request. + */ + @JsonProperty("directMemories") + public abstract Builder directMemories( + List directMemories); + + /** + * Setter for directMemories. + * + *

directMemories: Required. The direct memories to upload to Memory Bank. At most 5 direct + * memories are allowed per request. + */ + @CanIgnoreReturnValue + public Builder directMemories( + GenerateMemoriesRequestDirectMemoriesSourceDirectMemory... directMemories) { + return directMemories(Arrays.asList(directMemories)); + } + + /** + * Setter for directMemories builder. + * + *

directMemories: Required. The direct memories to upload to Memory Bank. At most 5 direct + * memories are allowed per request. + */ + @CanIgnoreReturnValue + public Builder directMemories( + GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder... directMemoriesBuilders) { + return directMemories( + Arrays.asList(directMemoriesBuilders).stream() + .map(GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder directMemories( + Optional> directMemories); + + /** Clears the value of directMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDirectMemories() { + return directMemories(Optional.empty()); + } + + public abstract GenerateMemoriesRequestDirectMemoriesSource build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesRequestDirectMemoriesSource object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestDirectMemoriesSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestDirectMemoriesSource.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.java new file mode 100644 index 0000000..460ce3e --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.java @@ -0,0 +1,138 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A direct memory to upload to Memory Bank. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder.class) +public abstract class GenerateMemoriesRequestDirectMemoriesSourceDirectMemory + extends JsonSerializable { + /** Required. The fact to consolidate with existing memories. */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** Optional. The topics that the consolidated memories should be associated with. */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** Instantiates a builder for GenerateMemoriesRequestDirectMemoriesSourceDirectMemory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestDirectMemoriesSourceDirectMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder(); + } + + /** + * Setter for fact. + * + *

fact: Required. The fact to consolidate with existing memories. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The topics that the consolidated memories should be associated with. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The topics that the consolidated memories should be associated with. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The topics that the consolidated memories should be associated with. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + public abstract GenerateMemoriesRequestDirectMemoriesSourceDirectMemory build(); + } + + /** + * Deserializes a JSON string to a GenerateMemoriesRequestDirectMemoriesSourceDirectMemory object. + */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestDirectMemoriesSourceDirectMemory fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestVertexSessionSource.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestVertexSessionSource.java new file mode 100644 index 0000000..f9f9407 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestVertexSessionSource.java @@ -0,0 +1,139 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Optional; + +/** The vertex session source for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestVertexSessionSource.Builder.class) +public abstract class GenerateMemoriesRequestVertexSessionSource extends JsonSerializable { + /** Optional. End time (exclusive) of the time range. If not set, the end time is unbounded. */ + @JsonProperty("endTime") + public abstract Optional endTime(); + + /** + * Required. The resource name of the Session to generate memories for. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}` + */ + @JsonProperty("session") + public abstract Optional session(); + + /** + * Optional. Time range to define which session events should be used to generate memories. Start + * time (inclusive) of the time range. If not set, the start time is unbounded. + */ + @JsonProperty("startTime") + public abstract Optional startTime(); + + /** Instantiates a builder for GenerateMemoriesRequestVertexSessionSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestVertexSessionSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestVertexSessionSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesRequestVertexSessionSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestVertexSessionSource.Builder(); + } + + /** + * Setter for endTime. + * + *

endTime: Optional. End time (exclusive) of the time range. If not set, the end time is + * unbounded. + */ + @JsonProperty("endTime") + public abstract Builder endTime(Instant endTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder endTime(Optional endTime); + + /** Clears the value of endTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEndTime() { + return endTime(Optional.empty()); + } + + /** + * Setter for session. + * + *

session: Required. The resource name of the Session to generate memories for. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}` + */ + @JsonProperty("session") + public abstract Builder session(String session); + + @ExcludeFromGeneratedCoverageReport + abstract Builder session(Optional session); + + /** Clears the value of session field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSession() { + return session(Optional.empty()); + } + + /** + * Setter for startTime. + * + *

startTime: Optional. Time range to define which session events should be used to generate + * memories. Start time (inclusive) of the time range. If not set, the start time is unbounded. + */ + @JsonProperty("startTime") + public abstract Builder startTime(Instant startTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder startTime(Optional startTime); + + /** Clears the value of startTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStartTime() { + return startTime(Optional.empty()); + } + + public abstract GenerateMemoriesRequestVertexSessionSource build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesRequestVertexSessionSource object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestVertexSessionSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestVertexSessionSource.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponse.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponse.java new file mode 100644 index 0000000..64eb756 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponse.java @@ -0,0 +1,111 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The response for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesResponse.Builder.class) +public abstract class GenerateMemoriesResponse extends JsonSerializable { + /** The generated memories. */ + @JsonProperty("generatedMemories") + public abstract Optional> generatedMemories(); + + /** Instantiates a builder for GenerateMemoriesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GenerateMemoriesResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesResponse.Builder(); + } + + /** + * Setter for generatedMemories. + * + *

generatedMemories: The generated memories. + */ + @JsonProperty("generatedMemories") + public abstract Builder generatedMemories( + List generatedMemories); + + /** + * Setter for generatedMemories. + * + *

generatedMemories: The generated memories. + */ + @CanIgnoreReturnValue + public Builder generatedMemories(GenerateMemoriesResponseGeneratedMemory... generatedMemories) { + return generatedMemories(Arrays.asList(generatedMemories)); + } + + /** + * Setter for generatedMemories builder. + * + *

generatedMemories: The generated memories. + */ + @CanIgnoreReturnValue + public Builder generatedMemories( + GenerateMemoriesResponseGeneratedMemory.Builder... generatedMemoriesBuilders) { + return generatedMemories( + Arrays.asList(generatedMemoriesBuilders).stream() + .map(GenerateMemoriesResponseGeneratedMemory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder generatedMemories( + Optional> generatedMemories); + + /** Clears the value of generatedMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGeneratedMemories() { + return generatedMemories(Optional.empty()); + } + + public abstract GenerateMemoriesResponse build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GenerateMemoriesResponse.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemory.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemory.java new file mode 100644 index 0000000..4e9f5e1 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemory.java @@ -0,0 +1,167 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A memory that was generated. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesResponseGeneratedMemory.Builder.class) +public abstract class GenerateMemoriesResponseGeneratedMemory extends JsonSerializable { + /** The generated memory. */ + @JsonProperty("memory") + public abstract Optional memory(); + + /** The action to take. */ + @JsonProperty("action") + public abstract Optional action(); + + /** + * The previous revision of the Memory before the action was performed. This field is only set if + * the action is `UPDATED` or `DELETED`. You can use this to rollback the Memory to the previous + * revision, undoing the action. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{revision}` + */ + @JsonProperty("previousRevision") + public abstract Optional previousRevision(); + + /** Instantiates a builder for GenerateMemoriesResponseGeneratedMemory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesResponseGeneratedMemory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesResponseGeneratedMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesResponseGeneratedMemory.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesResponseGeneratedMemory.Builder(); + } + + /** + * Setter for memory. + * + *

memory: The generated memory. + */ + @JsonProperty("memory") + public abstract Builder memory(Memory memory); + + /** + * Setter for memory builder. + * + *

memory: The generated memory. + */ + @CanIgnoreReturnValue + public Builder memory(Memory.Builder memoryBuilder) { + return memory(memoryBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memory(Optional memory); + + /** Clears the value of memory field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemory() { + return memory(Optional.empty()); + } + + /** + * Setter for action. + * + *

action: The action to take. + */ + @JsonProperty("action") + public abstract Builder action(GenerateMemoriesResponseGeneratedMemoryAction action); + + @ExcludeFromGeneratedCoverageReport + abstract Builder action(Optional action); + + /** Clears the value of action field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAction() { + return action(Optional.empty()); + } + + /** + * Setter for action given a known enum. + * + *

action: The action to take. + */ + @CanIgnoreReturnValue + public Builder action(GenerateMemoriesResponseGeneratedMemoryAction.Known knownType) { + return action(new GenerateMemoriesResponseGeneratedMemoryAction(knownType)); + } + + /** + * Setter for action given a string. + * + *

action: The action to take. + */ + @CanIgnoreReturnValue + public Builder action(String action) { + return action(new GenerateMemoriesResponseGeneratedMemoryAction(action)); + } + + /** + * Setter for previousRevision. + * + *

previousRevision: The previous revision of the Memory before the action was performed. + * This field is only set if the action is `UPDATED` or `DELETED`. You can use this to rollback + * the Memory to the previous revision, undoing the action. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{revision}` + */ + @JsonProperty("previousRevision") + public abstract Builder previousRevision(String previousRevision); + + @ExcludeFromGeneratedCoverageReport + abstract Builder previousRevision(Optional previousRevision); + + /** Clears the value of previousRevision field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPreviousRevision() { + return previousRevision(Optional.empty()); + } + + public abstract GenerateMemoriesResponseGeneratedMemory build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesResponseGeneratedMemory object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesResponseGeneratedMemory fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesResponseGeneratedMemory.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemoryAction.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemoryAction.java new file mode 100644 index 0000000..0d611a3 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemoryAction.java @@ -0,0 +1,129 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The action to take. */ +public class GenerateMemoriesResponseGeneratedMemoryAction { + + /** Enum representing the known values for GenerateMemoriesResponseGeneratedMemoryAction. */ + public enum Known { + /** The action is unspecified. */ + ACTION_UNSPECIFIED, + + /** The memory was created. */ + CREATED, + + /** + * The memory was updated. The `fact` field may not be updated if the existing fact is still + * accurate. + */ + UPDATED, + + /** The memory was deleted. */ + DELETED, + + GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED + } + + private Known generateMemoriesResponseGeneratedMemoryActionEnum; + private final String value; + + @JsonCreator + public GenerateMemoriesResponseGeneratedMemoryAction(String value) { + this.value = value; + for (Known generateMemoriesResponseGeneratedMemoryActionEnum : Known.values()) { + if (Ascii.equalsIgnoreCase( + generateMemoriesResponseGeneratedMemoryActionEnum.toString(), value)) { + this.generateMemoriesResponseGeneratedMemoryActionEnum = + generateMemoriesResponseGeneratedMemoryActionEnum; + break; + } + } + if (this.generateMemoriesResponseGeneratedMemoryActionEnum == null) { + this.generateMemoriesResponseGeneratedMemoryActionEnum = + Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED; + } + } + + public GenerateMemoriesResponseGeneratedMemoryAction(Known knownValue) { + this.generateMemoriesResponseGeneratedMemoryActionEnum = 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 GenerateMemoriesResponseGeneratedMemoryAction)) { + return false; + } + + GenerateMemoriesResponseGeneratedMemoryAction other = + (GenerateMemoriesResponseGeneratedMemoryAction) o; + + if (this.generateMemoriesResponseGeneratedMemoryActionEnum + != Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED + && other.generateMemoriesResponseGeneratedMemoryActionEnum + != Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED) { + return this.generateMemoriesResponseGeneratedMemoryActionEnum + == other.generateMemoriesResponseGeneratedMemoryActionEnum; + } else if (this.generateMemoriesResponseGeneratedMemoryActionEnum + == Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED + && other.generateMemoriesResponseGeneratedMemoryActionEnum + == Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.generateMemoriesResponseGeneratedMemoryActionEnum + != Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED) { + return this.generateMemoriesResponseGeneratedMemoryActionEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.generateMemoriesResponseGeneratedMemoryActionEnum; + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineGenerateMemoriesOperationParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineGenerateMemoriesOperationParameters.java new file mode 100644 index 0000000..56d1798 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineGenerateMemoriesOperationParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an operation with generated memories as a response. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineGenerateMemoriesOperationParameters.Builder.class) +public abstract class GetAgentEngineGenerateMemoriesOperationParameters extends JsonSerializable { + /** The server-assigned name for the operation. */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Used to override the default configuration. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineGenerateMemoriesOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineGenerateMemoriesOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineGenerateMemoriesOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineGenerateMemoriesOperationParameters.builder()` + * for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineGenerateMemoriesOperationParameters.Builder(); + } + + /** + * Setter for operationName. + * + *

operationName: The server-assigned name for the operation. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: Used to override the default configuration. + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineOperationConfig config); + + /** + * Setter for config builder. + * + *

config: Used to override the default configuration. + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineOperationConfig.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 GetAgentEngineGenerateMemoriesOperationParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineGenerateMemoriesOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineGenerateMemoriesOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineGenerateMemoriesOperationParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryConfig.java new file mode 100644 index 0000000..2df0f81 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryConfig.java @@ -0,0 +1,82 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting an Agent Engine Memory. */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineMemoryConfig.Builder.class) +public abstract class GetAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetAgentEngineMemoryConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineMemoryConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryOperationParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryOperationParameters.java new file mode 100644 index 0000000..7c817c5 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryOperationParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an operation with a memory as a response. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineMemoryOperationParameters.Builder.class) +public abstract class GetAgentEngineMemoryOperationParameters extends JsonSerializable { + /** The server-assigned name for the operation. */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Used to override the default configuration. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineMemoryOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineMemoryOperationParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryOperationParameters.Builder(); + } + + /** + * Setter for operationName. + * + *

operationName: The server-assigned name for the operation. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: Used to override the default configuration. + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineOperationConfig config); + + /** + * Setter for config builder. + * + *

config: Used to override the default configuration. + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineOperationConfig.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 GetAgentEngineMemoryOperationParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineMemoryOperationParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRequestParameters.java new file mode 100644 index 0000000..322f579 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRequestParameters.java @@ -0,0 +1,118 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an agent engine. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineMemoryRequestParameters.Builder.class) +public abstract class GetAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineMemoryConfig.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 GetAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineMemoryRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionConfig.java new file mode 100644 index 0000000..bc29604 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionConfig.java @@ -0,0 +1,85 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting an Agent Engine Memory Revision. */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineMemoryRevisionConfig.Builder.class) +public abstract class GetAgentEngineMemoryRevisionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineMemoryRevisionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryRevisionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryRevisionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineMemoryRevisionConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryRevisionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineMemoryRevisionConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryRevisionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryRevisionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineMemoryRevisionConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionRequestParameters.java new file mode 100644 index 0000000..fe338dd --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an Agent Engine memory revision. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineMemoryRevisionRequestParameters.Builder.class) +public abstract class GetAgentEngineMemoryRevisionRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineMemoryRevisionRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryRevisionRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryRevisionRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineMemoryRevisionRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryRevisionRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineMemoryRevisionConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineMemoryRevisionConfig.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 GetAgentEngineMemoryRevisionRequestParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryRevisionRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryRevisionRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineMemoryRevisionRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxConfig.java new file mode 100644 index 0000000..4165bff --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxConfig.java @@ -0,0 +1,82 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting an Agent Engine Memory. */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineSandboxConfig.Builder.class) +public abstract class GetAgentEngineSandboxConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineSandboxConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSandboxConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSandboxConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetAgentEngineSandboxConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSandboxConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineSandboxConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSandboxConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSandboxConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineSandboxConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxOperationParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxOperationParameters.java new file mode 100644 index 0000000..dbde41b --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxOperationParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an operation with a sandbox as a response. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineSandboxOperationParameters.Builder.class) +public abstract class GetAgentEngineSandboxOperationParameters extends JsonSerializable { + /** The server-assigned name for the operation. */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Used to override the default configuration. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineSandboxOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSandboxOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSandboxOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineSandboxOperationParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSandboxOperationParameters.Builder(); + } + + /** + * Setter for operationName. + * + *

operationName: The server-assigned name for the operation. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: Used to override the default configuration. + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineOperationConfig config); + + /** + * Setter for config builder. + * + *

config: Used to override the default configuration. + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineOperationConfig.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 GetAgentEngineSandboxOperationParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSandboxOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSandboxOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineSandboxOperationParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxRequestParameters.java new file mode 100644 index 0000000..f96bf83 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an agent engine sandbox. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineSandboxRequestParameters.Builder.class) +public abstract class GetAgentEngineSandboxRequestParameters extends JsonSerializable { + /** Name of the agent engine sandbox. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineSandboxRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSandboxRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSandboxRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineSandboxRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSandboxRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine sandbox. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineSandboxConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineSandboxConfig.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 GetAgentEngineSandboxRequestParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSandboxRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSandboxRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineSandboxRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IntermediateExtractedMemory.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IntermediateExtractedMemory.java new file mode 100644 index 0000000..c413cde --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IntermediateExtractedMemory.java @@ -0,0 +1,81 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** An extracted memory that is the intermediate result before consolidation. */ +@AutoValue +@JsonDeserialize(builder = IntermediateExtractedMemory.Builder.class) +public abstract class IntermediateExtractedMemory extends JsonSerializable { + /** Output only. The fact of the extracted memory. */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** Instantiates a builder for IntermediateExtractedMemory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_IntermediateExtractedMemory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for IntermediateExtractedMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `IntermediateExtractedMemory.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_IntermediateExtractedMemory.Builder(); + } + + /** + * Setter for fact. + * + *

fact: Output only. The fact of the extracted memory. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + public abstract IntermediateExtractedMemory build(); + } + + /** Deserializes a JSON string to a IntermediateExtractedMemory object. */ + @ExcludeFromGeneratedCoverageReport + public static IntermediateExtractedMemory fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, IntermediateExtractedMemory.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Language.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Language.java new file mode 100644 index 0000000..a81c588 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Language.java @@ -0,0 +1,111 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The coding language supported in this environment. */ +public class Language { + + /** Enum representing the known values for Language. */ + public enum Known { + /** The default value. This value is unused. */ + LANGUAGE_UNSPECIFIED, + + /** The coding language is Python. */ + LANGUAGE_PYTHON, + + /** The coding language is JavaScript. */ + LANGUAGE_JAVASCRIPT + } + + private Known languageEnum; + private final String value; + + @JsonCreator + public Language(String value) { + this.value = value; + for (Known languageEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(languageEnum.toString(), value)) { + this.languageEnum = languageEnum; + break; + } + } + if (this.languageEnum == null) { + this.languageEnum = Known.LANGUAGE_UNSPECIFIED; + } + } + + public Language(Known knownValue) { + this.languageEnum = 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 Language)) { + return false; + } + + Language other = (Language) o; + + if (this.languageEnum != Known.LANGUAGE_UNSPECIFIED + && other.languageEnum != Known.LANGUAGE_UNSPECIFIED) { + return this.languageEnum == other.languageEnum; + } else if (this.languageEnum == Known.LANGUAGE_UNSPECIFIED + && other.languageEnum == Known.LANGUAGE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.languageEnum != Known.LANGUAGE_UNSPECIFIED) { + return this.languageEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.languageEnum; + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryConfig.java new file mode 100644 index 0000000..af124c0 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryConfig.java @@ -0,0 +1,184 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing agent engine memories. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineMemoryConfig.Builder.class) +public abstract class ListAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** + * The standard list order by string. If not specified, the default order is `create_time desc`. + * If specified, the default sorting order of provided fields is ascending. More detail in + * [AIP-132](https://google.aip.dev/132). + * + *

Supported fields: `create_time` `update_time` + */ + @JsonProperty("orderBy") + public abstract Optional orderBy(); + + /** Instantiates a builder for ListAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ListAgentEngineMemoryConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + /** + * Setter for orderBy. + * + *

orderBy: The standard list order by string. If not specified, the default order is + * `create_time desc`. If specified, the default sorting order of provided fields is ascending. + * More detail in [AIP-132](https://google.aip.dev/132). + * + *

Supported fields: `create_time` `update_time` + */ + @JsonProperty("orderBy") + public abstract Builder orderBy(String orderBy); + + @ExcludeFromGeneratedCoverageReport + abstract Builder orderBy(Optional orderBy); + + /** Clears the value of orderBy field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOrderBy() { + return orderBy(Optional.empty()); + } + + public abstract ListAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineMemoryConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRequestParameters.java new file mode 100644 index 0000000..aca27ac --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListAgentEngineMemoryRequestParameters.Builder.class) +public abstract class ListAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListAgentEngineMemoryConfig.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 ListAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineMemoryRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsConfig.java new file mode 100644 index 0000000..2323be0 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsConfig.java @@ -0,0 +1,155 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing Agent Engine memory revisions. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineMemoryRevisionsConfig.Builder.class) +public abstract class ListAgentEngineMemoryRevisionsConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for ListAgentEngineMemoryRevisionsConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryRevisionsConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryRevisionsConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineMemoryRevisionsConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryRevisionsConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract ListAgentEngineMemoryRevisionsConfig build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryRevisionsConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryRevisionsConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineMemoryRevisionsConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsRequestParameters.java new file mode 100644 index 0000000..19667b7 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing Agent Engine memory revisions. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListAgentEngineMemoryRevisionsRequestParameters.Builder.class) +public abstract class ListAgentEngineMemoryRevisionsRequestParameters extends JsonSerializable { + /** Name of the Agent Engine memory */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListAgentEngineMemoryRevisionsRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryRevisionsRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryRevisionsRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineMemoryRevisionsRequestParameters.builder()` + * for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryRevisionsRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the Agent Engine memory + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListAgentEngineMemoryRevisionsConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListAgentEngineMemoryRevisionsConfig.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 ListAgentEngineMemoryRevisionsRequestParameters build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryRevisionsRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryRevisionsRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineMemoryRevisionsRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsResponse.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsResponse.java new file mode 100644 index 0000000..0c5bc56 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsResponse.java @@ -0,0 +1,157 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing agent engine memory revisions. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineMemoryRevisionsResponse.Builder.class) +public abstract class ListAgentEngineMemoryRevisionsResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of memory revisions. */ + @JsonProperty("memoryRevisions") + public abstract Optional> memoryRevisions(); + + /** Instantiates a builder for ListAgentEngineMemoryRevisionsResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryRevisionsResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryRevisionsResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineMemoryRevisionsResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryRevisionsResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for memoryRevisions. + * + *

memoryRevisions: List of memory revisions. + */ + @JsonProperty("memoryRevisions") + public abstract Builder memoryRevisions(List memoryRevisions); + + /** + * Setter for memoryRevisions. + * + *

memoryRevisions: List of memory revisions. + */ + @CanIgnoreReturnValue + public Builder memoryRevisions(MemoryRevision... memoryRevisions) { + return memoryRevisions(Arrays.asList(memoryRevisions)); + } + + /** + * Setter for memoryRevisions builder. + * + *

memoryRevisions: List of memory revisions. + */ + @CanIgnoreReturnValue + public Builder memoryRevisions(MemoryRevision.Builder... memoryRevisionsBuilders) { + return memoryRevisions( + Arrays.asList(memoryRevisionsBuilders).stream() + .map(MemoryRevision.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memoryRevisions(Optional> memoryRevisions); + + /** Clears the value of memoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemoryRevisions() { + return memoryRevisions(Optional.empty()); + } + + public abstract ListAgentEngineMemoryRevisionsResponse build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryRevisionsResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryRevisionsResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineMemoryRevisionsResponse.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesConfig.java new file mode 100644 index 0000000..f3685ea --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesConfig.java @@ -0,0 +1,154 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing agent engine sandboxes. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineSandboxesConfig.Builder.class) +public abstract class ListAgentEngineSandboxesConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for ListAgentEngineSandboxesConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineSandboxesConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineSandboxesConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineSandboxesConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineSandboxesConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract ListAgentEngineSandboxesConfig build(); + } + + /** Deserializes a JSON string to a ListAgentEngineSandboxesConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineSandboxesConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineSandboxesConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesRequestParameters.java new file mode 100644 index 0000000..5359497 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing agent engine sandboxes. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListAgentEngineSandboxesRequestParameters.Builder.class) +public abstract class ListAgentEngineSandboxesRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListAgentEngineSandboxesRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineSandboxesRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineSandboxesRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineSandboxesRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineSandboxesRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListAgentEngineSandboxesConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListAgentEngineSandboxesConfig.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 ListAgentEngineSandboxesRequestParameters build(); + } + + /** Deserializes a JSON string to a ListAgentEngineSandboxesRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineSandboxesRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineSandboxesRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesResponse.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesResponse.java new file mode 100644 index 0000000..ec0a2d2 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesResponse.java @@ -0,0 +1,156 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing agent engine sandboxes. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineSandboxesResponse.Builder.class) +public abstract class ListAgentEngineSandboxesResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of agent engine sandboxes. */ + @JsonProperty("sandboxEnvironments") + public abstract Optional> sandboxEnvironments(); + + /** Instantiates a builder for ListAgentEngineSandboxesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineSandboxesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineSandboxesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineSandboxesResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineSandboxesResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for sandboxEnvironments. + * + *

sandboxEnvironments: List of agent engine sandboxes. + */ + @JsonProperty("sandboxEnvironments") + public abstract Builder sandboxEnvironments(List sandboxEnvironments); + + /** + * Setter for sandboxEnvironments. + * + *

sandboxEnvironments: List of agent engine sandboxes. + */ + @CanIgnoreReturnValue + public Builder sandboxEnvironments(SandboxEnvironment... sandboxEnvironments) { + return sandboxEnvironments(Arrays.asList(sandboxEnvironments)); + } + + /** + * Setter for sandboxEnvironments builder. + * + *

sandboxEnvironments: List of agent engine sandboxes. + */ + @CanIgnoreReturnValue + public Builder sandboxEnvironments(SandboxEnvironment.Builder... sandboxEnvironmentsBuilders) { + return sandboxEnvironments( + Arrays.asList(sandboxEnvironmentsBuilders).stream() + .map(SandboxEnvironment.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sandboxEnvironments(Optional> sandboxEnvironments); + + /** Clears the value of sandboxEnvironments field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSandboxEnvironments() { + return sandboxEnvironments(Optional.empty()); + } + + public abstract ListAgentEngineSandboxesResponse build(); + } + + /** Deserializes a JSON string to a ListAgentEngineSandboxesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineSandboxesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineSandboxesResponse.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesMemoriesResponse.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesMemoriesResponse.java new file mode 100644 index 0000000..07e1aeb --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesMemoriesResponse.java @@ -0,0 +1,156 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing agent engine memories. */ +@AutoValue +@JsonDeserialize(builder = ListReasoningEnginesMemoriesResponse.Builder.class) +public abstract class ListReasoningEnginesMemoriesResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of agent engine memories. */ + @JsonProperty("memories") + public abstract Optional> memories(); + + /** Instantiates a builder for ListReasoningEnginesMemoriesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListReasoningEnginesMemoriesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListReasoningEnginesMemoriesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListReasoningEnginesMemoriesResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListReasoningEnginesMemoriesResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for memories. + * + *

memories: List of agent engine memories. + */ + @JsonProperty("memories") + public abstract Builder memories(List memories); + + /** + * Setter for memories. + * + *

memories: List of agent engine memories. + */ + @CanIgnoreReturnValue + public Builder memories(Memory... memories) { + return memories(Arrays.asList(memories)); + } + + /** + * Setter for memories builder. + * + *

memories: List of agent engine memories. + */ + @CanIgnoreReturnValue + public Builder memories(Memory.Builder... memoriesBuilders) { + return memories( + Arrays.asList(memoriesBuilders).stream() + .map(Memory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memories(Optional> memories); + + /** Clears the value of memories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemories() { + return memories(Optional.empty()); + } + + public abstract ListReasoningEnginesMemoriesResponse build(); + } + + /** Deserializes a JSON string to a ListReasoningEnginesMemoriesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListReasoningEnginesMemoriesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListReasoningEnginesMemoriesResponse.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineConfig.java new file mode 100644 index 0000000..21593ea --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineConfig.java @@ -0,0 +1,108 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The machine config of the code execution environment. */ +public class MachineConfig { + + /** Enum representing the known values for MachineConfig. */ + public enum Known { + /** The default value: milligcu 2000, memory 1.5Gib */ + MACHINE_CONFIG_UNSPECIFIED, + + /** The default value: milligcu 4000, memory 4 Gib */ + MACHINE_CONFIG_VCPU4_RAM4GIB + } + + private Known machineConfigEnum; + private final String value; + + @JsonCreator + public MachineConfig(String value) { + this.value = value; + for (Known machineConfigEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(machineConfigEnum.toString(), value)) { + this.machineConfigEnum = machineConfigEnum; + break; + } + } + if (this.machineConfigEnum == null) { + this.machineConfigEnum = Known.MACHINE_CONFIG_UNSPECIFIED; + } + } + + public MachineConfig(Known knownValue) { + this.machineConfigEnum = 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 MachineConfig)) { + return false; + } + + MachineConfig other = (MachineConfig) o; + + if (this.machineConfigEnum != Known.MACHINE_CONFIG_UNSPECIFIED + && other.machineConfigEnum != Known.MACHINE_CONFIG_UNSPECIFIED) { + return this.machineConfigEnum == other.machineConfigEnum; + } else if (this.machineConfigEnum == Known.MACHINE_CONFIG_UNSPECIFIED + && other.machineConfigEnum == Known.MACHINE_CONFIG_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.machineConfigEnum != Known.MACHINE_CONFIG_UNSPECIFIED) { + return this.machineConfigEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.machineConfigEnum; + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Memory.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Memory.java new file mode 100644 index 0000000..2837073 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Memory.java @@ -0,0 +1,452 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** A memory. */ +@AutoValue +@JsonDeserialize(builder = Memory.Builder.class) +public abstract class Memory extends JsonSerializable { + /** Output only. Timestamp when this Memory was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Optional. Description of the Memory. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Optional. Input only. If true, no revision will be created for this request. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** Optional. Display name of the Memory. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** + * Optional. Timestamp of when this resource is considered expired. This is *always* provided on + * output when `expiration` is set on input, regardless of whether `expire_time` or `ttl` was + * provided. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** Required. Semantic knowledge extracted from the source content. */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * Optional. User-provided metadata for the Memory. This information was provided when creating, + * updating, or generating the Memory. It was not generated by Memory Bank. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * Identifier. The resource name of the Memory. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}` + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Optional. Input only. Timestamp of when the revision is considered expired. If not set, the + * memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Optional revisionExpireTime(); + + /** + * Optional. Input only. The labels to apply to the Memory Revision created as a result of this + * request. + */ + @JsonProperty("revisionLabels") + public abstract Optional> revisionLabels(); + + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + @JsonProperty("revisionTtl") + public abstract Optional revisionTtl(); + + /** + * Required. Immutable. The scope of the Memory. Memories are isolated within their scope. The + * scope is defined when creating or generating memories. Scope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** Optional. The Topics of the Memory. */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** + * Optional. Input only. The TTL for this resource. The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** Output only. Timestamp when this Memory was most recently updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Instantiates a builder for Memory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Memory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Memory. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Memory.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Memory.Builder(); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when this Memory was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: Optional. Description of the Memory. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: Optional. Input only. If true, no revision will be created for + * this request. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Optional. Display name of the Memory. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this resource is considered expired. This is + * *always* provided on output when `expiration` is set on input, regardless of whether + * `expire_time` or `ttl` was provided. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for fact. + * + *

fact: Required. Semantic knowledge extracted from the source content. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Optional. User-provided metadata for the Memory. This information was provided + * when creating, updating, or generating the Memory. It was not generated by Memory Bank. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Identifier. The resource name of the Memory. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}` + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for revisionExpireTime. + * + *

revisionExpireTime: Optional. Input only. Timestamp of when the revision is considered + * expired. If not set, the memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Builder revisionExpireTime(Instant revisionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionExpireTime(Optional revisionExpireTime); + + /** Clears the value of revisionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionExpireTime() { + return revisionExpireTime(Optional.empty()); + } + + /** + * Setter for revisionLabels. + * + *

revisionLabels: Optional. Input only. The labels to apply to the Memory Revision created + * as a result of this request. + */ + @JsonProperty("revisionLabels") + public abstract Builder revisionLabels(Map revisionLabels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionLabels(Optional> revisionLabels); + + /** Clears the value of revisionLabels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionLabels() { + return revisionLabels(Optional.empty()); + } + + /** + * Setter for revisionTtl. + * + *

revisionTtl: Optional. Input only. The TTL for the revision. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("revisionTtl") + public abstract Builder revisionTtl(Duration revisionTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionTtl(Optional revisionTtl); + + /** Clears the value of revisionTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionTtl() { + return revisionTtl(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: Required. Immutable. The scope of the Memory. Memories are isolated within their + * scope. The scope is defined when creating or generating memories. Scope values cannot contain + * the wildcard character '*'. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The Topics of the Memory. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The Topics of the Memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The Topics of the Memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this resource. The expiration time is computed: now + * + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. Timestamp when this Memory was most recently updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + public abstract Memory build(); + } + + /** Deserializes a JSON string to a Memory object. */ + @ExcludeFromGeneratedCoverageReport + public static Memory fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Memory.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryConjunctionFilter.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryConjunctionFilter.java new file mode 100644 index 0000000..f243ce8 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryConjunctionFilter.java @@ -0,0 +1,108 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The conjunction filter for memories. */ +@AutoValue +@JsonDeserialize(builder = MemoryConjunctionFilter.Builder.class) +public abstract class MemoryConjunctionFilter extends JsonSerializable { + /** Filters that will combined using AND logic. */ + @JsonProperty("filters") + public abstract Optional> filters(); + + /** Instantiates a builder for MemoryConjunctionFilter. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryConjunctionFilter.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryConjunctionFilter. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MemoryConjunctionFilter.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryConjunctionFilter.Builder(); + } + + /** + * Setter for filters. + * + *

filters: Filters that will combined using AND logic. + */ + @JsonProperty("filters") + public abstract Builder filters(List filters); + + /** + * Setter for filters. + * + *

filters: Filters that will combined using AND logic. + */ + @CanIgnoreReturnValue + public Builder filters(MemoryFilter... filters) { + return filters(Arrays.asList(filters)); + } + + /** + * Setter for filters builder. + * + *

filters: Filters that will combined using AND logic. + */ + @CanIgnoreReturnValue + public Builder filters(MemoryFilter.Builder... filtersBuilders) { + return filters( + Arrays.asList(filtersBuilders).stream() + .map(MemoryFilter.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder filters(Optional> filters); + + /** Clears the value of filters field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilters() { + return filters(Optional.empty()); + } + + public abstract MemoryConjunctionFilter build(); + } + + /** Deserializes a JSON string to a MemoryConjunctionFilter object. */ + @ExcludeFromGeneratedCoverageReport + public static MemoryConjunctionFilter fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MemoryConjunctionFilter.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryFilter.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryFilter.java new file mode 100644 index 0000000..13caee5 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryFilter.java @@ -0,0 +1,181 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Filter to apply when retrieving memories. */ +@AutoValue +@JsonDeserialize(builder = MemoryFilter.Builder.class) +public abstract class MemoryFilter extends JsonSerializable { + /** + * Key of the filter. For example, "author" would apply to `metadata` entries with the key + * "author". + */ + @JsonProperty("key") + public abstract Optional key(); + + /** If true, the filter will be negated. */ + @JsonProperty("negate") + public abstract Optional negate(); + + /** Operator to apply to the filter. If not set, then EQUAL will be used. */ + @JsonProperty("op") + public abstract Optional op(); + + /** Value to compare to. */ + @JsonProperty("value") + public abstract Optional value(); + + /** Instantiates a builder for MemoryFilter. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryFilter.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryFilter. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MemoryFilter.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryFilter.Builder(); + } + + /** + * Setter for key. + * + *

key: Key of the filter. For example, "author" would apply to `metadata` entries with the + * key "author". + */ + @JsonProperty("key") + public abstract Builder key(String key); + + @ExcludeFromGeneratedCoverageReport + abstract Builder key(Optional key); + + /** Clears the value of key field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearKey() { + return key(Optional.empty()); + } + + /** + * Setter for negate. + * + *

negate: If true, the filter will be negated. + */ + @JsonProperty("negate") + public abstract Builder negate(boolean negate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder negate(Optional negate); + + /** Clears the value of negate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNegate() { + return negate(Optional.empty()); + } + + /** + * Setter for op. + * + *

op: Operator to apply to the filter. If not set, then EQUAL will be used. + */ + @JsonProperty("op") + public abstract Builder op(Operator op); + + @ExcludeFromGeneratedCoverageReport + abstract Builder op(Optional op); + + /** Clears the value of op field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOp() { + return op(Optional.empty()); + } + + /** + * Setter for op given a known enum. + * + *

op: Operator to apply to the filter. If not set, then EQUAL will be used. + */ + @CanIgnoreReturnValue + public Builder op(Operator.Known knownType) { + return op(new Operator(knownType)); + } + + /** + * Setter for op given a string. + * + *

op: Operator to apply to the filter. If not set, then EQUAL will be used. + */ + @CanIgnoreReturnValue + public Builder op(String op) { + return op(new Operator(op)); + } + + /** + * Setter for value. + * + *

value: Value to compare to. + */ + @JsonProperty("value") + public abstract Builder value(MemoryMetadataValue value); + + /** + * Setter for value builder. + * + *

value: Value to compare to. + */ + @CanIgnoreReturnValue + public Builder value(MemoryMetadataValue.Builder valueBuilder) { + return value(valueBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder value(Optional value); + + /** Clears the value of value field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearValue() { + return value(Optional.empty()); + } + + public abstract MemoryFilter build(); + } + + /** Deserializes a JSON string to a MemoryFilter object. */ + @ExcludeFromGeneratedCoverageReport + public static MemoryFilter fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MemoryFilter.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryMetadataMergeStrategy.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryMetadataMergeStrategy.java new file mode 100644 index 0000000..edcafff --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryMetadataMergeStrategy.java @@ -0,0 +1,125 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The strategy to use when applying metadata to existing memories during consolidation. */ +public class MemoryMetadataMergeStrategy { + + /** Enum representing the known values for MemoryMetadataMergeStrategy. */ + public enum Known { + /** The metadata merge strategy is unspecified. */ + METADATA_MERGE_STRATEGY_UNSPECIFIED, + + /** Replace the metadata of the updated memories with the new metadata. */ + OVERWRITE, + + /** + * Append new metadata to the existing metadata. If there are duplicate keys, the existing + * values will be overwritten. + */ + MERGE, + + /** + * Restrict consolidation to memories that have exactly the same metadata as the request. If a + * memory doesn't have the same metadata, it is not eligible for consolidation. + */ + REQUIRE_EXACT_MATCH, + + MEMORY_METADATA_MERGE_STRATEGY_UNSPECIFIED + } + + private Known memoryMetadataMergeStrategyEnum; + private final String value; + + @JsonCreator + public MemoryMetadataMergeStrategy(String value) { + this.value = value; + for (Known memoryMetadataMergeStrategyEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(memoryMetadataMergeStrategyEnum.toString(), value)) { + this.memoryMetadataMergeStrategyEnum = memoryMetadataMergeStrategyEnum; + break; + } + } + if (this.memoryMetadataMergeStrategyEnum == null) { + this.memoryMetadataMergeStrategyEnum = Known.MEMORY_METADATA_MERGE_STRATEGY_UNSPECIFIED; + } + } + + public MemoryMetadataMergeStrategy(Known knownValue) { + this.memoryMetadataMergeStrategyEnum = 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 MemoryMetadataMergeStrategy)) { + return false; + } + + MemoryMetadataMergeStrategy other = (MemoryMetadataMergeStrategy) o; + + if (this.memoryMetadataMergeStrategyEnum != Known.MEMORY_METADATA_MERGE_STRATEGY_UNSPECIFIED + && other.memoryMetadataMergeStrategyEnum + != Known.MEMORY_METADATA_MERGE_STRATEGY_UNSPECIFIED) { + return this.memoryMetadataMergeStrategyEnum == other.memoryMetadataMergeStrategyEnum; + } else if (this.memoryMetadataMergeStrategyEnum + == Known.MEMORY_METADATA_MERGE_STRATEGY_UNSPECIFIED + && other.memoryMetadataMergeStrategyEnum + == Known.MEMORY_METADATA_MERGE_STRATEGY_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.memoryMetadataMergeStrategyEnum != Known.MEMORY_METADATA_MERGE_STRATEGY_UNSPECIFIED) { + return this.memoryMetadataMergeStrategyEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.memoryMetadataMergeStrategyEnum; + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryMetadataValue.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryMetadataValue.java new file mode 100644 index 0000000..e6c50a9 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryMetadataValue.java @@ -0,0 +1,151 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Optional; + +/** The metadata values for memories. */ +@AutoValue +@JsonDeserialize(builder = MemoryMetadataValue.Builder.class) +public abstract class MemoryMetadataValue extends JsonSerializable { + /** Boolean value. */ + @JsonProperty("boolValue") + public abstract Optional boolValue(); + + /** Double value. */ + @JsonProperty("doubleValue") + public abstract Optional doubleValue(); + + /** String value. */ + @JsonProperty("stringValue") + public abstract Optional stringValue(); + + /** + * Timestamp value. When filtering on timestamp values, only the seconds field will be compared. + */ + @JsonProperty("timestampValue") + public abstract Optional timestampValue(); + + /** Instantiates a builder for MemoryMetadataValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryMetadataValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryMetadataValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MemoryMetadataValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryMetadataValue.Builder(); + } + + /** + * Setter for boolValue. + * + *

boolValue: Boolean value. + */ + @JsonProperty("boolValue") + public abstract Builder boolValue(boolean boolValue); + + @ExcludeFromGeneratedCoverageReport + abstract Builder boolValue(Optional boolValue); + + /** Clears the value of boolValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBoolValue() { + return boolValue(Optional.empty()); + } + + /** + * Setter for doubleValue. + * + *

doubleValue: Double value. + */ + @JsonProperty("doubleValue") + public abstract Builder doubleValue(Double doubleValue); + + @ExcludeFromGeneratedCoverageReport + abstract Builder doubleValue(Optional doubleValue); + + /** Clears the value of doubleValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDoubleValue() { + return doubleValue(Optional.empty()); + } + + /** + * Setter for stringValue. + * + *

stringValue: String value. + */ + @JsonProperty("stringValue") + public abstract Builder stringValue(String stringValue); + + @ExcludeFromGeneratedCoverageReport + abstract Builder stringValue(Optional stringValue); + + /** Clears the value of stringValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStringValue() { + return stringValue(Optional.empty()); + } + + /** + * Setter for timestampValue. + * + *

timestampValue: Timestamp value. When filtering on timestamp values, only the seconds + * field will be compared. + */ + @JsonProperty("timestampValue") + public abstract Builder timestampValue(Instant timestampValue); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timestampValue(Optional timestampValue); + + /** Clears the value of timestampValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimestampValue() { + return timestampValue(Optional.empty()); + } + + public abstract MemoryMetadataValue build(); + } + + /** Deserializes a JSON string to a MemoryMetadataValue object. */ + @ExcludeFromGeneratedCoverageReport + public static MemoryMetadataValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MemoryMetadataValue.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryRevision.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryRevision.java new file mode 100644 index 0000000..7415660 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryRevision.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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** A memory revision. */ +@AutoValue +@JsonDeserialize(builder = MemoryRevision.Builder.class) +public abstract class MemoryRevision extends JsonSerializable { + /** Output only. Timestamp when this Memory Revision was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Output only. Timestamp of when this resource is considered expired. */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Output only. The extracted memories from the source content before consolidation when the + * memory was updated via GenerateMemories. This information was used to modify an existing Memory + * via Consolidation. + */ + @JsonProperty("extractedMemories") + public abstract Optional> extractedMemories(); + + /** + * Output only. The fact of the Memory Revision. This corresponds to the `fact` field of the + * parent Memory at the time of revision creation. + */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * Output only. The labels of the Memory Revision. These labels are applied to the MemoryRevision + * when it is created based on `GenerateMemoriesRequest.revision_labels`. + */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** + * Identifier. The resource name of the Memory Revision. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{memory_revision}` + */ + @JsonProperty("name") + public abstract Optional name(); + + /** Instantiates a builder for MemoryRevision. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryRevision.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryRevision. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MemoryRevision.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryRevision.Builder(); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when this Memory Revision was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Output only. Timestamp of when this resource is considered expired. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for extractedMemories. + * + *

extractedMemories: Output only. The extracted memories from the source content before + * consolidation when the memory was updated via GenerateMemories. This information was used to + * modify an existing Memory via Consolidation. + */ + @JsonProperty("extractedMemories") + public abstract Builder extractedMemories(List extractedMemories); + + /** + * Setter for extractedMemories. + * + *

extractedMemories: Output only. The extracted memories from the source content before + * consolidation when the memory was updated via GenerateMemories. This information was used to + * modify an existing Memory via Consolidation. + */ + @CanIgnoreReturnValue + public Builder extractedMemories(IntermediateExtractedMemory... extractedMemories) { + return extractedMemories(Arrays.asList(extractedMemories)); + } + + /** + * Setter for extractedMemories builder. + * + *

extractedMemories: Output only. The extracted memories from the source content before + * consolidation when the memory was updated via GenerateMemories. This information was used to + * modify an existing Memory via Consolidation. + */ + @CanIgnoreReturnValue + public Builder extractedMemories( + IntermediateExtractedMemory.Builder... extractedMemoriesBuilders) { + return extractedMemories( + Arrays.asList(extractedMemoriesBuilders).stream() + .map(IntermediateExtractedMemory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder extractedMemories( + Optional> extractedMemories); + + /** Clears the value of extractedMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExtractedMemories() { + return extractedMemories(Optional.empty()); + } + + /** + * Setter for fact. + * + *

fact: Output only. The fact of the Memory Revision. This corresponds to the `fact` field + * of the parent Memory at the time of revision creation. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: Output only. The labels of the Memory Revision. These labels are applied to the + * MemoryRevision when it is created based on `GenerateMemoriesRequest.revision_labels`. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Identifier. The resource name of the Memory Revision. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{memory_revision}` + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + public abstract MemoryRevision build(); + } + + /** Deserializes a JSON string to a MemoryRevision object. */ + @ExcludeFromGeneratedCoverageReport + public static MemoryRevision fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MemoryRevision.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryTopicId.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryTopicId.java index 5191395..5f732ba 100644 --- a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryTopicId.java +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryTopicId.java @@ -26,10 +26,7 @@ import com.google.genai.JsonSerializable; import java.util.Optional; -/** - * A memory topic identifier. This will be used to label a Memory and to restrict which topics are - * eligible for generation or retrieval. - */ +/** The topic ID for a memory. */ @AutoValue @JsonDeserialize(builder = MemoryTopicId.Builder.class) public abstract class MemoryTopicId extends JsonSerializable { diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metadata.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metadata.java new file mode 100644 index 0000000..193bb8f --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metadata.java @@ -0,0 +1,87 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Metadata for a chunk. */ +@AutoValue +@JsonDeserialize(builder = Metadata.Builder.class) +public abstract class Metadata extends JsonSerializable { + /** + * Optional. Attributes attached to the data. The keys have semantic conventions and the consumers + * of the attributes should know how to deserialize the value bytes based on the keys. + */ + @JsonProperty("attributes") + public abstract Optional> attributes(); + + /** Instantiates a builder for Metadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Metadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Metadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Metadata.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Metadata.Builder(); + } + + /** + * Setter for attributes. + * + *

attributes: Optional. Attributes attached to the data. The keys have semantic conventions + * and the consumers of the attributes should know how to deserialize the value bytes based on + * the keys. + */ + @JsonProperty("attributes") + public abstract Builder attributes(Map attributes); + + @ExcludeFromGeneratedCoverageReport + abstract Builder attributes(Optional> attributes); + + /** Clears the value of attributes field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAttributes() { + return attributes(Optional.empty()); + } + + public abstract Metadata build(); + } + + /** Deserializes a JSON string to a Metadata object. */ + @ExcludeFromGeneratedCoverageReport + public static Metadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Metadata.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Operator.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Operator.java new file mode 100644 index 0000000..796228f --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Operator.java @@ -0,0 +1,114 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Operator to apply to the filter. If not set, then EQUAL will be used. */ +public class Operator { + + /** Enum representing the known values for Operator. */ + public enum Known { + /** Unspecified operator. Defaults to EQUAL. */ + OPERATOR_UNSPECIFIED, + + /** Equal to. */ + EQUAL, + + /** Greater than. */ + GREATER_THAN, + + /** Less than. */ + LESS_THAN + } + + private Known operatorEnum; + private final String value; + + @JsonCreator + public Operator(String value) { + this.value = value; + for (Known operatorEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(operatorEnum.toString(), value)) { + this.operatorEnum = operatorEnum; + break; + } + } + if (this.operatorEnum == null) { + this.operatorEnum = Known.OPERATOR_UNSPECIFIED; + } + } + + public Operator(Known knownValue) { + this.operatorEnum = 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 Operator)) { + return false; + } + + Operator other = (Operator) o; + + if (this.operatorEnum != Known.OPERATOR_UNSPECIFIED + && other.operatorEnum != Known.OPERATOR_UNSPECIFIED) { + return this.operatorEnum == other.operatorEnum; + } else if (this.operatorEnum == Known.OPERATOR_UNSPECIFIED + && other.operatorEnum == Known.OPERATOR_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.operatorEnum != Known.OPERATOR_UNSPECIFIED) { + return this.operatorEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.operatorEnum; + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeAgentEngineMemoriesConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeAgentEngineMemoriesConfig.java new file mode 100644 index 0000000..aaa5e48 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeAgentEngineMemoriesConfig.java @@ -0,0 +1,106 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for purging memories. */ +@AutoValue +@JsonDeserialize(builder = PurgeAgentEngineMemoriesConfig.Builder.class) +public abstract class PurgeAgentEngineMemoriesConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** Instantiates a builder for PurgeAgentEngineMemoriesConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PurgeAgentEngineMemoriesConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PurgeAgentEngineMemoriesConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `PurgeAgentEngineMemoriesConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_PurgeAgentEngineMemoriesConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + public abstract PurgeAgentEngineMemoriesConfig build(); + } + + /** Deserializes a JSON string to a PurgeAgentEngineMemoriesConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static PurgeAgentEngineMemoriesConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PurgeAgentEngineMemoriesConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeAgentEngineMemoriesRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeAgentEngineMemoriesRequestParameters.java new file mode 100644 index 0000000..a410299 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeAgentEngineMemoriesRequestParameters.java @@ -0,0 +1,254 @@ +/* + * 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.cloud.vertexai.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 purging agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = PurgeAgentEngineMemoriesRequestParameters.Builder.class) +public abstract class PurgeAgentEngineMemoriesRequestParameters extends JsonSerializable { + /** Name of the Agent Engine to purge memories from. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * The standard list filter to determine which memories to purge. More detail in + * [AIP-160](https://google.aip.dev/160). + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** + * Metadata filters that will be applied to the memories' `metadata` using OR logic. Filters are + * defined using disjunctive normal form (OR of ANDs). + * + *

For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent + * `123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, + * {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` + * + *

would be equivalent to the logical expression: `(metadata.author = "agent 123" OR + * (metadata.label = "travel" AND metadata.author = "agent 321"))`. + */ + @JsonProperty("filterGroups") + public abstract Optional> filterGroups(); + + /** + * If true, the memories will actually be purged. If false, the purge request will be validated + * but not executed. + */ + @JsonProperty("force") + public abstract Optional force(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for PurgeAgentEngineMemoriesRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PurgeAgentEngineMemoriesRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PurgeAgentEngineMemoriesRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `PurgeAgentEngineMemoriesRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_PurgeAgentEngineMemoriesRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the Agent Engine to purge memories from. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: The standard list filter to determine which memories to purge. More detail in + * [AIP-160](https://google.aip.dev/160). + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + /** + * Setter for filterGroups. + * + *

filterGroups: Metadata filters that will be applied to the memories' `metadata` using OR + * logic. Filters are defined using disjunctive normal form (OR of ANDs). + * + *

For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent + * `123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, + * {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` + * + *

would be equivalent to the logical expression: `(metadata.author = "agent 123" OR + * (metadata.label = "travel" AND metadata.author = "agent 321"))`. + */ + @JsonProperty("filterGroups") + public abstract Builder filterGroups(List filterGroups); + + /** + * Setter for filterGroups. + * + *

filterGroups: Metadata filters that will be applied to the memories' `metadata` using OR + * logic. Filters are defined using disjunctive normal form (OR of ANDs). + * + *

For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent + * `123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, + * {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` + * + *

would be equivalent to the logical expression: `(metadata.author = "agent 123" OR + * (metadata.label = "travel" AND metadata.author = "agent 321"))`. + */ + @CanIgnoreReturnValue + public Builder filterGroups(MemoryConjunctionFilter... filterGroups) { + return filterGroups(Arrays.asList(filterGroups)); + } + + /** + * Setter for filterGroups builder. + * + *

filterGroups: Metadata filters that will be applied to the memories' `metadata` using OR + * logic. Filters are defined using disjunctive normal form (OR of ANDs). + * + *

For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent + * `123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, + * {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` + * + *

would be equivalent to the logical expression: `(metadata.author = "agent 123" OR + * (metadata.label = "travel" AND metadata.author = "agent 321"))`. + */ + @CanIgnoreReturnValue + public Builder filterGroups(MemoryConjunctionFilter.Builder... filterGroupsBuilders) { + return filterGroups( + Arrays.asList(filterGroupsBuilders).stream() + .map(MemoryConjunctionFilter.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder filterGroups(Optional> filterGroups); + + /** Clears the value of filterGroups field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilterGroups() { + return filterGroups(Optional.empty()); + } + + /** + * Setter for force. + * + *

force: If true, the memories will actually be purged. If false, the purge request will be + * validated but not executed. + */ + @JsonProperty("force") + public abstract Builder force(boolean force); + + @ExcludeFromGeneratedCoverageReport + abstract Builder force(Optional force); + + /** Clears the value of force field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearForce() { + return force(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(PurgeAgentEngineMemoriesConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(PurgeAgentEngineMemoriesConfig.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 PurgeAgentEngineMemoriesRequestParameters build(); + } + + /** Deserializes a JSON string to a PurgeAgentEngineMemoriesRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static PurgeAgentEngineMemoriesRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, PurgeAgentEngineMemoriesRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeMemoriesResponse.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeMemoriesResponse.java new file mode 100644 index 0000000..5b841af --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PurgeMemoriesResponse.java @@ -0,0 +1,81 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The response for purging memories. */ +@AutoValue +@JsonDeserialize(builder = PurgeMemoriesResponse.Builder.class) +public abstract class PurgeMemoriesResponse extends JsonSerializable { + /** The number of memories that were purged. */ + @JsonProperty("purgeCount") + public abstract Optional purgeCount(); + + /** Instantiates a builder for PurgeMemoriesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PurgeMemoriesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PurgeMemoriesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PurgeMemoriesResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PurgeMemoriesResponse.Builder(); + } + + /** + * Setter for purgeCount. + * + *

purgeCount: The number of memories that were purged. + */ + @JsonProperty("purgeCount") + public abstract Builder purgeCount(Integer purgeCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder purgeCount(Optional purgeCount); + + /** Clears the value of purgeCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPurgeCount() { + return purgeCount(Optional.empty()); + } + + public abstract PurgeMemoriesResponse build(); + } + + /** Deserializes a JSON string to a PurgeMemoriesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static PurgeMemoriesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PurgeMemoriesResponse.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesConfig.java new file mode 100644 index 0000000..3c6ee37 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesConfig.java @@ -0,0 +1,198 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Config for retrieving memories. */ +@AutoValue +@JsonDeserialize(builder = RetrieveAgentEngineMemoriesConfig.Builder.class) +public abstract class RetrieveAgentEngineMemoriesConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The standard list filter that will be applied to the retrieved memories. More detail in + * [AIP-160](https://google.aip.dev/160). + * + *

Supported fields: `fact` `create_time` `update_time` + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** + * Metadata filters that will be applied to the retrieved memories' `metadata` using OR logic. + * Filters are defined using disjunctive normal form (OR of ANDs). + * + *

For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent + * `123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, + * {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` + * + *

would be equivalent to the logical expression: `(metadata.author = "agent 123" OR + * (metadata.label = "travel" AND metadata.author = "agent 321"))`. + */ + @JsonProperty("filterGroups") + public abstract Optional> filterGroups(); + + /** Instantiates a builder for RetrieveAgentEngineMemoriesConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveAgentEngineMemoriesConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveAgentEngineMemoriesConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveAgentEngineMemoriesConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveAgentEngineMemoriesConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: The standard list filter that will be applied to the retrieved memories. More + * detail in [AIP-160](https://google.aip.dev/160). + * + *

Supported fields: `fact` `create_time` `update_time` + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + /** + * Setter for filterGroups. + * + *

filterGroups: Metadata filters that will be applied to the retrieved memories' `metadata` + * using OR logic. Filters are defined using disjunctive normal form (OR of ANDs). + * + *

For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent + * `123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, + * {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` + * + *

would be equivalent to the logical expression: `(metadata.author = "agent 123" OR + * (metadata.label = "travel" AND metadata.author = "agent 321"))`. + */ + @JsonProperty("filterGroups") + public abstract Builder filterGroups(List filterGroups); + + /** + * Setter for filterGroups. + * + *

filterGroups: Metadata filters that will be applied to the retrieved memories' `metadata` + * using OR logic. Filters are defined using disjunctive normal form (OR of ANDs). + * + *

For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent + * `123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, + * {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` + * + *

would be equivalent to the logical expression: `(metadata.author = "agent 123" OR + * (metadata.label = "travel" AND metadata.author = "agent 321"))`. + */ + @CanIgnoreReturnValue + public Builder filterGroups(MemoryConjunctionFilter... filterGroups) { + return filterGroups(Arrays.asList(filterGroups)); + } + + /** + * Setter for filterGroups builder. + * + *

filterGroups: Metadata filters that will be applied to the retrieved memories' `metadata` + * using OR logic. Filters are defined using disjunctive normal form (OR of ANDs). + * + *

For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent + * `123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, + * {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` + * + *

would be equivalent to the logical expression: `(metadata.author = "agent 123" OR + * (metadata.label = "travel" AND metadata.author = "agent 321"))`. + */ + @CanIgnoreReturnValue + public Builder filterGroups(MemoryConjunctionFilter.Builder... filterGroupsBuilders) { + return filterGroups( + Arrays.asList(filterGroupsBuilders).stream() + .map(MemoryConjunctionFilter.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder filterGroups(Optional> filterGroups); + + /** Clears the value of filterGroups field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilterGroups() { + return filterGroups(Optional.empty()); + } + + public abstract RetrieveAgentEngineMemoriesConfig build(); + } + + /** Deserializes a JSON string to a RetrieveAgentEngineMemoriesConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveAgentEngineMemoriesConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RetrieveAgentEngineMemoriesConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesRequestParameters.java new file mode 100644 index 0000000..d6626d0 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesRequestParameters.java @@ -0,0 +1,220 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Parameters for retrieving agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = RetrieveAgentEngineMemoriesRequestParameters.Builder.class) +public abstract class RetrieveAgentEngineMemoriesRequestParameters extends JsonSerializable { + /** Name of the agent engine to retrieve memories from. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * The scope of the memories to retrieve. + * + *

A memory must have exactly the same scope as the scope provided here to be retrieved (i.e. + * same keys and values). Order does not matter, but it is case-sensitive. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** Parameters for semantic similarity search based retrieval. */ + @JsonProperty("similaritySearchParams") + public abstract Optional similaritySearchParams(); + + /** Parameters for simple (non-similarity search) retrieval. */ + @JsonProperty("simpleRetrievalParams") + public abstract Optional simpleRetrievalParams(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for RetrieveAgentEngineMemoriesRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveAgentEngineMemoriesRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveAgentEngineMemoriesRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveAgentEngineMemoriesRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveAgentEngineMemoriesRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to retrieve memories from. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: The scope of the memories to retrieve. + * + *

A memory must have exactly the same scope as the scope provided here to be retrieved (i.e. + * same keys and values). Order does not matter, but it is case-sensitive. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for similaritySearchParams. + * + *

similaritySearchParams: Parameters for semantic similarity search based retrieval. + */ + @JsonProperty("similaritySearchParams") + public abstract Builder similaritySearchParams( + RetrieveMemoriesRequestSimilaritySearchParams similaritySearchParams); + + /** + * Setter for similaritySearchParams builder. + * + *

similaritySearchParams: Parameters for semantic similarity search based retrieval. + */ + @CanIgnoreReturnValue + public Builder similaritySearchParams( + RetrieveMemoriesRequestSimilaritySearchParams.Builder similaritySearchParamsBuilder) { + return similaritySearchParams(similaritySearchParamsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder similaritySearchParams( + Optional similaritySearchParams); + + /** Clears the value of similaritySearchParams field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSimilaritySearchParams() { + return similaritySearchParams(Optional.empty()); + } + + /** + * Setter for simpleRetrievalParams. + * + *

simpleRetrievalParams: Parameters for simple (non-similarity search) retrieval. + */ + @JsonProperty("simpleRetrievalParams") + public abstract Builder simpleRetrievalParams( + RetrieveMemoriesRequestSimpleRetrievalParams simpleRetrievalParams); + + /** + * Setter for simpleRetrievalParams builder. + * + *

simpleRetrievalParams: Parameters for simple (non-similarity search) retrieval. + */ + @CanIgnoreReturnValue + public Builder simpleRetrievalParams( + RetrieveMemoriesRequestSimpleRetrievalParams.Builder simpleRetrievalParamsBuilder) { + return simpleRetrievalParams(simpleRetrievalParamsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder simpleRetrievalParams( + Optional simpleRetrievalParams); + + /** Clears the value of simpleRetrievalParams field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSimpleRetrievalParams() { + return simpleRetrievalParams(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(RetrieveAgentEngineMemoriesConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(RetrieveAgentEngineMemoriesConfig.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 RetrieveAgentEngineMemoriesRequestParameters build(); + } + + /** Deserializes a JSON string to a RetrieveAgentEngineMemoriesRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveAgentEngineMemoriesRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RetrieveAgentEngineMemoriesRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimilaritySearchParams.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimilaritySearchParams.java new file mode 100644 index 0000000..81c9dd3 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimilaritySearchParams.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The parameters for semantic similarity search based retrieval. */ +@AutoValue +@JsonDeserialize(builder = RetrieveMemoriesRequestSimilaritySearchParams.Builder.class) +public abstract class RetrieveMemoriesRequestSimilaritySearchParams extends JsonSerializable { + /** + * Required. Query to use for similarity search retrieval. If provided, then the parent + * ReasoningEngine must have ReasoningEngineContextSpec.MemoryBankConfig.SimilaritySearchConfig + * set. + */ + @JsonProperty("searchQuery") + public abstract Optional searchQuery(); + + /** + * Optional. The maximum number of memories to return. The service may return fewer than this + * value. If unspecified, at most 3 memories will be returned. The maximum value is 100; values + * above 100 will be coerced to 100. + */ + @JsonProperty("topK") + public abstract Optional topK(); + + /** Instantiates a builder for RetrieveMemoriesRequestSimilaritySearchParams. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveMemoriesRequestSimilaritySearchParams.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveMemoriesRequestSimilaritySearchParams. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveMemoriesRequestSimilaritySearchParams.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveMemoriesRequestSimilaritySearchParams.Builder(); + } + + /** + * Setter for searchQuery. + * + *

searchQuery: Required. Query to use for similarity search retrieval. If provided, then the + * parent ReasoningEngine must have + * ReasoningEngineContextSpec.MemoryBankConfig.SimilaritySearchConfig set. + */ + @JsonProperty("searchQuery") + public abstract Builder searchQuery(String searchQuery); + + @ExcludeFromGeneratedCoverageReport + abstract Builder searchQuery(Optional searchQuery); + + /** Clears the value of searchQuery field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSearchQuery() { + return searchQuery(Optional.empty()); + } + + /** + * Setter for topK. + * + *

topK: Optional. The maximum number of memories to return. The service may return fewer + * than this value. If unspecified, at most 3 memories will be returned. The maximum value is + * 100; values above 100 will be coerced to 100. + */ + @JsonProperty("topK") + public abstract Builder topK(Integer topK); + + @ExcludeFromGeneratedCoverageReport + abstract Builder topK(Optional topK); + + /** Clears the value of topK field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopK() { + return topK(Optional.empty()); + } + + public abstract RetrieveMemoriesRequestSimilaritySearchParams build(); + } + + /** Deserializes a JSON string to a RetrieveMemoriesRequestSimilaritySearchParams object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveMemoriesRequestSimilaritySearchParams fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RetrieveMemoriesRequestSimilaritySearchParams.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimpleRetrievalParams.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimpleRetrievalParams.java new file mode 100644 index 0000000..7f5b656 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimpleRetrievalParams.java @@ -0,0 +1,117 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The parameters for simple (non-similarity search) retrieval. */ +@AutoValue +@JsonDeserialize(builder = RetrieveMemoriesRequestSimpleRetrievalParams.Builder.class) +public abstract class RetrieveMemoriesRequestSimpleRetrievalParams extends JsonSerializable { + /** + * Optional. The maximum number of memories to return. The service may return fewer than this + * value. If unspecified, at most 3 memories will be returned. The maximum value is 100; values + * above 100 will be coerced to 100. + */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** + * Optional. A page token, received from a previous `RetrieveMemories` call. Provide this to + * retrieve the subsequent page. + */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** Instantiates a builder for RetrieveMemoriesRequestSimpleRetrievalParams. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveMemoriesRequestSimpleRetrievalParams.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveMemoriesRequestSimpleRetrievalParams. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveMemoriesRequestSimpleRetrievalParams.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveMemoriesRequestSimpleRetrievalParams.Builder(); + } + + /** + * Setter for pageSize. + * + *

pageSize: Optional. The maximum number of memories to return. The service may return fewer + * than this value. If unspecified, at most 3 memories will be returned. The maximum value is + * 100; values above 100 will be coerced to 100. + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: Optional. A page token, received from a previous `RetrieveMemories` call. + * Provide this to retrieve the subsequent page. + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + public abstract RetrieveMemoriesRequestSimpleRetrievalParams build(); + } + + /** Deserializes a JSON string to a RetrieveMemoriesRequestSimpleRetrievalParams object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveMemoriesRequestSimpleRetrievalParams fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RetrieveMemoriesRequestSimpleRetrievalParams.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponse.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponse.java new file mode 100644 index 0000000..ef06251 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponse.java @@ -0,0 +1,139 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The response for retrieving memories. */ +@AutoValue +@JsonDeserialize(builder = RetrieveMemoriesResponse.Builder.class) +public abstract class RetrieveMemoriesResponse extends JsonSerializable { + /** + * A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, + * there are no subsequent pages. This token is not set if similarity search was used for + * retrieval. + */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** The retrieved memories. */ + @JsonProperty("retrievedMemories") + public abstract Optional> retrievedMemories(); + + /** Instantiates a builder for RetrieveMemoriesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveMemoriesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveMemoriesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RetrieveMemoriesResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveMemoriesResponse.Builder(); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. This token is not set if similarity search + * was used for retrieval. + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for retrievedMemories. + * + *

retrievedMemories: The retrieved memories. + */ + @JsonProperty("retrievedMemories") + public abstract Builder retrievedMemories( + List retrievedMemories); + + /** + * Setter for retrievedMemories. + * + *

retrievedMemories: The retrieved memories. + */ + @CanIgnoreReturnValue + public Builder retrievedMemories(RetrieveMemoriesResponseRetrievedMemory... retrievedMemories) { + return retrievedMemories(Arrays.asList(retrievedMemories)); + } + + /** + * Setter for retrievedMemories builder. + * + *

retrievedMemories: The retrieved memories. + */ + @CanIgnoreReturnValue + public Builder retrievedMemories( + RetrieveMemoriesResponseRetrievedMemory.Builder... retrievedMemoriesBuilders) { + return retrievedMemories( + Arrays.asList(retrievedMemoriesBuilders).stream() + .map(RetrieveMemoriesResponseRetrievedMemory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder retrievedMemories( + Optional> retrievedMemories); + + /** Clears the value of retrievedMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRetrievedMemories() { + return retrievedMemories(Optional.empty()); + } + + public abstract RetrieveMemoriesResponse build(); + } + + /** Deserializes a JSON string to a RetrieveMemoriesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveMemoriesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RetrieveMemoriesResponse.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponseRetrievedMemory.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponseRetrievedMemory.java new file mode 100644 index 0000000..f5a02b9 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponseRetrievedMemory.java @@ -0,0 +1,121 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A retrieved memory. */ +@AutoValue +@JsonDeserialize(builder = RetrieveMemoriesResponseRetrievedMemory.Builder.class) +public abstract class RetrieveMemoriesResponseRetrievedMemory extends JsonSerializable { + /** + * The distance between the query and the retrieved Memory. Smaller values indicate more similar + * memories. This is only set if similarity search was used for retrieval. + */ + @JsonProperty("distance") + public abstract Optional distance(); + + /** The retrieved Memory. */ + @JsonProperty("memory") + public abstract Optional memory(); + + /** Instantiates a builder for RetrieveMemoriesResponseRetrievedMemory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveMemoriesResponseRetrievedMemory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveMemoriesResponseRetrievedMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveMemoriesResponseRetrievedMemory.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveMemoriesResponseRetrievedMemory.Builder(); + } + + /** + * Setter for distance. + * + *

distance: The distance between the query and the retrieved Memory. Smaller values indicate + * more similar memories. This is only set if similarity search was used for retrieval. + */ + @JsonProperty("distance") + public abstract Builder distance(Double distance); + + @ExcludeFromGeneratedCoverageReport + abstract Builder distance(Optional distance); + + /** Clears the value of distance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDistance() { + return distance(Optional.empty()); + } + + /** + * Setter for memory. + * + *

memory: The retrieved Memory. + */ + @JsonProperty("memory") + public abstract Builder memory(Memory memory); + + /** + * Setter for memory builder. + * + *

memory: The retrieved Memory. + */ + @CanIgnoreReturnValue + public Builder memory(Memory.Builder memoryBuilder) { + return memory(memoryBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memory(Optional memory); + + /** Clears the value of memory field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemory() { + return memory(Optional.empty()); + } + + public abstract RetrieveMemoriesResponseRetrievedMemory build(); + } + + /** Deserializes a JSON string to a RetrieveMemoriesResponseRetrievedMemory object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveMemoriesResponseRetrievedMemory fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RetrieveMemoriesResponseRetrievedMemory.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryConfig.java new file mode 100644 index 0000000..312b0fd --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryConfig.java @@ -0,0 +1,106 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for rolling back a memory. */ +@AutoValue +@JsonDeserialize(builder = RollbackAgentEngineMemoryConfig.Builder.class) +public abstract class RollbackAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** Instantiates a builder for RollbackAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RollbackAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RollbackAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RollbackAgentEngineMemoryConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RollbackAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + public abstract RollbackAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a RollbackAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static RollbackAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RollbackAgentEngineMemoryConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryRequestParameters.java new file mode 100644 index 0000000..e9fb281 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryRequestParameters.java @@ -0,0 +1,141 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for generating agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = RollbackAgentEngineMemoryRequestParameters.Builder.class) +public abstract class RollbackAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine memory to rollback. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The ID of the revision to rollback to. */ + @JsonProperty("targetRevisionId") + public abstract Optional targetRevisionId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for RollbackAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RollbackAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RollbackAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RollbackAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RollbackAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine memory to rollback. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for targetRevisionId. + * + *

targetRevisionId: The ID of the revision to rollback to. + */ + @JsonProperty("targetRevisionId") + public abstract Builder targetRevisionId(String targetRevisionId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder targetRevisionId(Optional targetRevisionId); + + /** Clears the value of targetRevisionId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTargetRevisionId() { + return targetRevisionId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(RollbackAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(RollbackAgentEngineMemoryConfig.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 RollbackAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a RollbackAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static RollbackAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RollbackAgentEngineMemoryRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironment.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironment.java new file mode 100644 index 0000000..20ca691 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironment.java @@ -0,0 +1,304 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.time.Instant; +import java.util.Optional; + +/** A sandbox environment. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironment.Builder.class) +public abstract class SandboxEnvironment extends JsonSerializable { + /** Expiration time of the sandbox environment. */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** Output only. The connection information of the SandboxEnvironment. */ + @JsonProperty("connectionInfo") + public abstract Optional connectionInfo(); + + /** Output only. The timestamp when this SandboxEnvironment was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Required. The display name of the SandboxEnvironment. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Identifier. The name of the SandboxEnvironment. */ + @JsonProperty("name") + public abstract Optional name(); + + /** Optional. The configuration of the SandboxEnvironment. */ + @JsonProperty("spec") + public abstract Optional spec(); + + /** Output only. The runtime state of the SandboxEnvironment. */ + @JsonProperty("state") + public abstract Optional state(); + + /** + * Optional. Input only. The TTL for the sandbox environment. The expiration time is computed: now + * + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** Output only. The timestamp when this SandboxEnvironment was most recently updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Instantiates a builder for SandboxEnvironment. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironment.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironment. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SandboxEnvironment.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironment.Builder(); + } + + /** + * Setter for expireTime. + * + *

expireTime: Expiration time of the sandbox environment. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for connectionInfo. + * + *

connectionInfo: Output only. The connection information of the SandboxEnvironment. + */ + @JsonProperty("connectionInfo") + public abstract Builder connectionInfo(SandboxEnvironmentConnectionInfo connectionInfo); + + /** + * Setter for connectionInfo builder. + * + *

connectionInfo: Output only. The connection information of the SandboxEnvironment. + */ + @CanIgnoreReturnValue + public Builder connectionInfo(SandboxEnvironmentConnectionInfo.Builder connectionInfoBuilder) { + return connectionInfo(connectionInfoBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder connectionInfo(Optional connectionInfo); + + /** Clears the value of connectionInfo field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConnectionInfo() { + return connectionInfo(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. The timestamp when this SandboxEnvironment was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Required. The display name of the SandboxEnvironment. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Identifier. The name of the SandboxEnvironment. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for spec. + * + *

spec: Optional. The configuration of the SandboxEnvironment. + */ + @JsonProperty("spec") + public abstract Builder spec(SandboxEnvironmentSpec spec); + + /** + * Setter for spec builder. + * + *

spec: Optional. The configuration of the SandboxEnvironment. + */ + @CanIgnoreReturnValue + public Builder spec(SandboxEnvironmentSpec.Builder specBuilder) { + return spec(specBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder spec(Optional spec); + + /** Clears the value of spec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSpec() { + return spec(Optional.empty()); + } + + /** + * Setter for state. + * + *

state: Output only. The runtime state of the SandboxEnvironment. + */ + @JsonProperty("state") + public abstract Builder state(State state); + + @ExcludeFromGeneratedCoverageReport + abstract Builder state(Optional state); + + /** Clears the value of state field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearState() { + return state(Optional.empty()); + } + + /** + * Setter for state given a known enum. + * + *

state: Output only. The runtime state of the SandboxEnvironment. + */ + @CanIgnoreReturnValue + public Builder state(State.Known knownType) { + return state(new State(knownType)); + } + + /** + * Setter for state given a string. + * + *

state: Output only. The runtime state of the SandboxEnvironment. + */ + @CanIgnoreReturnValue + public Builder state(String state) { + return state(new State(state)); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for the sandbox environment. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. The timestamp when this SandboxEnvironment was most recently + * updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + public abstract SandboxEnvironment build(); + } + + /** Deserializes a JSON string to a SandboxEnvironment object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironment fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SandboxEnvironment.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentConnectionInfo.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentConnectionInfo.java new file mode 100644 index 0000000..406fe68 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentConnectionInfo.java @@ -0,0 +1,128 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The connection information of the SandboxEnvironment. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironmentConnectionInfo.Builder.class) +public abstract class SandboxEnvironmentConnectionInfo extends JsonSerializable { + /** Output only. The hostname of the load balancer. */ + @JsonProperty("loadBalancerHostname") + public abstract Optional loadBalancerHostname(); + + /** Output only. The IP address of the load balancer. */ + @JsonProperty("loadBalancerIp") + public abstract Optional loadBalancerIp(); + + /** Output only. The internal IP address of the SandboxEnvironment. */ + @JsonProperty("sandboxInternalIp") + public abstract Optional sandboxInternalIp(); + + /** Instantiates a builder for SandboxEnvironmentConnectionInfo. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironmentConnectionInfo.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironmentConnectionInfo. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SandboxEnvironmentConnectionInfo.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironmentConnectionInfo.Builder(); + } + + /** + * Setter for loadBalancerHostname. + * + *

loadBalancerHostname: Output only. The hostname of the load balancer. + */ + @JsonProperty("loadBalancerHostname") + public abstract Builder loadBalancerHostname(String loadBalancerHostname); + + @ExcludeFromGeneratedCoverageReport + abstract Builder loadBalancerHostname(Optional loadBalancerHostname); + + /** Clears the value of loadBalancerHostname field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLoadBalancerHostname() { + return loadBalancerHostname(Optional.empty()); + } + + /** + * Setter for loadBalancerIp. + * + *

loadBalancerIp: Output only. The IP address of the load balancer. + */ + @JsonProperty("loadBalancerIp") + public abstract Builder loadBalancerIp(String loadBalancerIp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder loadBalancerIp(Optional loadBalancerIp); + + /** Clears the value of loadBalancerIp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLoadBalancerIp() { + return loadBalancerIp(Optional.empty()); + } + + /** + * Setter for sandboxInternalIp. + * + *

sandboxInternalIp: Output only. The internal IP address of the SandboxEnvironment. + */ + @JsonProperty("sandboxInternalIp") + public abstract Builder sandboxInternalIp(String sandboxInternalIp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sandboxInternalIp(Optional sandboxInternalIp); + + /** Clears the value of sandboxInternalIp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSandboxInternalIp() { + return sandboxInternalIp(Optional.empty()); + } + + public abstract SandboxEnvironmentConnectionInfo build(); + } + + /** Deserializes a JSON string to a SandboxEnvironmentConnectionInfo object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironmentConnectionInfo fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SandboxEnvironmentConnectionInfo.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpec.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpec.java new file mode 100644 index 0000000..f98a7b9 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpec.java @@ -0,0 +1,130 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The specification of a sandbox environment. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironmentSpec.Builder.class) +public abstract class SandboxEnvironmentSpec extends JsonSerializable { + /** Optional. The code execution environment. */ + @JsonProperty("codeExecutionEnvironment") + public abstract Optional + codeExecutionEnvironment(); + + /** Optional. The computer use environment. */ + @JsonProperty("computerUseEnvironment") + public abstract Optional computerUseEnvironment(); + + /** Instantiates a builder for SandboxEnvironmentSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironmentSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironmentSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SandboxEnvironmentSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironmentSpec.Builder(); + } + + /** + * Setter for codeExecutionEnvironment. + * + *

codeExecutionEnvironment: Optional. The code execution environment. + */ + @JsonProperty("codeExecutionEnvironment") + public abstract Builder codeExecutionEnvironment( + SandboxEnvironmentSpecCodeExecutionEnvironment codeExecutionEnvironment); + + /** + * Setter for codeExecutionEnvironment builder. + * + *

codeExecutionEnvironment: Optional. The code execution environment. + */ + @CanIgnoreReturnValue + public Builder codeExecutionEnvironment( + SandboxEnvironmentSpecCodeExecutionEnvironment.Builder codeExecutionEnvironmentBuilder) { + return codeExecutionEnvironment(codeExecutionEnvironmentBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder codeExecutionEnvironment( + Optional codeExecutionEnvironment); + + /** Clears the value of codeExecutionEnvironment field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCodeExecutionEnvironment() { + return codeExecutionEnvironment(Optional.empty()); + } + + /** + * Setter for computerUseEnvironment. + * + *

computerUseEnvironment: Optional. The computer use environment. + */ + @JsonProperty("computerUseEnvironment") + public abstract Builder computerUseEnvironment( + SandboxEnvironmentSpecComputerUseEnvironment computerUseEnvironment); + + /** + * Setter for computerUseEnvironment builder. + * + *

computerUseEnvironment: Optional. The computer use environment. + */ + @CanIgnoreReturnValue + public Builder computerUseEnvironment( + SandboxEnvironmentSpecComputerUseEnvironment.Builder computerUseEnvironmentBuilder) { + return computerUseEnvironment(computerUseEnvironmentBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder computerUseEnvironment( + Optional computerUseEnvironment); + + /** Clears the value of computerUseEnvironment field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearComputerUseEnvironment() { + return computerUseEnvironment(Optional.empty()); + } + + public abstract SandboxEnvironmentSpec build(); + } + + /** Deserializes a JSON string to a SandboxEnvironmentSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironmentSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SandboxEnvironmentSpec.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecCodeExecutionEnvironment.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecCodeExecutionEnvironment.java new file mode 100644 index 0000000..6e9733c --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecCodeExecutionEnvironment.java @@ -0,0 +1,147 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The code execution environment with customized settings. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironmentSpecCodeExecutionEnvironment.Builder.class) +public abstract class SandboxEnvironmentSpecCodeExecutionEnvironment extends JsonSerializable { + /** The coding language supported in this environment. */ + @JsonProperty("codeLanguage") + public abstract Optional codeLanguage(); + + /** The machine config of the code execution environment. */ + @JsonProperty("machineConfig") + public abstract Optional machineConfig(); + + /** Instantiates a builder for SandboxEnvironmentSpecCodeExecutionEnvironment. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironmentSpecCodeExecutionEnvironment.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironmentSpecCodeExecutionEnvironment. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SandboxEnvironmentSpecCodeExecutionEnvironment.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironmentSpecCodeExecutionEnvironment.Builder(); + } + + /** + * Setter for codeLanguage. + * + *

codeLanguage: The coding language supported in this environment. + */ + @JsonProperty("codeLanguage") + public abstract Builder codeLanguage(Language codeLanguage); + + @ExcludeFromGeneratedCoverageReport + abstract Builder codeLanguage(Optional codeLanguage); + + /** Clears the value of codeLanguage field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCodeLanguage() { + return codeLanguage(Optional.empty()); + } + + /** + * Setter for codeLanguage given a known enum. + * + *

codeLanguage: The coding language supported in this environment. + */ + @CanIgnoreReturnValue + public Builder codeLanguage(Language.Known knownType) { + return codeLanguage(new Language(knownType)); + } + + /** + * Setter for codeLanguage given a string. + * + *

codeLanguage: The coding language supported in this environment. + */ + @CanIgnoreReturnValue + public Builder codeLanguage(String codeLanguage) { + return codeLanguage(new Language(codeLanguage)); + } + + /** + * Setter for machineConfig. + * + *

machineConfig: The machine config of the code execution environment. + */ + @JsonProperty("machineConfig") + public abstract Builder machineConfig(MachineConfig machineConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder machineConfig(Optional machineConfig); + + /** Clears the value of machineConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMachineConfig() { + return machineConfig(Optional.empty()); + } + + /** + * Setter for machineConfig given a known enum. + * + *

machineConfig: The machine config of the code execution environment. + */ + @CanIgnoreReturnValue + public Builder machineConfig(MachineConfig.Known knownType) { + return machineConfig(new MachineConfig(knownType)); + } + + /** + * Setter for machineConfig given a string. + * + *

machineConfig: The machine config of the code execution environment. + */ + @CanIgnoreReturnValue + public Builder machineConfig(String machineConfig) { + return machineConfig(new MachineConfig(machineConfig)); + } + + public abstract SandboxEnvironmentSpecCodeExecutionEnvironment build(); + } + + /** Deserializes a JSON string to a SandboxEnvironmentSpecCodeExecutionEnvironment object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironmentSpecCodeExecutionEnvironment fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SandboxEnvironmentSpecCodeExecutionEnvironment.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecComputerUseEnvironment.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecComputerUseEnvironment.java new file mode 100644 index 0000000..f6857fe --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecComputerUseEnvironment.java @@ -0,0 +1,60 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; + +/** The computer use environment with customized settings. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironmentSpecComputerUseEnvironment.Builder.class) +public abstract class SandboxEnvironmentSpecComputerUseEnvironment extends JsonSerializable { + /** Instantiates a builder for SandboxEnvironmentSpecComputerUseEnvironment. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironmentSpecComputerUseEnvironment.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironmentSpecComputerUseEnvironment. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SandboxEnvironmentSpecComputerUseEnvironment.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironmentSpecComputerUseEnvironment.Builder(); + } + + public abstract SandboxEnvironmentSpecComputerUseEnvironment build(); + } + + /** Deserializes a JSON string to a SandboxEnvironmentSpecComputerUseEnvironment object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironmentSpecComputerUseEnvironment fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SandboxEnvironmentSpecComputerUseEnvironment.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/State.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/State.java new file mode 100644 index 0000000..3c76786 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/State.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Output only. The runtime state of the SandboxEnvironment. */ +public class State { + + /** Enum representing the known values for State. */ + public enum Known { + /** The default value. This value is unused. */ + STATE_UNSPECIFIED, + + /** Runtime resources are being allocated for the sandbox environment. */ + STATE_PROVISIONING, + + /** Sandbox runtime is ready for serving. */ + STATE_RUNNING, + + /** Sandbox runtime is halted, performing tear down tasks. */ + STATE_DEPROVISIONING, + + /** Sandbox has terminated with underlying runtime failure. */ + STATE_TERMINATED, + + /** Sandbox runtime has been deleted. */ + STATE_DELETED + } + + private Known stateEnum; + private final String value; + + @JsonCreator + public State(String value) { + this.value = value; + for (Known stateEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(stateEnum.toString(), value)) { + this.stateEnum = stateEnum; + break; + } + } + if (this.stateEnum == null) { + this.stateEnum = Known.STATE_UNSPECIFIED; + } + } + + public State(Known knownValue) { + this.stateEnum = 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 State)) { + return false; + } + + State other = (State) o; + + if (this.stateEnum != Known.STATE_UNSPECIFIED && other.stateEnum != Known.STATE_UNSPECIFIED) { + return this.stateEnum == other.stateEnum; + } else if (this.stateEnum == Known.STATE_UNSPECIFIED + && other.stateEnum == Known.STATE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.stateEnum != Known.STATE_UNSPECIFIED) { + return this.stateEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.stateEnum; + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryConfig.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryConfig.java new file mode 100644 index 0000000..4f120c3 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryConfig.java @@ -0,0 +1,410 @@ +/* + * 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.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Config for updating agent engine memory. */ +@AutoValue +@JsonDeserialize(builder = UpdateAgentEngineMemoryConfig.Builder.class) +public abstract class UpdateAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name of the memory. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the memory. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** + * Optional. Timestamp of when this resource is considered expired. This is *always* provided on + * output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Optional. Input only. Timestamp of when the revision is considered expired. If not set, the + * memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Optional revisionExpireTime(); + + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + @JsonProperty("revisionTtl") + public abstract Optional revisionTtl(); + + /** Optional. Input only. If true, no revision will be created for this request. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** Optional. The topics of the memory. */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** + * Optional. User-provided metadata for the Memory. This information was provided when creating, + * updating, or generating the Memory. It was not generated by Memory Bank. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * Optional. The user defined ID to use for memory, which will become the final component of the + * memory resource name. If not provided, Vertex AI will generate a value for this ID. This value + * may be up to 63 characters, and valid characters are `[a-z0-9-]`. The first character must be a + * letter, and the last character must be a letter or number. + */ + @JsonProperty("memoryId") + public abstract Optional memoryId(); + + /** + * The update mask to apply. For the `FieldMask` definition, see + * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. + */ + @JsonProperty("updateMask") + public abstract Optional updateMask(); + + /** Instantiates a builder for UpdateAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateAgentEngineMemoryConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the memory. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the memory. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this resource is considered expired. This is + * *always* provided on output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for revisionExpireTime. + * + *

revisionExpireTime: Optional. Input only. Timestamp of when the revision is considered + * expired. If not set, the memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Builder revisionExpireTime(Instant revisionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionExpireTime(Optional revisionExpireTime); + + /** Clears the value of revisionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionExpireTime() { + return revisionExpireTime(Optional.empty()); + } + + /** + * Setter for revisionTtl. + * + *

revisionTtl: Optional. Input only. The TTL for the revision. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("revisionTtl") + public abstract Builder revisionTtl(Duration revisionTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionTtl(Optional revisionTtl); + + /** Clears the value of revisionTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionTtl() { + return revisionTtl(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: Optional. Input only. If true, no revision will be created for + * this request. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The topics of the memory. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The topics of the memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The topics of the memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Optional. User-provided metadata for the Memory. This information was provided + * when creating, updating, or generating the Memory. It was not generated by Memory Bank. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for memoryId. + * + *

memoryId: Optional. The user defined ID to use for memory, which will become the final + * component of the memory resource name. If not provided, Vertex AI will generate a value for + * this ID. This value may be up to 63 characters, and valid characters are `[a-z0-9-]`. The + * first character must be a letter, and the last character must be a letter or number. + */ + @JsonProperty("memoryId") + public abstract Builder memoryId(String memoryId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder memoryId(Optional memoryId); + + /** Clears the value of memoryId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemoryId() { + return memoryId(Optional.empty()); + } + + /** + * Setter for updateMask. + * + *

updateMask: The update mask to apply. For the `FieldMask` definition, see + * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. + */ + @JsonProperty("updateMask") + public abstract Builder updateMask(String updateMask); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateMask(Optional updateMask); + + /** Clears the value of updateMask field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateMask() { + return updateMask(Optional.empty()); + } + + public abstract UpdateAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a UpdateAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateAgentEngineMemoryConfig.class); + } +} diff --git a/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryRequestParameters.java b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryRequestParameters.java new file mode 100644 index 0000000..72439c7 --- /dev/null +++ b/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryRequestParameters.java @@ -0,0 +1,180 @@ +/* + * 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.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Parameters for updating agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = UpdateAgentEngineMemoryRequestParameters.Builder.class) +public abstract class UpdateAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine memory to update. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * The updated fact of the memory. + * + *

This is the semantic knowledge extracted from the source content. + */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * The updated scope of the memory. + * + *

Memories are isolated within their scope. The scope is defined when creating or generating + * memories. Up to 5 key-value pairs are accepted, and scope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for UpdateAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine memory to update. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for fact. + * + *

fact: The updated fact of the memory. + * + *

This is the semantic knowledge extracted from the source content. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: The updated scope of the memory. + * + *

Memories are isolated within their scope. The scope is defined when creating or generating + * memories. Up to 5 key-value pairs are accepted, and scope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(UpdateAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(UpdateAgentEngineMemoryConfig.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 UpdateAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a UpdateAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, UpdateAgentEngineMemoryRequestParameters.class); + } +} diff --git a/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesMemoriesRevisionsTest.java b/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesMemoriesRevisionsTest.java new file mode 100644 index 0000000..85ee011 --- /dev/null +++ b/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesMemoriesRevisionsTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.vertexai.genai; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsResponse; +import com.google.cloud.vertexai.genai.types.MemoryRevision; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; +import org.junit.jupiter.api.extension.ExtendWith; + +@EnabledIfEnvironmentVariable( + named = "GOOGLE_GENAI_REPLAYS_DIRECTORY", + matches = ".*genai/replays.*") +@ExtendWith(EnvironmentVariablesMockingExtension.class) +public class AgentEnginesMemoriesRevisionsTest { + + @Test + public void testPrivateGetAgentEngineMemoryRevision() throws Exception { + Client client = + TestUtils.createClient( + true, "ae_memory_revisions_get/test_get_memory_revisions.vertex.json"); + + String name = + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688/revisions/516064922187071488"; + + MemoryRevision revision = client.agentEngines.memories.revisions.get(name, null); + + assertEquals(revision.name().get(), name); + } + + @Test + public void testPrivateListAgentEngineMemoryRevisions() throws Exception { + Client client = + TestUtils.createClient( + true, + "ae_memory_revisions_private_list/test_private_list_memory_revisions.vertex.json"); + + String name = + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688"; + + ListAgentEngineMemoryRevisionsResponse response = + client.agentEngines.memories.revisions.privateList(name, null); + + assertEquals( + response.memoryRevisions().get().get(0).name().get(), + name + "/revisions/516064922187071488"); + } +} diff --git a/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesMemoriesTest.java b/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesMemoriesTest.java new file mode 100644 index 0000000..6e8db4d --- /dev/null +++ b/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesMemoriesTest.java @@ -0,0 +1,213 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.vertexai.genai; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import com.google.cloud.vertexai.genai.types.AgentEngineGenerateMemoriesOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.AgentEnginePurgeMemoriesOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineRollbackMemoryOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestVertexSessionSource; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesMemoriesResponse; +import com.google.cloud.vertexai.genai.types.Memory; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesResponse; +import com.google.common.collect.ImmutableMap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; +import org.junit.jupiter.api.extension.ExtendWith; + +@EnabledIfEnvironmentVariable( + named = "GOOGLE_GENAI_REPLAYS_DIRECTORY", + matches = ".*genai/replays.*") +@ExtendWith(EnvironmentVariablesMockingExtension.class) +public class AgentEnginesMemoriesTest { + + @Test + public void testPrivateCreateAgentEngineMemory() throws Exception { + Client client = + TestUtils.createClient( + true, "ae_memories_private_create/test_private_create_memory.vertex.json"); + + AgentEngineMemoryOperation operation = + client.agentEngines.memories.privateCreate( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584", + "memory_fact", + ImmutableMap.of("user_id", "123"), + null); + + assertNotNull(operation.name()); + } + + @Test + public void testDeleteAgentEngineMemory() throws Exception { + Client client = + TestUtils.createClient(true, "ae_memories_delete/test_delete_memory.vertex.json"); + + DeleteAgentEngineMemoryOperation operation = + client.agentEngines.memories.delete( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/5605466683931099136", + null); + + assertNotNull(operation.name()); + } + + @Test + public void testPrivateGenerateAgentEngineMemory() throws Exception { + Client client = + TestUtils.createClient( + true, "ae_memories_private_generate/test_private_generate_memory.vertex.json"); + + String aeName = + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584"; + + AgentEngineGenerateMemoriesOperation response = + client.agentEngines.memories.privateGenerate( + aeName, + GenerateMemoriesRequestVertexSessionSource.builder() + .session( + "{PROJECT_AND_LOCATION_PATH}/reasoningEngines/2886612747586371584/sessions/6922431337672474624") + .build(), + null, + null, + null, + null); + + assertNotNull(response.name()); + } + + @Test + public void testPrivateGetAgentEngineMemory() throws Exception { + Client client = TestUtils.createClient(true, "ae_memories_get/test_get_memory.vertex.json"); + + Memory response = + client.agentEngines.memories.get( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688", + null); + + assertNotNull(response.name().get()); + } + + @Test + public void testPrivateGetAgentEngineMemoryOperation() throws Exception { + Client client = + TestUtils.createClient( + true, + "ae_memories_private_get_memory_operation/test_private_get_memory_operation.vertex.json"); + + AgentEngineMemoryOperation operation = + client.agentEngines.memories.privateGetMemoryOperation( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688/operations/1044963283964002304", + null); + + assertNotNull(operation.name()); + } + + @Test + public void testPrivateGetAgentEngineGenerateMemoryOperation() throws Exception { + Client client = + TestUtils.createClient( + true, + "ae_memories_private_get_generate_memories_operation/test_private_get_generate_memories_operation.vertex.json"); + + AgentEngineGenerateMemoriesOperation operation = + client.agentEngines.memories.privateGetGenerateMemoriesOperation( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/operations/5669315676343369728", + null); + + assertNotNull(operation.name()); + } + + @Test + public void testPrivateListAgentEngineMemory() throws Exception { + Client client = + TestUtils.createClient( + true, "ae_memories_private_list/test_private_list_memory.vertex.json"); + + ListReasoningEnginesMemoriesResponse response = + client.agentEngines.memories.privateList( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584", + null); + + assertNotNull(response.memories().get().get(0).name().get()); + } + + @Test + public void testPrivateRetrieveAgentEngineMemory() throws Exception { + Client client = + TestUtils.createClient( + true, "ae_memories_private_retrieve/test_private_retrieve.vertex.json"); + + RetrieveMemoriesResponse response = + client.agentEngines.memories.privateRetrieve( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584", + ImmutableMap.of("user_id", "123"), + null, + null, + null); + + assertNotNull(response.retrievedMemories().get().get(0).memory().get()); + } + + @Test + public void testPrivateRollbackAgentEngineMemory() throws Exception { + Client client = + TestUtils.createClient( + true, "ae_memories_private_rollback/test_private_rollback.vertex.json"); + + AgentEngineRollbackMemoryOperation operation = + client.agentEngines.memories.privateRollback( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688", + "3001207491565453312", + null); + + assertNotNull(operation.name()); + } + + @Test + public void testPrivateUpdateAgentEngineMemory() throws Exception { + Client client = + TestUtils.createClient( + true, "ae_memories_private_update/test_private_update_memory.vertex.json"); + + AgentEngineMemoryOperation operation = + client.agentEngines.memories.privateUpdate( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688", + "memory_fact_updated", + ImmutableMap.of("user_id", "123"), + null); + + assertNotNull(operation.name()); + } + + @Test + public void testPrivatePurgeAgentEngineMemory() throws Exception { + Client client = + TestUtils.createClient(true, "ae_memories_private_purge/test_private_purge.vertex.json"); + + AgentEnginePurgeMemoriesOperation operation = + client.agentEngines.memories.privatePurge( + "projects/964831358985/locations/us-central1/reasoningEngines/6086402690647064576", + "scope.user_id=123", + null, + false, + null); + + assertNotNull(operation.name()); + } +} diff --git a/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesSandboxesTest.java b/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesSandboxesTest.java new file mode 100644 index 0000000..e1141e0 --- /dev/null +++ b/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/AgentEnginesSandboxesTest.java @@ -0,0 +1,158 @@ +/* + * Copyright 2026 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.vertexai.genai; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import com.google.cloud.vertexai.genai.types.AgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.Chunk; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.ExecuteSandboxEnvironmentResponse; +import com.google.cloud.vertexai.genai.types.Metadata; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesResponse; +import com.google.cloud.vertexai.genai.types.SandboxEnvironment; +import com.google.cloud.vertexai.genai.types.SandboxEnvironmentSpec; +import com.google.cloud.vertexai.genai.types.SandboxEnvironmentSpecCodeExecutionEnvironment; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.genai.JsonSerializable; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.List; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; +import org.junit.jupiter.api.extension.ExtendWith; + +@EnabledIfEnvironmentVariable( + named = "GOOGLE_GENAI_REPLAYS_DIRECTORY", + matches = ".*genai/replays.*") +@ExtendWith(EnvironmentVariablesMockingExtension.class) +public class AgentEnginesSandboxesTest { + + @Test + public void testPrivateCreateAgentEngineSandbox() throws Exception { + Client client = + TestUtils.createClient(true, "ae_sandboxes_private_create/test_private_create.vertex.json"); + + AgentEngineSandboxOperation operation = + client.agentEngines.sandboxes.privateCreate( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584", + SandboxEnvironmentSpec.builder() + .codeExecutionEnvironment( + SandboxEnvironmentSpecCodeExecutionEnvironment.builder() + .machineConfig("MACHINE_CONFIG_VCPU4_RAM4GIB") + .build()) + .build(), + null); + + assertNotNull(operation.name()); + } + + @Test + public void testPrivateListAgentEngineSandbox() throws Exception { + Client client = + TestUtils.createClient(true, "ae_sandboxes_private_list/test_private_list.vertex.json"); + + ListAgentEngineSandboxesResponse response = + client.agentEngines.sandboxes.privateList("reasoningEngines/2886612747586371584", null); + + assertNotNull(response.sandboxEnvironments()); + assertFalse(response.sandboxEnvironments().get().isEmpty()); + } + + @Test + public void testPrivateGetAgentEngineSandbox() throws Exception { + Client client = + TestUtils.createClient(true, "ae_sandboxes_private_get/test_private_get.vertex.json"); + + SandboxEnvironment response = + client.agentEngines.sandboxes.privateGet( + "projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/sandboxEnvironments/3186171392039059456", + null); + + assertNotNull(response.name()); + } + + @Test + public void testPrivateGetAgentEngineSandboxOperation() throws Exception { + Client client = + TestUtils.createClient( + true, + "ae_sandboxes_private_get_sandbox_operation/test_private_get_operation.vertex.json"); + + AgentEngineSandboxOperation operation = + client.agentEngines.sandboxes.privateGetSandboxOperation( + "projects/964831358985/locations/us-central1/operations/4799455193970245632", null); + + assertNotNull(operation.name()); + } + + @Test + public void testPrivateExecuteCode() throws Exception { + Client client = + TestUtils.createClient( + true, "ae_sandboxes_private_execute_code/test_private_execute_code.vertex.json"); + + String code = + "\nwith open(\"test.txt\", \"r\") as input:\n" + + " with open(\"output.txt\", \"w\") as output_txt:\n" + + " for line in input:\n" + + " output_txt.write(line)\n"; + + String jsonWithSpace = String.format("{\"code\": %s}", JsonSerializable.toJsonString(code)); + + Chunk chunk1 = + Chunk.builder() + .data(jsonWithSpace.getBytes(StandardCharsets.UTF_8)) + .mimeType("application/json") + .build(); + + Chunk chunk2 = + Chunk.builder() + .data("Hello, world!".getBytes(StandardCharsets.UTF_8)) + .metadata( + Metadata.builder() + .attributes( + ImmutableMap.of("fileName", "test.txt".getBytes(StandardCharsets.UTF_8))) + .build()) + .mimeType("text/plain") + .build(); + + List inputs = ImmutableList.of(chunk1, chunk2); + + ExecuteSandboxEnvironmentResponse response = + client.agentEngines.sandboxes.privateExecuteCode( + "reasoningEngines/2886612747586371584/sandboxEnvironments/6068475153556176896", + inputs, + null); + + assertNotNull(response.outputs()); + } + + @Test + public void testDeleteAgentEngineSandbox() throws Exception { + Client client = + TestUtils.createClient(true, "ae_sandboxes_private_delete/test_private_delete.vertex.json"); + + DeleteAgentEngineSandboxOperation operation = + client.agentEngines.sandboxes.privateDelete( + "reasoningEngines/2886612747586371584/sandboxEnvironments/6068475153556176896", null); + + assertNotNull(operation.name()); + } +}