zeroshotv1

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package zeroshotv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ZeroShotService_Classify_FullMethodName = "/zeroshot.v1.ZeroShotService/Classify"
)

Variables

View Source
var File_zeroshot_v1_zeroshot_proto protoreflect.FileDescriptor
View Source
var ZeroShotService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "zeroshot.v1.ZeroShotService",
	HandlerType: (*ZeroShotServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Classify",
			Handler:    _ZeroShotService_Classify_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "zeroshot/v1/zeroshot.proto",
}

ZeroShotService_ServiceDesc is the grpc.ServiceDesc for ZeroShotService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterZeroShotServiceHandler

func RegisterZeroShotServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterZeroShotServiceHandler registers the http handlers for service ZeroShotService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterZeroShotServiceHandlerClient

func RegisterZeroShotServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ZeroShotServiceClient) error

RegisterZeroShotServiceHandlerClient registers the http handlers for service ZeroShotService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ZeroShotServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ZeroShotServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ZeroShotServiceClient" to call the correct interceptors.

func RegisterZeroShotServiceHandlerFromEndpoint

func RegisterZeroShotServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterZeroShotServiceHandlerFromEndpoint is same as RegisterZeroShotServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterZeroShotServiceHandlerServer

func RegisterZeroShotServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ZeroShotServiceServer) error

RegisterZeroShotServiceHandlerServer registers the http handlers for service ZeroShotService to "mux". UnaryRPC :call ZeroShotServiceServer 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 RegisterZeroShotServiceHandlerFromEndpoint instead.

func RegisterZeroShotServiceServer

func RegisterZeroShotServiceServer(s grpc.ServiceRegistrar, srv ZeroShotServiceServer)

Types

type ClassifyRequest

type ClassifyRequest struct {
	Input      string              `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"`
	Parameters *ZeroShotParameters `protobuf:"bytes,2,opt,name=parameters,proto3" json:"parameters,omitempty"`
	// contains filtered or unexported fields
}

func (*ClassifyRequest) Descriptor deprecated

func (*ClassifyRequest) Descriptor() ([]byte, []int)

Deprecated: Use ClassifyRequest.ProtoReflect.Descriptor instead.

func (*ClassifyRequest) GetInput

func (x *ClassifyRequest) GetInput() string

func (*ClassifyRequest) GetParameters

func (x *ClassifyRequest) GetParameters() *ZeroShotParameters

func (*ClassifyRequest) ProtoMessage

func (*ClassifyRequest) ProtoMessage()

func (*ClassifyRequest) ProtoReflect

func (x *ClassifyRequest) ProtoReflect() protoreflect.Message

func (*ClassifyRequest) Reset

func (x *ClassifyRequest) Reset()

func (*ClassifyRequest) String

func (x *ClassifyRequest) String() string

type ClassifyResponse

type ClassifyResponse struct {

	// TODO: string sequence = ...; ?
	Labels []string  `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"`
	Scores []float64 `protobuf:"fixed64,2,rep,packed,name=scores,proto3" json:"scores,omitempty"`
	// contains filtered or unexported fields
}

func (*ClassifyResponse) Descriptor deprecated

func (*ClassifyResponse) Descriptor() ([]byte, []int)

Deprecated: Use ClassifyResponse.ProtoReflect.Descriptor instead.

func (*ClassifyResponse) GetLabels

func (x *ClassifyResponse) GetLabels() []string

func (*ClassifyResponse) GetScores

func (x *ClassifyResponse) GetScores() []float64

func (*ClassifyResponse) ProtoMessage

func (*ClassifyResponse) ProtoMessage()

func (*ClassifyResponse) ProtoReflect

func (x *ClassifyResponse) ProtoReflect() protoreflect.Message

func (*ClassifyResponse) Reset

func (x *ClassifyResponse) Reset()

func (*ClassifyResponse) String

func (x *ClassifyResponse) String() string

type UnimplementedZeroShotServiceServer

type UnimplementedZeroShotServiceServer struct {
}

UnimplementedZeroShotServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedZeroShotServiceServer) Classify

type UnsafeZeroShotServiceServer

type UnsafeZeroShotServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeZeroShotServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ZeroShotServiceServer will result in compilation errors.

type ZeroShotParameters

type ZeroShotParameters struct {
	HypothesisTemplate string   `protobuf:"bytes,1,opt,name=hypothesis_template,json=hypothesisTemplate,proto3" json:"hypothesis_template,omitempty"`
	CandidateLabels    []string `protobuf:"bytes,2,rep,name=candidate_labels,json=candidateLabels,proto3" json:"candidate_labels,omitempty"`
	MultiLabel         bool     `protobuf:"varint,3,opt,name=multi_label,json=multiLabel,proto3" json:"multi_label,omitempty"`
	// contains filtered or unexported fields
}

func (*ZeroShotParameters) Descriptor deprecated

func (*ZeroShotParameters) Descriptor() ([]byte, []int)

Deprecated: Use ZeroShotParameters.ProtoReflect.Descriptor instead.

func (*ZeroShotParameters) GetCandidateLabels

func (x *ZeroShotParameters) GetCandidateLabels() []string

func (*ZeroShotParameters) GetHypothesisTemplate

func (x *ZeroShotParameters) GetHypothesisTemplate() string

func (*ZeroShotParameters) GetMultiLabel

func (x *ZeroShotParameters) GetMultiLabel() bool

func (*ZeroShotParameters) ProtoMessage

func (*ZeroShotParameters) ProtoMessage()

func (*ZeroShotParameters) ProtoReflect

func (x *ZeroShotParameters) ProtoReflect() protoreflect.Message

func (*ZeroShotParameters) Reset

func (x *ZeroShotParameters) Reset()

func (*ZeroShotParameters) String

func (x *ZeroShotParameters) String() string

type ZeroShotServiceClient

type ZeroShotServiceClient interface {
	Classify(ctx context.Context, in *ClassifyRequest, opts ...grpc.CallOption) (*ClassifyResponse, error)
}

ZeroShotServiceClient is the client API for ZeroShotService 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.

type ZeroShotServiceServer

type ZeroShotServiceServer interface {
	Classify(context.Context, *ClassifyRequest) (*ClassifyResponse, error)
	// contains filtered or unexported methods
}

ZeroShotServiceServer is the server API for ZeroShotService service. All implementations must embed UnimplementedZeroShotServiceServer for forward compatibility

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL