completion

package
v0.0.0-...-c27917d Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompletionService_Complete_FullMethodName = "/completion.CompletionService/Complete"
)
View Source
const (
	CompletionStreamService_CompleteStream_FullMethodName = "/completion.CompletionStreamService/CompleteStream"
)

Variables

View Source
var (
	CompletionFinishReason_name = map[int32]string{
		0: "STOP",
		1: "LENGTH",
	}
	CompletionFinishReason_value = map[string]int32{
		"STOP":   0,
		"LENGTH": 1,
	}
)

Enum value maps for CompletionFinishReason.

View Source
var CompletionService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "completion.CompletionService",
	HandlerType: (*CompletionServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Complete",
			Handler:    _CompletionService_Complete_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "completion/completion.proto",
}

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

View Source
var CompletionStreamService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "completion.CompletionStreamService",
	HandlerType: (*CompletionStreamServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "CompleteStream",
			Handler:       _CompletionStreamService_CompleteStream_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "completion/completion.proto",
}

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

View Source
var File_completion_completion_proto protoreflect.FileDescriptor

Functions

func RegisterCompletionServiceServer

func RegisterCompletionServiceServer(s grpc.ServiceRegistrar, srv CompletionServiceServer)

func RegisterCompletionStreamServiceServer

func RegisterCompletionStreamServiceServer(s grpc.ServiceRegistrar, srv CompletionStreamServiceServer)

Types

type CompletionChoice

type CompletionChoice struct {
	Text         string                 `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	Index        int32                  `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
	FinishReason CompletionFinishReason `` /* 137-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*CompletionChoice) Descriptor deprecated

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

Deprecated: Use CompletionChoice.ProtoReflect.Descriptor instead.

func (*CompletionChoice) GetFinishReason

func (x *CompletionChoice) GetFinishReason() CompletionFinishReason

func (*CompletionChoice) GetIndex

func (x *CompletionChoice) GetIndex() int32

func (*CompletionChoice) GetText

func (x *CompletionChoice) GetText() string

func (*CompletionChoice) ProtoMessage

func (*CompletionChoice) ProtoMessage()

func (*CompletionChoice) ProtoReflect

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

func (*CompletionChoice) Reset

func (x *CompletionChoice) Reset()

func (*CompletionChoice) String

func (x *CompletionChoice) String() string

type CompletionFinishReason

type CompletionFinishReason int32
const (
	CompletionFinishReason_STOP   CompletionFinishReason = 0
	CompletionFinishReason_LENGTH CompletionFinishReason = 1
)

func (CompletionFinishReason) Descriptor

func (CompletionFinishReason) Enum

func (CompletionFinishReason) EnumDescriptor deprecated

func (CompletionFinishReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use CompletionFinishReason.Descriptor instead.

func (CompletionFinishReason) Number

func (CompletionFinishReason) String

func (x CompletionFinishReason) String() string

func (CompletionFinishReason) Type

type CompletionRequest

type CompletionRequest struct {
	Prompt       string   `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"` // huggingface `inputs`
	Suffix       *string  `protobuf:"bytes,2,opt,name=suffix,proto3,oneof" json:"suffix,omitempty"`
	MaxNewTokens *int32   `protobuf:"varint,3,opt,name=max_new_tokens,json=maxNewTokens,proto3,oneof" json:"max_new_tokens,omitempty"` // openai `max_tokens`
	Temperature  *float32 `protobuf:"fixed32,4,opt,name=temperature,proto3,oneof" json:"temperature,omitempty"`
	TopK         *int32   `protobuf:"varint,5,opt,name=top_k,json=topK,proto3,oneof" json:"top_k,omitempty"`
	TopP         *float32 `protobuf:"fixed32,6,opt,name=top_p,json=topP,proto3,oneof" json:"top_p,omitempty"`
	DoSample     *bool    `protobuf:"varint,7,opt,name=do_sample,json=doSample,proto3,oneof" json:"do_sample,omitempty"`
	N            *int32   `protobuf:"varint,8,opt,name=n,proto3,oneof" json:"n,omitempty"`
	// Include the log probabilities on the logprobs most likely tokens, as
	// well the chosen tokens. For example, if logprobs is 5, the API will return
	// a list of the 5 most likely tokens. The API will always return the logprob
	// of the sampled token, so there may be up to logprobs+1 elements in the
	// response.
	//
	// The maximum value for logprobs is 5.
	Logprobs          *int32           `protobuf:"varint,9,opt,name=logprobs,proto3,oneof" json:"logprobs,omitempty"`
	Echo              *bool            `protobuf:"varint,10,opt,name=echo,proto3,oneof" json:"echo,omitempty"`
	Stop              []string         `protobuf:"bytes,11,rep,name=stop,proto3" json:"stop,omitempty"` // You can only represent Union[str, list] as a string.
	RepetitionPenalty *float32         `protobuf:"fixed32,12,opt,name=repetition_penalty,json=repetitionPenalty,proto3,oneof" json:"repetition_penalty,omitempty"`
	PresencePenalty   *float32         `protobuf:"fixed32,13,opt,name=presence_penalty,json=presencePenalty,proto3,oneof" json:"presence_penalty,omitempty"`
	FrequencePenalty  *float32         `protobuf:"fixed32,14,opt,name=frequence_penalty,json=frequencePenalty,proto3,oneof" json:"frequence_penalty,omitempty"`
	BestOf            *int32           `protobuf:"varint,15,opt,name=best_of,json=bestOf,proto3,oneof" json:"best_of,omitempty"`
	LogitBias         map[string]int32 `` // Maps are represented as a pair of a key type and a value type.
	/* 178-byte string literal not displayed */
	ReturnFullText *bool    `protobuf:"varint,17,opt,name=return_full_text,json=returnFullText,proto3,oneof" json:"return_full_text,omitempty"`
	Truncate       *int32   `protobuf:"varint,18,opt,name=truncate,proto3,oneof" json:"truncate,omitempty"`
	TypicalP       *float32 `protobuf:"fixed32,19,opt,name=typical_p,json=typicalP,proto3,oneof" json:"typical_p,omitempty"`
	Watermark      *bool    `protobuf:"varint,20,opt,name=watermark,proto3,oneof" json:"watermark,omitempty"`
	Seed           *int32   `protobuf:"varint,21,opt,name=seed,proto3,oneof" json:"seed,omitempty"`
	User           *string  `protobuf:"bytes,22,opt,name=user,proto3,oneof" json:"user,omitempty"`
	// contains filtered or unexported fields
}

CompletionRequest is the payload to request completion

func (*CompletionRequest) Descriptor deprecated

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

Deprecated: Use CompletionRequest.ProtoReflect.Descriptor instead.

func (*CompletionRequest) GetBestOf

func (x *CompletionRequest) GetBestOf() int32

func (*CompletionRequest) GetDoSample

func (x *CompletionRequest) GetDoSample() bool

func (*CompletionRequest) GetEcho

func (x *CompletionRequest) GetEcho() bool

func (*CompletionRequest) GetFrequencePenalty

func (x *CompletionRequest) GetFrequencePenalty() float32

func (*CompletionRequest) GetLogitBias

func (x *CompletionRequest) GetLogitBias() map[string]int32

func (*CompletionRequest) GetLogprobs

func (x *CompletionRequest) GetLogprobs() int32

func (*CompletionRequest) GetMaxNewTokens

func (x *CompletionRequest) GetMaxNewTokens() int32

func (*CompletionRequest) GetN

func (x *CompletionRequest) GetN() int32

func (*CompletionRequest) GetPresencePenalty

func (x *CompletionRequest) GetPresencePenalty() float32

func (*CompletionRequest) GetPrompt

func (x *CompletionRequest) GetPrompt() string

func (*CompletionRequest) GetRepetitionPenalty

func (x *CompletionRequest) GetRepetitionPenalty() float32

func (*CompletionRequest) GetReturnFullText

func (x *CompletionRequest) GetReturnFullText() bool

func (*CompletionRequest) GetSeed

func (x *CompletionRequest) GetSeed() int32

func (*CompletionRequest) GetStop

func (x *CompletionRequest) GetStop() []string

func (*CompletionRequest) GetSuffix

func (x *CompletionRequest) GetSuffix() string

func (*CompletionRequest) GetTemperature

func (x *CompletionRequest) GetTemperature() float32

func (*CompletionRequest) GetTopK

func (x *CompletionRequest) GetTopK() int32

func (*CompletionRequest) GetTopP

func (x *CompletionRequest) GetTopP() float32

func (*CompletionRequest) GetTruncate

func (x *CompletionRequest) GetTruncate() int32

func (*CompletionRequest) GetTypicalP

func (x *CompletionRequest) GetTypicalP() float32

func (*CompletionRequest) GetUser

func (x *CompletionRequest) GetUser() string

func (*CompletionRequest) GetWatermark

func (x *CompletionRequest) GetWatermark() bool

func (*CompletionRequest) ProtoMessage

func (*CompletionRequest) ProtoMessage()

func (*CompletionRequest) ProtoReflect

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

func (*CompletionRequest) Reset

func (x *CompletionRequest) Reset()

func (*CompletionRequest) String

func (x *CompletionRequest) String() string

type CompletionResponse

type CompletionResponse struct {
	Choices []*CompletionChoice `protobuf:"bytes,1,rep,name=choices,proto3" json:"choices,omitempty"`
	Usage   *CompletionUsage    `protobuf:"bytes,2,opt,name=usage,proto3,oneof" json:"usage,omitempty"`
	// contains filtered or unexported fields
}

CompletionRespones are what's returned by the gRPC service

func (*CompletionResponse) Descriptor deprecated

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

Deprecated: Use CompletionResponse.ProtoReflect.Descriptor instead.

func (*CompletionResponse) GetChoices

func (x *CompletionResponse) GetChoices() []*CompletionChoice

func (*CompletionResponse) GetUsage

func (x *CompletionResponse) GetUsage() *CompletionUsage

func (*CompletionResponse) ProtoMessage

func (*CompletionResponse) ProtoMessage()

func (*CompletionResponse) ProtoReflect

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

func (*CompletionResponse) Reset

func (x *CompletionResponse) Reset()

func (*CompletionResponse) String

func (x *CompletionResponse) String() string

type CompletionServiceClient

type CompletionServiceClient interface {
	Complete(ctx context.Context, in *CompletionRequest, opts ...grpc.CallOption) (*CompletionResponse, error)
}

CompletionServiceClient is the client API for CompletionService 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 CompletionServiceServer

type CompletionServiceServer interface {
	Complete(context.Context, *CompletionRequest) (*CompletionResponse, error)
	// contains filtered or unexported methods
}

CompletionServiceServer is the server API for CompletionService service. All implementations must embed UnimplementedCompletionServiceServer for forward compatibility

type CompletionStreamServiceClient

type CompletionStreamServiceClient interface {
	CompleteStream(ctx context.Context, in *CompletionRequest, opts ...grpc.CallOption) (CompletionStreamService_CompleteStreamClient, error)
}

CompletionStreamServiceClient is the client API for CompletionStreamService 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 CompletionStreamServiceServer

type CompletionStreamServiceServer interface {
	CompleteStream(*CompletionRequest, CompletionStreamService_CompleteStreamServer) error
	// contains filtered or unexported methods
}

CompletionStreamServiceServer is the server API for CompletionStreamService service. All implementations must embed UnimplementedCompletionStreamServiceServer for forward compatibility

type CompletionStreamService_CompleteStreamClient

type CompletionStreamService_CompleteStreamClient interface {
	Recv() (*CompletionResponse, error)
	grpc.ClientStream
}

type CompletionStreamService_CompleteStreamServer

type CompletionStreamService_CompleteStreamServer interface {
	Send(*CompletionResponse) error
	grpc.ServerStream
}

type CompletionUsage

type CompletionUsage struct {
	PromptTokens     int32 `protobuf:"varint,1,opt,name=prompt_tokens,json=promptTokens,proto3" json:"prompt_tokens,omitempty"`
	CompletionTokens int32 `protobuf:"varint,2,opt,name=completion_tokens,json=completionTokens,proto3" json:"completion_tokens,omitempty"`
	TotalTokens      int32 `protobuf:"varint,3,opt,name=total_tokens,json=totalTokens,proto3" json:"total_tokens,omitempty"`
	// contains filtered or unexported fields
}

func (*CompletionUsage) Descriptor deprecated

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

Deprecated: Use CompletionUsage.ProtoReflect.Descriptor instead.

func (*CompletionUsage) GetCompletionTokens

func (x *CompletionUsage) GetCompletionTokens() int32

func (*CompletionUsage) GetPromptTokens

func (x *CompletionUsage) GetPromptTokens() int32

func (*CompletionUsage) GetTotalTokens

func (x *CompletionUsage) GetTotalTokens() int32

func (*CompletionUsage) ProtoMessage

func (*CompletionUsage) ProtoMessage()

func (*CompletionUsage) ProtoReflect

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

func (*CompletionUsage) Reset

func (x *CompletionUsage) Reset()

func (*CompletionUsage) String

func (x *CompletionUsage) String() string

type UnimplementedCompletionServiceServer

type UnimplementedCompletionServiceServer struct {
}

UnimplementedCompletionServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedCompletionServiceServer) Complete

type UnimplementedCompletionStreamServiceServer

type UnimplementedCompletionStreamServiceServer struct {
}

UnimplementedCompletionStreamServiceServer must be embedded to have forward compatible implementations.

type UnsafeCompletionServiceServer

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

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

type UnsafeCompletionStreamServiceServer

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

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

Jump to

Keyboard shortcuts

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