text2textv1

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package text2textv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_text2text_v1_text2text_proto protoreflect.FileDescriptor
View Source
var Text2TextService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "text2text.v1.Text2TextService",
	HandlerType: (*Text2TextServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Generate",
			Handler:    _Text2TextService_Generate_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "text2text/v1/text2text.proto",
}

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

Functions

func RegisterText2TextServiceHandler

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

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

func RegisterText2TextServiceHandlerClient

func RegisterText2TextServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client Text2TextServiceClient) error

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

func RegisterText2TextServiceHandlerFromEndpoint

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

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

func RegisterText2TextServiceHandlerServer

func RegisterText2TextServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server Text2TextServiceServer) error

RegisterText2TextServiceHandlerServer registers the http handlers for service Text2TextService to "mux". UnaryRPC :call Text2TextServiceServer 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 RegisterText2TextServiceHandlerFromEndpoint instead.

func RegisterText2TextServiceServer

func RegisterText2TextServiceServer(s grpc.ServiceRegistrar, srv Text2TextServiceServer)

Types

type GenerateRequest

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

func (*GenerateRequest) Descriptor deprecated

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

Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead.

func (*GenerateRequest) GetInput

func (x *GenerateRequest) GetInput() string

func (*GenerateRequest) GetParameters

func (x *GenerateRequest) GetParameters() *Text2TextParameters

func (*GenerateRequest) ProtoMessage

func (*GenerateRequest) ProtoMessage()

func (*GenerateRequest) ProtoReflect

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

func (*GenerateRequest) Reset

func (x *GenerateRequest) Reset()

func (*GenerateRequest) String

func (x *GenerateRequest) String() string

type GenerateResponse

type GenerateResponse struct {
	Texts  []string  `protobuf:"bytes,1,rep,name=texts,proto3" json:"texts,omitempty"`
	Scores []float64 `protobuf:"fixed64,2,rep,packed,name=scores,proto3" json:"scores,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateResponse) Descriptor deprecated

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

Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead.

func (*GenerateResponse) GetScores

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

func (*GenerateResponse) GetTexts

func (x *GenerateResponse) GetTexts() []string

func (*GenerateResponse) ProtoMessage

func (*GenerateResponse) ProtoMessage()

func (*GenerateResponse) ProtoReflect

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

func (*GenerateResponse) Reset

func (x *GenerateResponse) Reset()

func (*GenerateResponse) String

func (x *GenerateResponse) String() string

type Text2TextParameters

type Text2TextParameters struct {
	TopK        *int64   `protobuf:"varint,1,opt,name=top_k,json=topK,proto3,oneof" json:"top_k,omitempty"`
	TopP        *float64 `protobuf:"fixed64,2,opt,name=top_p,json=topP,proto3,oneof" json:"top_p,omitempty"`
	Temperature *float64 `protobuf:"fixed64,3,opt,name=temperature,proto3,oneof" json:"temperature,omitempty"`
	DoSample    *bool    `protobuf:"varint,4,opt,name=do_sample,json=doSample,proto3,oneof" json:"do_sample,omitempty"`
	// contains filtered or unexported fields
}

func (*Text2TextParameters) Descriptor deprecated

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

Deprecated: Use Text2TextParameters.ProtoReflect.Descriptor instead.

func (*Text2TextParameters) GetDoSample

func (x *Text2TextParameters) GetDoSample() bool

func (*Text2TextParameters) GetTemperature

func (x *Text2TextParameters) GetTemperature() float64

func (*Text2TextParameters) GetTopK

func (x *Text2TextParameters) GetTopK() int64

func (*Text2TextParameters) GetTopP

func (x *Text2TextParameters) GetTopP() float64

func (*Text2TextParameters) ProtoMessage

func (*Text2TextParameters) ProtoMessage()

func (*Text2TextParameters) ProtoReflect

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

func (*Text2TextParameters) Reset

func (x *Text2TextParameters) Reset()

func (*Text2TextParameters) String

func (x *Text2TextParameters) String() string

type Text2TextServiceClient

type Text2TextServiceClient interface {
	Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error)
}

Text2TextServiceClient is the client API for Text2TextService 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 Text2TextServiceServer

type Text2TextServiceServer interface {
	Generate(context.Context, *GenerateRequest) (*GenerateResponse, error)
	// contains filtered or unexported methods
}

Text2TextServiceServer is the server API for Text2TextService service. All implementations must embed UnimplementedText2TextServiceServer for forward compatibility

type UnimplementedText2TextServiceServer

type UnimplementedText2TextServiceServer struct {
}

UnimplementedText2TextServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedText2TextServiceServer) Generate

type UnsafeText2TextServiceServer

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

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

Jump to

Keyboard shortcuts

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