Debian Codegraph @

googleapis/cloud/ml/v1/prediction_service.pb.go

raw
1 // Copyright 2017 Google Inc.
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. DO NOT EDIT.
16 // versions:
17 // protoc-gen-go v1.26.0
18 // protoc v3.12.2
19 // source: google/cloud/ml/v1/prediction_service.proto
20
21 package ml
22
23 import (
24 context "context"
25 reflect "reflect"
26 sync "sync"
27
28 _ "google.golang.org/genproto/googleapis/api/annotations"
29 httpbody "google.golang.org/genproto/googleapis/api/httpbody"
30 grpc "google.golang.org/grpc"
31 codes "google.golang.org/grpc/codes"
32 status "google.golang.org/grpc/status"
33 protoreflect "google.golang.org/protobuf/reflect/protoreflect"
34 protoimpl "google.golang.org/protobuf/runtime/protoimpl"
35 )
36
37 const (
38 // Verify that this generated code is sufficiently up-to-date.
39 _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
40 // Verify that runtime/protoimpl is sufficiently up-to-date.
41 _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
42 )
43
44 // Request for predictions to be issued against a trained model.
45 //
46 // The body of the request is a single JSON object with a single top-level
47 // field:
48 //
49 // <dl>
50 //
51 // <dt>instances</dt>
52 // <dd>A JSON array containing values representing the instances to use for
53 // prediction.</dd>
54 //
55 // </dl>
56 //
57 // The structure of each element of the instances list is determined by your
58 // model's input definition. Instances can include named inputs or can contain
59 // only unlabeled values.
60 //
61 // Not all data includes named inputs. Some instances will be simple
62 // JSON values (boolean, number, or string). However, instances are often lists
63 // of simple values, or complex nested lists. Here are some examples of request
64 // bodies:
65 //
66 // CSV data with each row encoded as a string value:
67 // <pre>
68 // {"instances": ["1.0,true,\\"x\\"", "-2.0,false,\\"y\\""]}
69 // </pre>
70 // Plain text:
71 // <pre>
72 // {"instances": ["the quick brown fox", "la bruja le dio"]}
73 // </pre>
74 // Sentences encoded as lists of words (vectors of strings):
75 // <pre>
76 //
77 // {
78 // "instances": [
79 // ["the","quick","brown"],
80 // ["la","bruja","le"],
81 // ...
82 // ]
83 // }
84 //
85 // </pre>
86 // Floating point scalar values:
87 // <pre>
88 // {"instances": [0.0, 1.1, 2.2]}
89 // </pre>
90 // Vectors of integers:
91 // <pre>
92 //
93 // {
94 // "instances": [
95 // [0, 1, 2],
96 // [3, 4, 5],
97 // ...
98 // ]
99 // }
100 //
101 // </pre>
102 // Tensors (in this case, two-dimensional tensors):
103 // <pre>
104 //
105 // {
106 // "instances": [
107 // [
108 // [0, 1, 2],
109 // [3, 4, 5]
110 // ],
111 // ...
112 // ]
113 // }
114 //
115 // </pre>
116 // Images can be represented different ways. In this encoding scheme the first
117 // two dimensions represent the rows and columns of the image, and the third
118 // contains lists (vectors) of the R, G, and B values for each pixel.
119 // <pre>
120 //
121 // {
122 // "instances": [
123 // [
124 // [
125 // [138, 30, 66],
126 // [130, 20, 56],
127 // ...
128 // ],
129 // [
130 // [126, 38, 61],
131 // [122, 24, 57],
132 // ...
133 // ],
134 // ...
135 // ],
136 // ...
137 // ]
138 // }
139 //
140 // </pre>
141 // JSON strings must be encoded as UTF-8. To send binary data, you must
142 // base64-encode the data and mark it as binary. To mark a JSON string
143 // as binary, replace it with a JSON object with a single attribute named `b64`:
144 // <pre>{"b64": "..."} </pre>
145 // For example:
146 //
147 // Two Serialized tf.Examples (fake data, for illustrative purposes only):
148 // <pre>
149 // {"instances": [{"b64": "X5ad6u"}, {"b64": "IA9j4nx"}]}
150 // </pre>
151 // Two JPEG image byte strings (fake data, for illustrative purposes only):
152 // <pre>
153 // {"instances": [{"b64": "ASa8asdf"}, {"b64": "JLK7ljk3"}]}
154 // </pre>
155 // If your data includes named references, format each instance as a JSON object
156 // with the named references as the keys:
157 //
158 // JSON input data to be preprocessed:
159 // <pre>
160 //
161 // {
162 // "instances": [
163 // {
164 // "a": 1.0,
165 // "b": true,
166 // "c": "x"
167 // },
168 // {
169 // "a": -2.0,
170 // "b": false,
171 // "c": "y"
172 // }
173 // ]
174 // }
175 //
176 // </pre>
177 // Some models have an underlying TensorFlow graph that accepts multiple input
178 // tensors. In this case, you should use the names of JSON name/value pairs to
179 // identify the input tensors, as shown in the following exmaples:
180 //
181 // For a graph with input tensor aliases "tag" (string) and "image"
182 // (base64-encoded string):
183 // <pre>
184 //
185 // {
186 // "instances": [
187 // {
188 // "tag": "beach",
189 // "image": {"b64": "ASa8asdf"}
190 // },
191 // {
192 // "tag": "car",
193 // "image": {"b64": "JLK7ljk3"}
194 // }
195 // ]
196 // }
197 //
198 // </pre>
199 // For a graph with input tensor aliases "tag" (string) and "image"
200 // (3-dimensional array of 8-bit ints):
201 // <pre>
202 //
203 // {
204 // "instances": [
205 // {
206 // "tag": "beach",
207 // "image": [
208 // [
209 // [138, 30, 66],
210 // [130, 20, 56],
211 // ...
212 // ],
213 // [
214 // [126, 38, 61],
215 // [122, 24, 57],
216 // ...
217 // ],
218 // ...
219 // ]
220 // },
221 // {
222 // "tag": "car",
223 // "image": [
224 // [
225 // [255, 0, 102],
226 // [255, 0, 97],
227 // ...
228 // ],
229 // [
230 // [254, 1, 101],
231 // [254, 2, 93],
232 // ...
233 // ],
234 // ...
235 // ]
236 // },
237 // ...
238 // ]
239 // }
240 //
241 // </pre>
242 // If the call is successful, the response body will contain one prediction
243 // entry per instance in the request body. If prediction fails for any
244 // instance, the response body will contain no predictions and will contian
245 // a single error entry instead.
246 type PredictRequest struct {
247 state protoimpl.MessageState
248 sizeCache protoimpl.SizeCache
249 unknownFields protoimpl.UnknownFields
250
251 // Required. The resource name of a model or a version.
252 //
253 // Authorization: requires `Viewer` role on the parent project.
254 Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
255 //
256 // Required. The prediction request body.
257 HttpBody *httpbody.HttpBody `protobuf:"bytes,2,opt,name=http_body,json=httpBody,proto3" json:"http_body,omitempty"`
258 }
259
260 func (x *PredictRequest) Reset() {
261 *x = PredictRequest{}
262 if protoimpl.UnsafeEnabled {
263 mi := &file_google_cloud_ml_v1_prediction_service_proto_msgTypes[0]
264 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
265 ms.StoreMessageInfo(mi)
266 }
267 }
268
269 func (x *PredictRequest) String() string {
270 return protoimpl.X.MessageStringOf(x)
271 }
272
273 func (*PredictRequest) ProtoMessage() {}
274
275 func (x *PredictRequest) ProtoReflect() protoreflect.Message {
276 mi := &file_google_cloud_ml_v1_prediction_service_proto_msgTypes[0]
277 if protoimpl.UnsafeEnabled && x != nil {
278 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
279 if ms.LoadMessageInfo() == nil {
280 ms.StoreMessageInfo(mi)
281 }
282 return ms
283 }
284 return mi.MessageOf(x)
285 }
286
287 // Deprecated: Use PredictRequest.ProtoReflect.Descriptor instead.
288 func (*PredictRequest) Descriptor() ([]byte, []int) {
289 return file_google_cloud_ml_v1_prediction_service_proto_rawDescGZIP(), []int{0}
290 }
291
292 func (x *PredictRequest) GetName() string {
293 if x != nil {
294 return x.Name
295 }
296 return ""
297 }
298
299 func (x *PredictRequest) GetHttpBody() *httpbody.HttpBody {
300 if x != nil {
301 return x.HttpBody
302 }
303 return nil
304 }
305
306 var File_google_cloud_ml_v1_prediction_service_proto protoreflect.FileDescriptor
307
308 var file_google_cloud_ml_v1_prediction_service_proto_rawDesc = []byte{
309 0x0a, 0x2b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6d,
310 0x6c, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
311 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x67,
312 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x6d, 0x6c, 0x2e, 0x76,
313 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e,
314 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
315 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, 0x74, 0x70,
316 0x62, 0x6f, 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0e, 0x50, 0x72,
317 0x65, 0x64, 0x69, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04,
318 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
319 0x12, 0x31, 0x0a, 0x09, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20,
320 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69,
321 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x08, 0x68, 0x74, 0x74, 0x70, 0x42,
322 0x6f, 0x64, 0x79, 0x32, 0x89, 0x01, 0x0a, 0x17, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x72,
323 0x65, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
324 0x6e, 0x0a, 0x07, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x12, 0x22, 0x2e, 0x67, 0x6f, 0x6f,
325 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2e, 0x6d, 0x6c, 0x2e, 0x76, 0x31, 0x2e,
326 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14,
327 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70,
328 0x42, 0x6f, 0x64, 0x79, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x1e, 0x2f, 0x76,
329 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73,
330 0x2f, 0x2a, 0x2a, 0x7d, 0x3a, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x3a, 0x01, 0x2a, 0x42,
331 0x6c, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6c,
332 0x6f, 0x75, 0x64, 0x2e, 0x6d, 0x6c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x16, 0x50,
333 0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
334 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
335 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x72,
336 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x63,
337 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6d, 0x6c, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6c, 0x62, 0x06, 0x70,
338 0x72, 0x6f, 0x74, 0x6f, 0x33,
339 }
340
341 var (
342 file_google_cloud_ml_v1_prediction_service_proto_rawDescOnce sync.Once
343 file_google_cloud_ml_v1_prediction_service_proto_rawDescData = file_google_cloud_ml_v1_prediction_service_proto_rawDesc
344 )
345
346 func file_google_cloud_ml_v1_prediction_service_proto_rawDescGZIP() []byte {
347 file_google_cloud_ml_v1_prediction_service_proto_rawDescOnce.Do(func() {
348 file_google_cloud_ml_v1_prediction_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_cloud_ml_v1_prediction_service_proto_rawDescData)
349 })
350 return file_google_cloud_ml_v1_prediction_service_proto_rawDescData
351 }
352
353 var file_google_cloud_ml_v1_prediction_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
354 var file_google_cloud_ml_v1_prediction_service_proto_goTypes = []interface{}{
355 (*PredictRequest)(nil), // 0: google.cloud.ml.v1.PredictRequest
356 (*httpbody.HttpBody)(nil), // 1: google.api.HttpBody
357 }
358 var file_google_cloud_ml_v1_prediction_service_proto_depIdxs = []int32{
359 1, // 0: google.cloud.ml.v1.PredictRequest.http_body:type_name -> google.api.HttpBody
360 0, // 1: google.cloud.ml.v1.OnlinePredictionService.Predict:input_type -> google.cloud.ml.v1.PredictRequest
361 1, // 2: google.cloud.ml.v1.OnlinePredictionService.Predict:output_type -> google.api.HttpBody
362 2, // [2:3] is the sub-list for method output_type
363 1, // [1:2] is the sub-list for method input_type
364 1, // [1:1] is the sub-list for extension type_name
365 1, // [1:1] is the sub-list for extension extendee
366 0, // [0:1] is the sub-list for field type_name
367 }
368
369 func init() { file_google_cloud_ml_v1_prediction_service_proto_init() }
370 func file_google_cloud_ml_v1_prediction_service_proto_init() {
371 if File_google_cloud_ml_v1_prediction_service_proto != nil {
372 return
373 }
374 if !protoimpl.UnsafeEnabled {
375 file_google_cloud_ml_v1_prediction_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
376 switch v := v.(*PredictRequest); i {
377 case 0:
378 return &v.state
379 case 1:
380 return &v.sizeCache
381 case 2:
382 return &v.unknownFields
383 default:
384 return nil
385 }
386 }
387 }
388 type x struct{}
389 out := protoimpl.TypeBuilder{
390 File: protoimpl.DescBuilder{
391 GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
392 RawDescriptor: file_google_cloud_ml_v1_prediction_service_proto_rawDesc,
393 NumEnums: 0,
394 NumMessages: 1,
395 NumExtensions: 0,
396 NumServices: 1,
397 },
398 GoTypes: file_google_cloud_ml_v1_prediction_service_proto_goTypes,
399 DependencyIndexes: file_google_cloud_ml_v1_prediction_service_proto_depIdxs,
400 MessageInfos: file_google_cloud_ml_v1_prediction_service_proto_msgTypes,
401 }.Build()
402 File_google_cloud_ml_v1_prediction_service_proto = out.File
403 file_google_cloud_ml_v1_prediction_service_proto_rawDesc = nil
404 file_google_cloud_ml_v1_prediction_service_proto_goTypes = nil
405 file_google_cloud_ml_v1_prediction_service_proto_depIdxs = nil
406 }
407
408 // Reference imports to suppress errors if they are not otherwise used.
409 var _ context.Context
410 var _ grpc.ClientConnInterface
411
412 // This is a compile-time assertion to ensure that this generated file
413 // is compatible with the grpc package it is being compiled against.
414 const _ = grpc.SupportPackageIsVersion6
415
416 // OnlinePredictionServiceClient is the client API for OnlinePredictionService service.
417 //
418 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
419 type OnlinePredictionServiceClient interface {
420 // Performs prediction on the data in the request.
421 //
422 // **** REMOVE FROM GENERATED DOCUMENTATION
423 Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
424 }
425
426 type onlinePredictionServiceClient struct {
427 cc grpc.ClientConnInterface
428 }
429
430 func NewOnlinePredictionServiceClient(cc grpc.ClientConnInterface) OnlinePredictionServiceClient {
431 return &onlinePredictionServiceClient{cc}
432 }
433
434 func (c *onlinePredictionServiceClient) Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) {
435 out := new(httpbody.HttpBody)
436 err := c.cc.Invoke(ctx, "/google.cloud.ml.v1.OnlinePredictionService/Predict", in, out, opts...)
437 if err != nil {
438 return nil, err
439 }
440 return out, nil
441 }
442
443 // OnlinePredictionServiceServer is the server API for OnlinePredictionService service.
444 type OnlinePredictionServiceServer interface {
445 // Performs prediction on the data in the request.
446 //
447 // **** REMOVE FROM GENERATED DOCUMENTATION
448 Predict(context.Context, *PredictRequest) (*httpbody.HttpBody, error)
449 }
450
451 // UnimplementedOnlinePredictionServiceServer can be embedded to have forward compatible implementations.
452 type UnimplementedOnlinePredictionServiceServer struct {
453 }
454
455 func (*UnimplementedOnlinePredictionServiceServer) Predict(context.Context, *PredictRequest) (*httpbody.HttpBody, error) {
456 return nil, status.Errorf(codes.Unimplemented, "method Predict not implemented")
457 }
458
459 func RegisterOnlinePredictionServiceServer(s *grpc.Server, srv OnlinePredictionServiceServer) {
460 s.RegisterService(&_OnlinePredictionService_serviceDesc, srv)
461 }
462
463 func _OnlinePredictionService_Predict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
464 in := new(PredictRequest)
465 if err := dec(in); err != nil {
466 return nil, err
467 }
468 if interceptor == nil {
469 return srv.(OnlinePredictionServiceServer).Predict(ctx, in)
470 }
471 info := &grpc.UnaryServerInfo{
472 Server: srv,
473 FullMethod: "/google.cloud.ml.v1.OnlinePredictionService/Predict",
474 }
475 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
476 return srv.(OnlinePredictionServiceServer).Predict(ctx, req.(*PredictRequest))
477 }
478 return interceptor(ctx, in, info, handler)
479 }
480
481 var _OnlinePredictionService_serviceDesc = grpc.ServiceDesc{
482 ServiceName: "google.cloud.ml.v1.OnlinePredictionService",
483 HandlerType: (*OnlinePredictionServiceServer)(nil),
484 Methods: []grpc.MethodDesc{
485 {
486 MethodName: "Predict",
487 Handler: _OnlinePredictionService_Predict_Handler,
488 },
489 },
490 Streams: []grpc.StreamDesc{},
491 Metadata: "google/cloud/ml/v1/prediction_service.proto",
492 }