Skip to content

Commit

Permalink
feat: Add generateContent Unary API for aiplatform_v1
Browse files Browse the repository at this point in the history
docs: Update comment for DirectPredict and DirectRawPredict

PiperOrigin-RevId: 603498510
  • Loading branch information
Google APIs authored and Copybara-Service committed Feb 1, 2024
1 parent 0d3e2ea commit 49815f4
Showing 1 changed file with 138 additions and 3 deletions.
141 changes: 138 additions & 3 deletions google/cloud/aiplatform/v1/prediction_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,31 @@ service PredictionService {
option (google.api.method_signature) = "endpoint,http_body";
}

// Perform an unary online prediction request for Vertex first-party products
// and frameworks.
// Perform a streaming online prediction with an arbitrary HTTP payload.
rpc StreamRawPredict(StreamRawPredictRequest)
returns (stream google.api.HttpBody) {
option (google.api.http) = {
post: "/v1/{endpoint=projects/*/locations/*/endpoints/*}:streamRawPredict"
body: "*"
additional_bindings {
post: "/v1/{endpoint=projects/*/locations/*/publishers/*/models/*}:streamRawPredict"
body: "*"
}
};
option (google.api.method_signature) = "endpoint,http_body";
}

// Perform an unary online prediction request to a gRPC model server for
// Vertex first-party products and frameworks.
rpc DirectPredict(DirectPredictRequest) returns (DirectPredictResponse) {
option (google.api.http) = {
post: "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directPredict"
body: "*"
};
}

// Perform an online prediction request through gRPC.
// Perform an unary online prediction request to a gRPC model server for
// custom containers.
rpc DirectRawPredict(DirectRawPredictRequest)
returns (DirectRawPredictResponse) {
option (google.api.http) = {
Expand All @@ -95,6 +110,16 @@ service PredictionService {
};
}

// Perform a streaming online prediction request to a gRPC model server for
// Vertex first-party products and frameworks.
rpc StreamDirectPredict(stream StreamDirectPredictRequest)
returns (stream StreamDirectPredictResponse) {}

// Perform a streaming online prediction request to a gRPC model server for
// custom containers.
rpc StreamDirectRawPredict(stream StreamDirectRawPredictRequest)
returns (stream StreamDirectRawPredictResponse) {}

// Perform a streaming online prediction request for Vertex first-party
// products and frameworks.
rpc StreamingPredict(stream StreamingPredictRequest)
Expand Down Expand Up @@ -138,6 +163,20 @@ service PredictionService {
"endpoint,instances,parameters,deployed_model_id";
}

// Generate content with multimodal inputs.
rpc GenerateContent(GenerateContentRequest)
returns (GenerateContentResponse) {
option (google.api.http) = {
post: "/v1/{model=projects/*/locations/*/endpoints/*}:generateContent"
body: "*"
additional_bindings {
post: "/v1/{model=projects/*/locations/*/publishers/*/models/*}:generateContent"
body: "*"
}
};
option (google.api.method_signature) = "model,contents";
}

// Generate content with multimodal inputs with streaming support.
rpc StreamGenerateContent(GenerateContentRequest)
returns (stream GenerateContentResponse) {
Expand Down Expand Up @@ -254,6 +293,23 @@ message RawPredictRequest {
google.api.HttpBody http_body = 2;
}

// Request message for
// [PredictionService.StreamRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamRawPredict].
message StreamRawPredictRequest {
// Required. The name of the Endpoint requested to serve the prediction.
// Format:
// `projects/{project}/locations/{location}/endpoints/{endpoint}`
string endpoint = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "aiplatform.googleapis.com/Endpoint"
}
];

// The prediction input. Supports HTTP headers and arbitrary data payload.
google.api.HttpBody http_body = 2;
}

// Request message for
// [PredictionService.DirectPredict][google.cloud.aiplatform.v1.PredictionService.DirectPredict].
message DirectPredictRequest {
Expand Down Expand Up @@ -317,6 +373,85 @@ message DirectRawPredictResponse {
bytes output = 1;
}

// Request message for
// [PredictionService.StreamDirectPredict][google.cloud.aiplatform.v1.PredictionService.StreamDirectPredict].
//
// The first message must contain
// [endpoint][google.cloud.aiplatform.v1.StreamDirectPredictRequest.endpoint]
// field and optionally [input][]. The subsequent messages must contain
// [input][].
message StreamDirectPredictRequest {
// Required. The name of the Endpoint requested to serve the prediction.
// Format:
// `projects/{project}/locations/{location}/endpoints/{endpoint}`
string endpoint = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "aiplatform.googleapis.com/Endpoint"
}
];

// Optional. The prediction input.
repeated Tensor inputs = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. The parameters that govern the prediction.
Tensor parameters = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [PredictionService.StreamDirectPredict][google.cloud.aiplatform.v1.PredictionService.StreamDirectPredict].
message StreamDirectPredictResponse {
// The prediction output.
repeated Tensor outputs = 1;

// The parameters that govern the prediction.
Tensor parameters = 2;
}

// Request message for
// [PredictionService.StreamDirectRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamDirectRawPredict].
//
// The first message must contain
// [endpoint][google.cloud.aiplatform.v1.StreamDirectRawPredictRequest.endpoint]
// and
// [method_name][google.cloud.aiplatform.v1.StreamDirectRawPredictRequest.method_name]
// fields and optionally
// [input][google.cloud.aiplatform.v1.StreamDirectRawPredictRequest.input]. The
// subsequent messages must contain
// [input][google.cloud.aiplatform.v1.StreamDirectRawPredictRequest.input].
// [method_name][google.cloud.aiplatform.v1.StreamDirectRawPredictRequest.method_name]
// in the subsequent messages have no effect.
message StreamDirectRawPredictRequest {
// Required. The name of the Endpoint requested to serve the prediction.
// Format:
// `projects/{project}/locations/{location}/endpoints/{endpoint}`
string endpoint = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "aiplatform.googleapis.com/Endpoint"
}
];

// Optional. Fully qualified name of the API method being invoked to perform
// predictions.
//
// Format:
// `/namespace.Service/Method/`
// Example:
// `/tensorflow.serving.PredictionService/Predict`
string method_name = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. The prediction input.
bytes input = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for
// [PredictionService.StreamDirectRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamDirectRawPredict].
message StreamDirectRawPredictResponse {
// The prediction output.
bytes output = 1;
}

// Request message for
// [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict].
//
Expand Down

0 comments on commit 49815f4

Please sign in to comment.