Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterMLModelServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterMLModelServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MLModelServiceClient) error
- func RegisterMLModelServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterMLModelServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MLModelServiceServer) error
- func RegisterMLModelServiceServer(s grpc.ServiceRegistrar, srv MLModelServiceServer)
- type File
- type InferRequest
- func (*InferRequest) Descriptor() ([]byte, []int)deprecated
- func (x *InferRequest) GetInputData() *structpb.Struct
- func (x *InferRequest) GetName() string
- func (*InferRequest) ProtoMessage()
- func (x *InferRequest) ProtoReflect() protoreflect.Message
- func (x *InferRequest) Reset()
- func (x *InferRequest) String() string
- type InferResponse
- type LabelType
- type MLModelServiceClient
- type MLModelServiceServer
- type Metadata
- func (*Metadata) Descriptor() ([]byte, []int)deprecated
- func (x *Metadata) GetDescription() string
- func (x *Metadata) GetInputInfo() []*TensorInfo
- func (x *Metadata) GetName() string
- func (x *Metadata) GetOutputInfo() []*TensorInfo
- func (x *Metadata) GetType() string
- func (*Metadata) ProtoMessage()
- func (x *Metadata) ProtoReflect() protoreflect.Message
- func (x *Metadata) Reset()
- func (x *Metadata) String() string
- type MetadataRequest
- type MetadataResponse
- type TensorInfo
- func (*TensorInfo) Descriptor() ([]byte, []int)deprecated
- func (x *TensorInfo) GetAssociatedFiles() []*File
- func (x *TensorInfo) GetDataType() string
- func (x *TensorInfo) GetDescription() string
- func (x *TensorInfo) GetExtra() *structpb.Struct
- func (x *TensorInfo) GetName() string
- func (x *TensorInfo) GetShape() []int32
- func (*TensorInfo) ProtoMessage()
- func (x *TensorInfo) ProtoReflect() protoreflect.Message
- func (x *TensorInfo) Reset()
- func (x *TensorInfo) String() string
- type UnimplementedMLModelServiceServer
- type UnsafeMLModelServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( LabelType_name = map[int32]string{ 0: "LABEL_TYPE_UNSPECIFIED", 1: "LABEL_TYPE_TENSOR_VALUE", 2: "LABEL_TYPE_TENSOR_AXIS", } LabelType_value = map[string]int32{ "LABEL_TYPE_UNSPECIFIED": 0, "LABEL_TYPE_TENSOR_VALUE": 1, "LABEL_TYPE_TENSOR_AXIS": 2, } )
Enum value maps for LabelType.
var File_service_mlmodel_v1_mlmodel_proto protoreflect.FileDescriptor
var MLModelService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "viam.service.mlmodel.v1.MLModelService", HandlerType: (*MLModelServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Infer", Handler: _MLModelService_Infer_Handler, }, { MethodName: "Metadata", Handler: _MLModelService_Metadata_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "service/mlmodel/v1/mlmodel.proto", }
MLModelService_ServiceDesc is the grpc.ServiceDesc for MLModelService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterMLModelServiceHandler ¶
func RegisterMLModelServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterMLModelServiceHandler registers the http handlers for service MLModelService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterMLModelServiceHandlerClient ¶
func RegisterMLModelServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MLModelServiceClient) error
RegisterMLModelServiceHandlerClient registers the http handlers for service MLModelService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MLModelServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MLModelServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MLModelServiceClient" to call the correct interceptors.
func RegisterMLModelServiceHandlerFromEndpoint ¶
func RegisterMLModelServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterMLModelServiceHandlerFromEndpoint is same as RegisterMLModelServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMLModelServiceHandlerServer ¶
func RegisterMLModelServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MLModelServiceServer) error
RegisterMLModelServiceHandlerServer registers the http handlers for service MLModelService to "mux". UnaryRPC :call MLModelServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMLModelServiceHandlerFromEndpoint instead.
func RegisterMLModelServiceServer ¶
func RegisterMLModelServiceServer(s grpc.ServiceRegistrar, srv MLModelServiceServer)
Types ¶
type File ¶
type File struct { // name of the file, with file extension Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // description of what the file contains Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // How to associate the arrays/tensors to the labels in the file LabelType LabelType `` /* 128-byte string literal not displayed */ // contains filtered or unexported fields }
func (*File) Descriptor
deprecated
func (*File) GetDescription ¶
func (*File) GetLabelType ¶
func (*File) ProtoMessage ¶
func (*File) ProtoMessage()
func (*File) ProtoReflect ¶
func (x *File) ProtoReflect() protoreflect.Message
type InferRequest ¶
type InferRequest struct { // name of the model service Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // this is a struct of input arrays/tensors as specified in the metadata InputData *structpb.Struct `protobuf:"bytes,2,opt,name=input_data,json=inputData,proto3" json:"input_data,omitempty"` // contains filtered or unexported fields }
func (*InferRequest) Descriptor
deprecated
func (*InferRequest) Descriptor() ([]byte, []int)
Deprecated: Use InferRequest.ProtoReflect.Descriptor instead.
func (*InferRequest) GetInputData ¶
func (x *InferRequest) GetInputData() *structpb.Struct
func (*InferRequest) GetName ¶
func (x *InferRequest) GetName() string
func (*InferRequest) ProtoMessage ¶
func (*InferRequest) ProtoMessage()
func (*InferRequest) ProtoReflect ¶
func (x *InferRequest) ProtoReflect() protoreflect.Message
func (*InferRequest) Reset ¶
func (x *InferRequest) Reset()
func (*InferRequest) String ¶
func (x *InferRequest) String() string
type InferResponse ¶
type InferResponse struct { // this is a struct of output arrays/tensors as specified in the metadata OutputData *structpb.Struct `protobuf:"bytes,2,opt,name=output_data,json=outputData,proto3" json:"output_data,omitempty"` // contains filtered or unexported fields }
func (*InferResponse) Descriptor
deprecated
func (*InferResponse) Descriptor() ([]byte, []int)
Deprecated: Use InferResponse.ProtoReflect.Descriptor instead.
func (*InferResponse) GetOutputData ¶
func (x *InferResponse) GetOutputData() *structpb.Struct
func (*InferResponse) ProtoMessage ¶
func (*InferResponse) ProtoMessage()
func (*InferResponse) ProtoReflect ¶
func (x *InferResponse) ProtoReflect() protoreflect.Message
func (*InferResponse) Reset ¶
func (x *InferResponse) Reset()
func (*InferResponse) String ¶
func (x *InferResponse) String() string
type LabelType ¶
type LabelType int32
func (LabelType) Descriptor ¶
func (LabelType) Descriptor() protoreflect.EnumDescriptor
func (LabelType) EnumDescriptor
deprecated
func (LabelType) Number ¶
func (x LabelType) Number() protoreflect.EnumNumber
func (LabelType) Type ¶
func (LabelType) Type() protoreflect.EnumType
type MLModelServiceClient ¶
type MLModelServiceClient interface { // Infer takes an already ordered input tensor as a map, makes an inference on the model, and returns an output data map. Infer(ctx context.Context, in *InferRequest, opts ...grpc.CallOption) (*InferResponse, error) // Metadata returns the metadata associated with the ML model. Metadata(ctx context.Context, in *MetadataRequest, opts ...grpc.CallOption) (*MetadataResponse, error) }
MLModelServiceClient is the client API for MLModelService service.
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.
func NewMLModelServiceClient ¶
func NewMLModelServiceClient(cc grpc.ClientConnInterface) MLModelServiceClient
type MLModelServiceServer ¶
type MLModelServiceServer interface { // Infer takes an already ordered input tensor as a map, makes an inference on the model, and returns an output data map. Infer(context.Context, *InferRequest) (*InferResponse, error) // Metadata returns the metadata associated with the ML model. Metadata(context.Context, *MetadataRequest) (*MetadataResponse, error) // contains filtered or unexported methods }
MLModelServiceServer is the server API for MLModelService service. All implementations must embed UnimplementedMLModelServiceServer for forward compatibility
type Metadata ¶
type Metadata struct { // name of the model Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // type of model e.g. object_detector, text_classifier Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // description of the model Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // the necessary input arrays/tensors for an inference, order matters InputInfo []*TensorInfo `protobuf:"bytes,4,rep,name=input_info,json=inputInfo,proto3" json:"input_info,omitempty"` // the output arrays/tensors of the model, order matters OutputInfo []*TensorInfo `protobuf:"bytes,5,rep,name=output_info,json=outputInfo,proto3" json:"output_info,omitempty"` // contains filtered or unexported fields }
func (*Metadata) Descriptor
deprecated
func (*Metadata) GetDescription ¶
func (*Metadata) GetInputInfo ¶
func (x *Metadata) GetInputInfo() []*TensorInfo
func (*Metadata) GetOutputInfo ¶
func (x *Metadata) GetOutputInfo() []*TensorInfo
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
func (*Metadata) ProtoReflect ¶
func (x *Metadata) ProtoReflect() protoreflect.Message
type MetadataRequest ¶
type MetadataRequest struct { // name of the model service Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*MetadataRequest) Descriptor
deprecated
func (*MetadataRequest) Descriptor() ([]byte, []int)
Deprecated: Use MetadataRequest.ProtoReflect.Descriptor instead.
func (*MetadataRequest) GetName ¶
func (x *MetadataRequest) GetName() string
func (*MetadataRequest) ProtoMessage ¶
func (*MetadataRequest) ProtoMessage()
func (*MetadataRequest) ProtoReflect ¶
func (x *MetadataRequest) ProtoReflect() protoreflect.Message
func (*MetadataRequest) Reset ¶
func (x *MetadataRequest) Reset()
func (*MetadataRequest) String ¶
func (x *MetadataRequest) String() string
type MetadataResponse ¶
type MetadataResponse struct { // this is the metadata associated with the ML model Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` // contains filtered or unexported fields }
func (*MetadataResponse) Descriptor
deprecated
func (*MetadataResponse) Descriptor() ([]byte, []int)
Deprecated: Use MetadataResponse.ProtoReflect.Descriptor instead.
func (*MetadataResponse) GetMetadata ¶
func (x *MetadataResponse) GetMetadata() *Metadata
func (*MetadataResponse) ProtoMessage ¶
func (*MetadataResponse) ProtoMessage()
func (*MetadataResponse) ProtoReflect ¶
func (x *MetadataResponse) ProtoReflect() protoreflect.Message
func (*MetadataResponse) Reset ¶
func (x *MetadataResponse) Reset()
func (*MetadataResponse) String ¶
func (x *MetadataResponse) String() string
type TensorInfo ¶
type TensorInfo struct { // name of the data in the array/tensor Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // description of the data in the array/tensor Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // data type of the array/tensor, e.g. float32, float64, uint8 DataType string `protobuf:"bytes,3,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"` // shape of the array/tensor (-1 for unknown) Shape []int32 `protobuf:"varint,4,rep,packed,name=shape,proto3" json:"shape,omitempty"` // files associated with the array/tensor, like for category labels AssociatedFiles []*File `protobuf:"bytes,5,rep,name=associated_files,json=associatedFiles,proto3" json:"associated_files,omitempty"` // anything else you want to say Extra *structpb.Struct `protobuf:"bytes,99,opt,name=extra,proto3" json:"extra,omitempty"` // contains filtered or unexported fields }
func (*TensorInfo) Descriptor
deprecated
func (*TensorInfo) Descriptor() ([]byte, []int)
Deprecated: Use TensorInfo.ProtoReflect.Descriptor instead.
func (*TensorInfo) GetAssociatedFiles ¶
func (x *TensorInfo) GetAssociatedFiles() []*File
func (*TensorInfo) GetDataType ¶
func (x *TensorInfo) GetDataType() string
func (*TensorInfo) GetDescription ¶
func (x *TensorInfo) GetDescription() string
func (*TensorInfo) GetExtra ¶
func (x *TensorInfo) GetExtra() *structpb.Struct
func (*TensorInfo) GetName ¶
func (x *TensorInfo) GetName() string
func (*TensorInfo) GetShape ¶ added in v0.1.109
func (x *TensorInfo) GetShape() []int32
func (*TensorInfo) ProtoMessage ¶
func (*TensorInfo) ProtoMessage()
func (*TensorInfo) ProtoReflect ¶
func (x *TensorInfo) ProtoReflect() protoreflect.Message
func (*TensorInfo) Reset ¶
func (x *TensorInfo) Reset()
func (*TensorInfo) String ¶
func (x *TensorInfo) String() string
type UnimplementedMLModelServiceServer ¶
type UnimplementedMLModelServiceServer struct { }
UnimplementedMLModelServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedMLModelServiceServer) Infer ¶
func (UnimplementedMLModelServiceServer) Infer(context.Context, *InferRequest) (*InferResponse, error)
func (UnimplementedMLModelServiceServer) Metadata ¶
func (UnimplementedMLModelServiceServer) Metadata(context.Context, *MetadataRequest) (*MetadataResponse, error)
type UnsafeMLModelServiceServer ¶
type UnsafeMLModelServiceServer interface {
// contains filtered or unexported methods
}
UnsafeMLModelServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MLModelServiceServer will result in compilation errors.