| 1 |
// Copyright 2025 Google LLC |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. |
| 16 |
// versions: |
| 17 |
// - protoc-gen-go-grpc v1.3.0 |
| 18 |
// - protoc v4.25.7 |
| 19 |
// source: google/cloud/automl/v1beta1/prediction_service.proto |
| 20 |
|
| 21 |
package automlpb |
| 22 |
|
| 23 |
import ( |
| 24 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 25 |
context "context" |
| 26 |
grpc "google.golang.org/grpc" |
| 27 |
codes "google.golang.org/grpc/codes" |
| 28 |
status "google.golang.org/grpc/status" |
| 29 |
) |
| 30 |
|
| 31 |
// This is a compile-time assertion to ensure that this generated file |
| 32 |
// is compatible with the grpc package it is being compiled against. |
| 33 |
// Requires gRPC-Go v1.32.0 or later. |
| 34 |
const _ = grpc.SupportPackageIsVersion7 |
| 35 |
|
| 36 |
const ( |
| 37 |
PredictionService_Predict_FullMethodName = "/google.cloud.automl.v1beta1.PredictionService/Predict" |
| 38 |
PredictionService_BatchPredict_FullMethodName = "/google.cloud.automl.v1beta1.PredictionService/BatchPredict" |
| 39 |
) |
| 40 |
|
| 41 |
// PredictionServiceClient is the client API for PredictionService service. |
| 42 |
// |
| 43 |
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. |
| 44 |
type PredictionServiceClient interface { |
| 45 |
// Perform an online prediction. The prediction result will be directly |
| 46 |
// returned in the response. |
| 47 |
// Available for following ML problems, and their expected request payloads: |
| 48 |
// - Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes |
| 49 |
// up to 30MB. |
| 50 |
// - Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes |
| 51 |
// up to 30MB. |
| 52 |
// - Text Classification - TextSnippet, content up to 60,000 characters, |
| 53 |
// UTF-8 encoded. |
| 54 |
// - Text Extraction - TextSnippet, content up to 30,000 characters, |
| 55 |
// UTF-8 NFC encoded. |
| 56 |
// - Translation - TextSnippet, content up to 25,000 characters, UTF-8 |
| 57 |
// encoded. |
| 58 |
// - Tables - Row, with column values matching the columns of the model, |
| 59 |
// up to 5MB. Not available for FORECASTING |
| 60 |
// |
| 61 |
// [prediction_type][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type]. |
| 62 |
// - Text Sentiment - TextSnippet, content up 500 characters, UTF-8 |
| 63 |
// encoded. |
| 64 |
Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*PredictResponse, error) |
| 65 |
// Perform a batch prediction. Unlike the online [Predict][google.cloud.automl.v1beta1.PredictionService.Predict], batch |
| 66 |
// prediction result won't be immediately available in the response. Instead, |
| 67 |
// a long running operation object is returned. User can poll the operation |
| 68 |
// result via [GetOperation][google.longrunning.Operations.GetOperation] |
| 69 |
// method. Once the operation is done, [BatchPredictResult][google.cloud.automl.v1beta1.BatchPredictResult] is returned in |
| 70 |
// the [response][google.longrunning.Operation.response] field. |
| 71 |
// Available for following ML problems: |
| 72 |
// * Image Classification |
| 73 |
// * Image Object Detection |
| 74 |
// * Video Classification |
| 75 |
// * Video Object Tracking * Text Extraction |
| 76 |
// * Tables |
| 77 |
BatchPredict(ctx context.Context, in *BatchPredictRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) |
| 78 |
} |
| 79 |
|
| 80 |
type predictionServiceClient struct { |
| 81 |
cc grpc.ClientConnInterface |
| 82 |
} |
| 83 |
|
| 84 |
func NewPredictionServiceClient(cc grpc.ClientConnInterface) PredictionServiceClient { |
| 85 |
return &predictionServiceClient{cc} |
| 86 |
} |
| 87 |
|
| 88 |
func (c *predictionServiceClient) Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*PredictResponse, error) { |
| 89 |
out := new(PredictResponse) |
| 90 |
err := c.cc.Invoke(ctx, PredictionService_Predict_FullMethodName, in, out, opts...) |
| 91 |
if err != nil { |
| 92 |
return nil, err |
| 93 |
} |
| 94 |
return out, nil |
| 95 |
} |
| 96 |
|
| 97 |
func (c *predictionServiceClient) BatchPredict(ctx context.Context, in *BatchPredictRequest, opts ...grpc.CallOption) (*longrunningpb.Operation, error) { |
| 98 |
out := new(longrunningpb.Operation) |
| 99 |
err := c.cc.Invoke(ctx, PredictionService_BatchPredict_FullMethodName, in, out, opts...) |
| 100 |
if err != nil { |
| 101 |
return nil, err |
| 102 |
} |
| 103 |
return out, nil |
| 104 |
} |
| 105 |
|
| 106 |
// PredictionServiceServer is the server API for PredictionService service. |
| 107 |
// All implementations should embed UnimplementedPredictionServiceServer |
| 108 |
// for forward compatibility |
| 109 |
type PredictionServiceServer interface { |
| 110 |
// Perform an online prediction. The prediction result will be directly |
| 111 |
// returned in the response. |
| 112 |
// Available for following ML problems, and their expected request payloads: |
| 113 |
// - Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes |
| 114 |
// up to 30MB. |
| 115 |
// - Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes |
| 116 |
// up to 30MB. |
| 117 |
// - Text Classification - TextSnippet, content up to 60,000 characters, |
| 118 |
// UTF-8 encoded. |
| 119 |
// - Text Extraction - TextSnippet, content up to 30,000 characters, |
| 120 |
// UTF-8 NFC encoded. |
| 121 |
// - Translation - TextSnippet, content up to 25,000 characters, UTF-8 |
| 122 |
// encoded. |
| 123 |
// - Tables - Row, with column values matching the columns of the model, |
| 124 |
// up to 5MB. Not available for FORECASTING |
| 125 |
// |
| 126 |
// [prediction_type][google.cloud.automl.v1beta1.TablesModelMetadata.prediction_type]. |
| 127 |
// - Text Sentiment - TextSnippet, content up 500 characters, UTF-8 |
| 128 |
// encoded. |
| 129 |
Predict(context.Context, *PredictRequest) (*PredictResponse, error) |
| 130 |
// Perform a batch prediction. Unlike the online [Predict][google.cloud.automl.v1beta1.PredictionService.Predict], batch |
| 131 |
// prediction result won't be immediately available in the response. Instead, |
| 132 |
// a long running operation object is returned. User can poll the operation |
| 133 |
// result via [GetOperation][google.longrunning.Operations.GetOperation] |
| 134 |
// method. Once the operation is done, [BatchPredictResult][google.cloud.automl.v1beta1.BatchPredictResult] is returned in |
| 135 |
// the [response][google.longrunning.Operation.response] field. |
| 136 |
// Available for following ML problems: |
| 137 |
// * Image Classification |
| 138 |
// * Image Object Detection |
| 139 |
// * Video Classification |
| 140 |
// * Video Object Tracking * Text Extraction |
| 141 |
// * Tables |
| 142 |
BatchPredict(context.Context, *BatchPredictRequest) (*longrunningpb.Operation, error) |
| 143 |
} |
| 144 |
|
| 145 |
// UnimplementedPredictionServiceServer should be embedded to have forward compatible implementations. |
| 146 |
type UnimplementedPredictionServiceServer struct { |
| 147 |
} |
| 148 |
|
| 149 |
func (UnimplementedPredictionServiceServer) Predict(context.Context, *PredictRequest) (*PredictResponse, error) { |
| 150 |
return nil, status.Errorf(codes.Unimplemented, "method Predict not implemented") |
| 151 |
} |
| 152 |
func (UnimplementedPredictionServiceServer) BatchPredict(context.Context, *BatchPredictRequest) (*longrunningpb.Operation, error) { |
| 153 |
return nil, status.Errorf(codes.Unimplemented, "method BatchPredict not implemented") |
| 154 |
} |
| 155 |
|
| 156 |
// UnsafePredictionServiceServer may be embedded to opt out of forward compatibility for this service. |
| 157 |
// Use of this interface is not recommended, as added methods to PredictionServiceServer will |
| 158 |
// result in compilation errors. |
| 159 |
type UnsafePredictionServiceServer interface { |
| 160 |
mustEmbedUnimplementedPredictionServiceServer() |
| 161 |
} |
| 162 |
|
| 163 |
func RegisterPredictionServiceServer(s grpc.ServiceRegistrar, srv PredictionServiceServer) { |
| 164 |
s.RegisterService(&PredictionService_ServiceDesc, srv) |
| 165 |
} |
| 166 |
|
| 167 |
func _PredictionService_Predict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
| 168 |
in := new(PredictRequest) |
| 169 |
if err := dec(in); err != nil { |
| 170 |
return nil, err |
| 171 |
} |
| 172 |
if interceptor == nil { |
| 173 |
return srv.(PredictionServiceServer).Predict(ctx, in) |
| 174 |
} |
| 175 |
info := &grpc.UnaryServerInfo{ |
| 176 |
Server: srv, |
| 177 |
FullMethod: PredictionService_Predict_FullMethodName, |
| 178 |
} |
| 179 |
handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
| 180 |
return srv.(PredictionServiceServer).Predict(ctx, req.(*PredictRequest)) |
| 181 |
} |
| 182 |
return interceptor(ctx, in, info, handler) |
| 183 |
} |
| 184 |
|
| 185 |
func _PredictionService_BatchPredict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { |
| 186 |
in := new(BatchPredictRequest) |
| 187 |
if err := dec(in); err != nil { |
| 188 |
return nil, err |
| 189 |
} |
| 190 |
if interceptor == nil { |
| 191 |
return srv.(PredictionServiceServer).BatchPredict(ctx, in) |
| 192 |
} |
| 193 |
info := &grpc.UnaryServerInfo{ |
| 194 |
Server: srv, |
| 195 |
FullMethod: PredictionService_BatchPredict_FullMethodName, |
| 196 |
} |
| 197 |
handler := func(ctx context.Context, req interface{}) (interface{}, error) { |
| 198 |
return srv.(PredictionServiceServer).BatchPredict(ctx, req.(*BatchPredictRequest)) |
| 199 |
} |
| 200 |
return interceptor(ctx, in, info, handler) |
| 201 |
} |
| 202 |
|
| 203 |
// PredictionService_ServiceDesc is the grpc.ServiceDesc for PredictionService service. |
| 204 |
// It's only intended for direct use with grpc.RegisterService, |
| 205 |
// and not to be introspected or modified (even as a copy) |
| 206 |
var PredictionService_ServiceDesc = grpc.ServiceDesc{ |
| 207 |
ServiceName: "google.cloud.automl.v1beta1.PredictionService", |
| 208 |
HandlerType: (*PredictionServiceServer)(nil), |
| 209 |
Methods: []grpc.MethodDesc{ |
| 210 |
{ |
| 211 |
MethodName: "Predict", |
| 212 |
Handler: _PredictionService_Predict_Handler, |
| 213 |
}, |
| 214 |
{ |
| 215 |
MethodName: "BatchPredict", |
| 216 |
Handler: _PredictionService_BatchPredict_Handler, |
| 217 |
}, |
| 218 |
}, |
| 219 |
Streams: []grpc.StreamDesc{}, |
| 220 |
Metadata: "google/cloud/automl/v1beta1/prediction_service.proto", |
| 221 |
} |