Skip to content

Commit 1f17bca

Browse files
Google APIscopybara-github
authored andcommitted
feat: Allow v1 api calls for some dataset_service, llm_utility_service, and prediction_service apis without project and location
PiperOrigin-RevId: 660169876
1 parent dba0d79 commit 1f17bca

3 files changed

Lines changed: 57 additions & 1 deletion

File tree

google/cloud/aiplatform/v1/dataset_service.proto

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ service DatasetService {
5252
option (google.api.http) = {
5353
post: "/v1/{parent=projects/*/locations/*}/datasets"
5454
body: "dataset"
55+
additional_bindings { post: "/v1/datasets" body: "dataset" }
5556
};
5657
option (google.api.method_signature) = "parent,dataset";
5758
option (google.longrunning.operation_info) = {
@@ -64,6 +65,7 @@ service DatasetService {
6465
rpc GetDataset(GetDatasetRequest) returns (Dataset) {
6566
option (google.api.http) = {
6667
get: "/v1/{name=projects/*/locations/*/datasets/*}"
68+
additional_bindings { get: "/v1/{name=datasets/*}" }
6769
};
6870
option (google.api.method_signature) = "name";
6971
}
@@ -73,6 +75,10 @@ service DatasetService {
7375
option (google.api.http) = {
7476
patch: "/v1/{dataset.name=projects/*/locations/*/datasets/*}"
7577
body: "dataset"
78+
additional_bindings {
79+
patch: "/v1/{dataset.name=datasets/*}"
80+
body: "dataset"
81+
}
7682
};
7783
option (google.api.method_signature) = "dataset,update_mask";
7884
}
@@ -81,6 +87,7 @@ service DatasetService {
8187
rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) {
8288
option (google.api.http) = {
8389
get: "/v1/{parent=projects/*/locations/*}/datasets"
90+
additional_bindings { get: "/v1/datasets" }
8491
};
8592
option (google.api.method_signature) = "parent";
8693
}
@@ -90,6 +97,7 @@ service DatasetService {
9097
returns (google.longrunning.Operation) {
9198
option (google.api.http) = {
9299
delete: "/v1/{name=projects/*/locations/*/datasets/*}"
100+
additional_bindings { delete: "/v1/{name=datasets/*}" }
93101
};
94102
option (google.api.method_signature) = "name";
95103
option (google.longrunning.operation_info) = {
@@ -130,6 +138,10 @@ service DatasetService {
130138
option (google.api.http) = {
131139
post: "/v1/{parent=projects/*/locations/*/datasets/*}/datasetVersions"
132140
body: "dataset_version"
141+
additional_bindings {
142+
post: "/v1/{parent=datasets/*}/datasetVersions"
143+
body: "dataset_version"
144+
}
133145
};
134146
option (google.api.method_signature) = "parent,dataset_version";
135147
option (google.longrunning.operation_info) = {
@@ -144,6 +156,10 @@ service DatasetService {
144156
option (google.api.http) = {
145157
patch: "/v1/{dataset_version.name=projects/*/locations/*/datasets/*/datasetVersions/*}"
146158
body: "dataset_version"
159+
additional_bindings {
160+
patch: "/v1/{dataset_version.name=datasets/*/datasetVersions/*}"
161+
body: "dataset_version"
162+
}
147163
};
148164
option (google.api.method_signature) = "dataset_version,update_mask";
149165
}
@@ -153,6 +169,7 @@ service DatasetService {
153169
returns (google.longrunning.Operation) {
154170
option (google.api.http) = {
155171
delete: "/v1/{name=projects/*/locations/*/datasets/*/datasetVersions/*}"
172+
additional_bindings { delete: "/v1/{name=datasets/*/datasetVersions/*}" }
156173
};
157174
option (google.api.method_signature) = "name";
158175
option (google.longrunning.operation_info) = {
@@ -165,6 +182,7 @@ service DatasetService {
165182
rpc GetDatasetVersion(GetDatasetVersionRequest) returns (DatasetVersion) {
166183
option (google.api.http) = {
167184
get: "/v1/{name=projects/*/locations/*/datasets/*/datasetVersions/*}"
185+
additional_bindings { get: "/v1/{name=datasets/*/datasetVersions/*}" }
168186
};
169187
option (google.api.method_signature) = "name";
170188
}
@@ -174,6 +192,7 @@ service DatasetService {
174192
returns (ListDatasetVersionsResponse) {
175193
option (google.api.http) = {
176194
get: "/v1/{parent=projects/*/locations/*/datasets/*}/datasetVersions"
195+
additional_bindings { get: "/v1/{parent=datasets/*}/datasetVersions" }
177196
};
178197
option (google.api.method_signature) = "parent";
179198
}
@@ -183,6 +202,9 @@ service DatasetService {
183202
returns (google.longrunning.Operation) {
184203
option (google.api.http) = {
185204
get: "/v1/{name=projects/*/locations/*/datasets/*/datasetVersions/*}:restore"
205+
additional_bindings {
206+
get: "/v1/{name=datasets/*/datasetVersions/*}:restore"
207+
}
186208
};
187209
option (google.api.method_signature) = "name";
188210
option (google.longrunning.operation_info) = {

google/cloud/aiplatform/v1/llm_utility_service.proto

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ service LlmUtilityService {
4747
post: "/v1/{endpoint=projects/*/locations/*/publishers/*/models/*}:countTokens"
4848
body: "*"
4949
}
50+
additional_bindings {
51+
post: "/v1/{endpoint=endpoints/*}:countTokens"
52+
body: "*"
53+
}
54+
additional_bindings {
55+
post: "/v1/{endpoint=publishers/*/models/*}:countTokens"
56+
body: "*"
57+
}
5058
};
5159
option (google.api.method_signature) = "endpoint,instances";
5260
}
@@ -60,6 +68,14 @@ service LlmUtilityService {
6068
post: "/v1/{endpoint=projects/*/locations/*/publishers/*/models/*}:computeTokens"
6169
body: "*"
6270
}
71+
additional_bindings {
72+
post: "/v1/{endpoint=endpoints/*}:computeTokens"
73+
body: "*"
74+
}
75+
additional_bindings {
76+
post: "/v1/{endpoint=publishers/*/models/*}:computeTokens"
77+
body: "*"
78+
}
6379
};
6480
option (google.api.method_signature) = "endpoint,instances";
6581
}

google/cloud/aiplatform/v1/prediction_service.proto

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ service PredictionService {
174174
post: "/v1/{model=projects/*/locations/*/publishers/*/models/*}:generateContent"
175175
body: "*"
176176
}
177+
additional_bindings {
178+
post: "/v1/{model=endpoints/*}:generateContent"
179+
body: "*"
180+
}
181+
additional_bindings {
182+
post: "/v1/{model=publishers/*/models/*}:generateContent"
183+
body: "*"
184+
}
177185
};
178186
option (google.api.method_signature) = "model,contents";
179187
}
@@ -188,6 +196,14 @@ service PredictionService {
188196
post: "/v1/{model=projects/*/locations/*/publishers/*/models/*}:streamGenerateContent"
189197
body: "*"
190198
}
199+
additional_bindings {
200+
post: "/v1/{model=endpoints/*}:streamGenerateContent"
201+
body: "*"
202+
}
203+
additional_bindings {
204+
post: "/v1/{model=publishers/*/models/*}:streamGenerateContent"
205+
body: "*"
206+
}
191207
};
192208
option (google.api.method_signature) = "model,contents";
193209
}
@@ -727,7 +743,9 @@ message GenerateContentResponse {
727743

728744
// Usage metadata about response(s).
729745
message UsageMetadata {
730-
// Number of tokens in the request.
746+
// Number of tokens in the request. When `cached_content` is set, this is
747+
// still the total effective prompt size meaning this includes the number of
748+
// tokens in the cached content.
731749
int32 prompt_token_count = 1;
732750

733751
// Number of tokens in the response(s).

0 commit comments

Comments
 (0)