Skip to content

Commit 01b895c

Browse files
BenjaminKazemicopybara-github
authored andcommitted
chore: [vertexai] Introduce modules
PiperOrigin-RevId: 834424318
1 parent ce3d3fb commit 01b895c

File tree

398 files changed

+66618
-18
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

398 files changed

+66618
-18
lines changed

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java

Lines changed: 967 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.vertexai.genai;
18+
19+
import okhttp3.Headers;
20+
import okhttp3.ResponseBody;
21+
22+
/** The API response contains a response to a call to the GenAI APIs. */
23+
abstract class ApiResponse implements AutoCloseable {
24+
/** Gets the ResponseBody. */
25+
public abstract ResponseBody getBody();
26+
27+
/** Returns all of the headers from the response. */
28+
public abstract Headers getHeaders();
29+
30+
@Override
31+
public abstract void close();
32+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// Auto-generated code. Do not edit.
18+
19+
package com.google.cloud.vertexai.genai;
20+
21+
import com.google.cloud.vertexai.genai.types.AgentEngineOperation;
22+
import com.google.cloud.vertexai.genai.types.CreateAgentEngineConfig;
23+
import com.google.cloud.vertexai.genai.types.DeleteAgentEngineConfig;
24+
import com.google.cloud.vertexai.genai.types.DeleteAgentEngineOperation;
25+
import com.google.cloud.vertexai.genai.types.GetAgentEngineConfig;
26+
import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig;
27+
import com.google.cloud.vertexai.genai.types.ListAgentEngineConfig;
28+
import com.google.cloud.vertexai.genai.types.ListReasoningEnginesResponse;
29+
import com.google.cloud.vertexai.genai.types.QueryAgentEngineConfig;
30+
import com.google.cloud.vertexai.genai.types.QueryReasoningEngineResponse;
31+
import com.google.cloud.vertexai.genai.types.ReasoningEngine;
32+
import com.google.cloud.vertexai.genai.types.UpdateAgentEngineConfig;
33+
import com.google.genai.ApiClient;
34+
import com.google.genai.ApiResponse;
35+
import com.google.genai.Common.BuiltRequest;
36+
import java.util.concurrent.CompletableFuture;
37+
38+
/** Async module of {@link AgentEngines} */
39+
public final class AsyncAgentEngines {
40+
41+
AgentEngines agentEngines;
42+
ApiClient apiClient;
43+
44+
public AsyncAgentEngines(ApiClient apiClient) {
45+
this.apiClient = apiClient;
46+
this.agentEngines = new AgentEngines(apiClient);
47+
}
48+
49+
CompletableFuture<AgentEngineOperation> privateCreate(CreateAgentEngineConfig config) {
50+
BuiltRequest builtRequest = agentEngines.buildRequestForPrivateCreate(config);
51+
return this.apiClient
52+
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
53+
.thenApplyAsync(
54+
response -> {
55+
try (ApiResponse res = response) {
56+
return agentEngines.processResponseForPrivateCreate(res, config);
57+
}
58+
});
59+
}
60+
61+
CompletableFuture<DeleteAgentEngineOperation> privateDelete(
62+
String name, boolean force, DeleteAgentEngineConfig config) {
63+
BuiltRequest builtRequest = agentEngines.buildRequestForPrivateDelete(name, force, config);
64+
return this.apiClient
65+
.asyncRequest(
66+
"delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
67+
.thenApplyAsync(
68+
response -> {
69+
try (ApiResponse res = response) {
70+
return agentEngines.processResponseForPrivateDelete(res, config);
71+
}
72+
});
73+
}
74+
75+
CompletableFuture<ReasoningEngine> privateGet(String name, GetAgentEngineConfig config) {
76+
BuiltRequest builtRequest = agentEngines.buildRequestForPrivateGet(name, config);
77+
return this.apiClient
78+
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
79+
.thenApplyAsync(
80+
response -> {
81+
try (ApiResponse res = response) {
82+
return agentEngines.processResponseForPrivateGet(res, config);
83+
}
84+
});
85+
}
86+
87+
CompletableFuture<ListReasoningEnginesResponse> privateList(ListAgentEngineConfig config) {
88+
BuiltRequest builtRequest = agentEngines.buildRequestForPrivateList(config);
89+
return this.apiClient
90+
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
91+
.thenApplyAsync(
92+
response -> {
93+
try (ApiResponse res = response) {
94+
return agentEngines.processResponseForPrivateList(res, config);
95+
}
96+
});
97+
}
98+
99+
CompletableFuture<AgentEngineOperation> privateGetAgentOperation(
100+
String operationName, GetAgentEngineOperationConfig config) {
101+
BuiltRequest builtRequest =
102+
agentEngines.buildRequestForPrivateGetAgentOperation(operationName, config);
103+
return this.apiClient
104+
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
105+
.thenApplyAsync(
106+
response -> {
107+
try (ApiResponse res = response) {
108+
return agentEngines.processResponseForPrivateGetAgentOperation(res, config);
109+
}
110+
});
111+
}
112+
113+
CompletableFuture<QueryReasoningEngineResponse> privateQuery(
114+
String name, QueryAgentEngineConfig config) {
115+
BuiltRequest builtRequest = agentEngines.buildRequestForPrivateQuery(name, config);
116+
return this.apiClient
117+
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
118+
.thenApplyAsync(
119+
response -> {
120+
try (ApiResponse res = response) {
121+
return agentEngines.processResponseForPrivateQuery(res, config);
122+
}
123+
});
124+
}
125+
126+
CompletableFuture<AgentEngineOperation> privateUpdate(
127+
String name, UpdateAgentEngineConfig config) {
128+
BuiltRequest builtRequest = agentEngines.buildRequestForPrivateUpdate(name, config);
129+
return this.apiClient
130+
.asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
131+
.thenApplyAsync(
132+
response -> {
133+
try (ApiResponse res = response) {
134+
return agentEngines.processResponseForPrivateUpdate(res, config);
135+
}
136+
});
137+
}
138+
}
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// Auto-generated code. Do not edit.
18+
19+
package com.google.cloud.vertexai.genai;
20+
21+
import com.google.cloud.vertexai.genai.types.AssembleDatasetConfig;
22+
import com.google.cloud.vertexai.genai.types.CreateMultimodalDatasetConfig;
23+
import com.google.cloud.vertexai.genai.types.GeminiRequestReadConfig;
24+
import com.google.cloud.vertexai.genai.types.GetMultimodalDatasetOperationConfig;
25+
import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsConfig;
26+
import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsResponse;
27+
import com.google.cloud.vertexai.genai.types.MultimodalDataset;
28+
import com.google.cloud.vertexai.genai.types.MultimodalDatasetOperation;
29+
import com.google.cloud.vertexai.genai.types.SchemaTablesDatasetMetadata;
30+
import com.google.cloud.vertexai.genai.types.UpdateMultimodalDatasetConfig;
31+
import com.google.cloud.vertexai.genai.types.VertexBaseConfig;
32+
import com.google.genai.ApiClient;
33+
import com.google.genai.ApiResponse;
34+
import com.google.genai.Common.BuiltRequest;
35+
import com.google.genai.types.EncryptionSpec;
36+
import java.util.concurrent.CompletableFuture;
37+
38+
/** Async module of {@link Datasets} */
39+
public final class AsyncDatasets {
40+
41+
Datasets datasets;
42+
ApiClient apiClient;
43+
44+
public AsyncDatasets(ApiClient apiClient) {
45+
this.apiClient = apiClient;
46+
this.datasets = new Datasets(apiClient);
47+
}
48+
49+
CompletableFuture<MultimodalDatasetOperation> privateAssembleMultimodalDataset(
50+
String name, GeminiRequestReadConfig geminiRequestReadConfig, AssembleDatasetConfig config) {
51+
BuiltRequest builtRequest =
52+
datasets.buildRequestForPrivateAssembleMultimodalDataset(
53+
name, geminiRequestReadConfig, config);
54+
return this.apiClient
55+
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
56+
.thenApplyAsync(
57+
response -> {
58+
try (ApiResponse res = response) {
59+
return datasets.processResponseForPrivateAssembleMultimodalDataset(res, config);
60+
}
61+
});
62+
}
63+
64+
CompletableFuture<MultimodalDatasetOperation> privateCreateMultimodalDataset(
65+
String name,
66+
String displayName,
67+
String metadataSchemaUri,
68+
SchemaTablesDatasetMetadata metadata,
69+
String description,
70+
EncryptionSpec encryptionSpec,
71+
CreateMultimodalDatasetConfig config) {
72+
BuiltRequest builtRequest =
73+
datasets.buildRequestForPrivateCreateMultimodalDataset(
74+
name, displayName, metadataSchemaUri, metadata, description, encryptionSpec, config);
75+
return this.apiClient
76+
.asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
77+
.thenApplyAsync(
78+
response -> {
79+
try (ApiResponse res = response) {
80+
return datasets.processResponseForPrivateCreateMultimodalDataset(res, config);
81+
}
82+
});
83+
}
84+
85+
CompletableFuture<MultimodalDatasetOperation> privateDeleteMultimodalDataset(
86+
String name, VertexBaseConfig config) {
87+
BuiltRequest builtRequest =
88+
datasets.buildRequestForPrivateDeleteMultimodalDataset(name, config);
89+
return this.apiClient
90+
.asyncRequest(
91+
"delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
92+
.thenApplyAsync(
93+
response -> {
94+
try (ApiResponse res = response) {
95+
return datasets.processResponseForPrivateDeleteMultimodalDataset(res, config);
96+
}
97+
});
98+
}
99+
100+
CompletableFuture<MultimodalDataset> privateGetMultimodalDataset(
101+
String name, VertexBaseConfig config) {
102+
BuiltRequest builtRequest = datasets.buildRequestForPrivateGetMultimodalDataset(name, config);
103+
return this.apiClient
104+
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
105+
.thenApplyAsync(
106+
response -> {
107+
try (ApiResponse res = response) {
108+
return datasets.processResponseForPrivateGetMultimodalDataset(res, config);
109+
}
110+
});
111+
}
112+
113+
CompletableFuture<MultimodalDatasetOperation> privateGetMultimodalDatasetOperation(
114+
String datasetId, String operationId, GetMultimodalDatasetOperationConfig config) {
115+
BuiltRequest builtRequest =
116+
datasets.buildRequestForPrivateGetMultimodalDatasetOperation(
117+
datasetId, operationId, config);
118+
return this.apiClient
119+
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
120+
.thenApplyAsync(
121+
response -> {
122+
try (ApiResponse res = response) {
123+
return datasets.processResponseForPrivateGetMultimodalDatasetOperation(res, config);
124+
}
125+
});
126+
}
127+
128+
CompletableFuture<ListMultimodalDatasetsResponse> privateListMultimodalDatasets(
129+
ListMultimodalDatasetsConfig config) {
130+
BuiltRequest builtRequest = datasets.buildRequestForPrivateListMultimodalDatasets(config);
131+
return this.apiClient
132+
.asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
133+
.thenApplyAsync(
134+
response -> {
135+
try (ApiResponse res = response) {
136+
return datasets.processResponseForPrivateListMultimodalDatasets(res, config);
137+
}
138+
});
139+
}
140+
141+
CompletableFuture<MultimodalDataset> privateUpdateMultimodalDataset(
142+
String name,
143+
String displayName,
144+
SchemaTablesDatasetMetadata metadata,
145+
String description,
146+
EncryptionSpec encryptionSpec,
147+
UpdateMultimodalDatasetConfig config) {
148+
BuiltRequest builtRequest =
149+
datasets.buildRequestForPrivateUpdateMultimodalDataset(
150+
name, displayName, metadata, description, encryptionSpec, config);
151+
return this.apiClient
152+
.asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())
153+
.thenApplyAsync(
154+
response -> {
155+
try (ApiResponse res = response) {
156+
return datasets.processResponseForPrivateUpdateMultimodalDataset(res, config);
157+
}
158+
});
159+
}
160+
}

0 commit comments

Comments
 (0)