Skip to content

Commit

Permalink
feat: Allow v1 api calls for some dataset_service, llm_utility_servic…
Browse files Browse the repository at this point in the history
…e, and prediction_service apis without project and location

PiperOrigin-RevId: 660169876
  • Loading branch information
Google APIs authored and copybara-github committed Aug 7, 2024
1 parent dba0d79 commit 1f17bca
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
22 changes: 22 additions & 0 deletions google/cloud/aiplatform/v1/dataset_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ service DatasetService {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/*}/datasets"
body: "dataset"
additional_bindings { post: "/v1/datasets" body: "dataset" }
};
option (google.api.method_signature) = "parent,dataset";
option (google.longrunning.operation_info) = {
Expand All @@ -64,6 +65,7 @@ service DatasetService {
rpc GetDataset(GetDatasetRequest) returns (Dataset) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/datasets/*}"
additional_bindings { get: "/v1/{name=datasets/*}" }
};
option (google.api.method_signature) = "name";
}
Expand All @@ -73,6 +75,10 @@ service DatasetService {
option (google.api.http) = {
patch: "/v1/{dataset.name=projects/*/locations/*/datasets/*}"
body: "dataset"
additional_bindings {
patch: "/v1/{dataset.name=datasets/*}"
body: "dataset"
}
};
option (google.api.method_signature) = "dataset,update_mask";
}
Expand All @@ -81,6 +87,7 @@ service DatasetService {
rpc ListDatasets(ListDatasetsRequest) returns (ListDatasetsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/datasets"
additional_bindings { get: "/v1/datasets" }
};
option (google.api.method_signature) = "parent";
}
Expand All @@ -90,6 +97,7 @@ service DatasetService {
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/locations/*/datasets/*}"
additional_bindings { delete: "/v1/{name=datasets/*}" }
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
Expand Down Expand Up @@ -130,6 +138,10 @@ service DatasetService {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/*/datasets/*}/datasetVersions"
body: "dataset_version"
additional_bindings {
post: "/v1/{parent=datasets/*}/datasetVersions"
body: "dataset_version"
}
};
option (google.api.method_signature) = "parent,dataset_version";
option (google.longrunning.operation_info) = {
Expand All @@ -144,6 +156,10 @@ service DatasetService {
option (google.api.http) = {
patch: "/v1/{dataset_version.name=projects/*/locations/*/datasets/*/datasetVersions/*}"
body: "dataset_version"
additional_bindings {
patch: "/v1/{dataset_version.name=datasets/*/datasetVersions/*}"
body: "dataset_version"
}
};
option (google.api.method_signature) = "dataset_version,update_mask";
}
Expand All @@ -153,6 +169,7 @@ service DatasetService {
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/locations/*/datasets/*/datasetVersions/*}"
additional_bindings { delete: "/v1/{name=datasets/*/datasetVersions/*}" }
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
Expand All @@ -165,6 +182,7 @@ service DatasetService {
rpc GetDatasetVersion(GetDatasetVersionRequest) returns (DatasetVersion) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/datasets/*/datasetVersions/*}"
additional_bindings { get: "/v1/{name=datasets/*/datasetVersions/*}" }
};
option (google.api.method_signature) = "name";
}
Expand All @@ -174,6 +192,7 @@ service DatasetService {
returns (ListDatasetVersionsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*/datasets/*}/datasetVersions"
additional_bindings { get: "/v1/{parent=datasets/*}/datasetVersions" }
};
option (google.api.method_signature) = "parent";
}
Expand All @@ -183,6 +202,9 @@ service DatasetService {
returns (google.longrunning.Operation) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/datasets/*/datasetVersions/*}:restore"
additional_bindings {
get: "/v1/{name=datasets/*/datasetVersions/*}:restore"
}
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
Expand Down
16 changes: 16 additions & 0 deletions google/cloud/aiplatform/v1/llm_utility_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ service LlmUtilityService {
post: "/v1/{endpoint=projects/*/locations/*/publishers/*/models/*}:countTokens"
body: "*"
}
additional_bindings {
post: "/v1/{endpoint=endpoints/*}:countTokens"
body: "*"
}
additional_bindings {
post: "/v1/{endpoint=publishers/*/models/*}:countTokens"
body: "*"
}
};
option (google.api.method_signature) = "endpoint,instances";
}
Expand All @@ -60,6 +68,14 @@ service LlmUtilityService {
post: "/v1/{endpoint=projects/*/locations/*/publishers/*/models/*}:computeTokens"
body: "*"
}
additional_bindings {
post: "/v1/{endpoint=endpoints/*}:computeTokens"
body: "*"
}
additional_bindings {
post: "/v1/{endpoint=publishers/*/models/*}:computeTokens"
body: "*"
}
};
option (google.api.method_signature) = "endpoint,instances";
}
Expand Down
20 changes: 19 additions & 1 deletion google/cloud/aiplatform/v1/prediction_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ service PredictionService {
post: "/v1/{model=projects/*/locations/*/publishers/*/models/*}:generateContent"
body: "*"
}
additional_bindings {
post: "/v1/{model=endpoints/*}:generateContent"
body: "*"
}
additional_bindings {
post: "/v1/{model=publishers/*/models/*}:generateContent"
body: "*"
}
};
option (google.api.method_signature) = "model,contents";
}
Expand All @@ -188,6 +196,14 @@ service PredictionService {
post: "/v1/{model=projects/*/locations/*/publishers/*/models/*}:streamGenerateContent"
body: "*"
}
additional_bindings {
post: "/v1/{model=endpoints/*}:streamGenerateContent"
body: "*"
}
additional_bindings {
post: "/v1/{model=publishers/*/models/*}:streamGenerateContent"
body: "*"
}
};
option (google.api.method_signature) = "model,contents";
}
Expand Down Expand Up @@ -727,7 +743,9 @@ message GenerateContentResponse {

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

// Number of tokens in the response(s).
Expand Down

0 comments on commit 1f17bca

Please sign in to comment.