// Copyright 2018 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
//
//     http://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.

syntax = "proto3";

package google.cloud.automl.v1beta1;

import "google/api/annotations.proto";
import "google/cloud/automl/v1beta1/annotation_payload.proto";
import "google/cloud/automl/v1beta1/data_items.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1beta1;automl";
option java_multiple_files = true;
option java_outer_classname = "PredictionServiceProto";
option java_package = "com.google.cloud.automl.v1beta1";
option php_namespace = "Google\\Cloud\\AutoMl\\V1beta1";


// AutoML Prediction API.
service PredictionService {
  // Perform a prediction.
  rpc Predict(PredictRequest) returns (PredictResponse) {
    option (google.api.http) = {
      post: "/v1beta1/{name=projects/*/locations/*/models/*}:predict"
      body: "*"
    };
  }
}

// Request message for [PredictionService.Predict][google.cloud.automl.v1beta1.PredictionService.Predict].
message PredictRequest {
  // Name of the model requested to serve the prediction.
  string name = 1;

  // Required.
  // Payload to perform a prediction on. The payload must match the
  // problem type that the model was trained to solve.
  ExamplePayload payload = 2;

  // Additional domain-specific parameters, any string must be up to 25000
  // characters long.
  //
  // *  For Image Classification:
  //
  //    `score_threshold` - (float) A value from 0.0 to 1.0. When the model
  //     makes predictions for an
  //     image, it will only produce results that have at least this confidence
  //     score threshold. The default is 0.5.
  map<string, string> params = 3;
}

// Response message for [PredictionService.Predict][google.cloud.automl.v1beta1.PredictionService.Predict].
//
// Currently, this is only
// used to return an image recognition prediction result. More prediction
// output metadata might be introduced in the future.
message PredictResponse {
  // Prediction result.
  repeated AnnotationPayload payload = 1;

  // Additional domain-specific prediction response metadata.
  map<string, string> metadata = 2;
}
