api

package
v0.0.0-...-4d121eb Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: BSD-2-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_language_model_proto protoreflect.FileDescriptor
View Source
var LanguageModel_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.LanguageModel",
	HandlerType: (*LanguageModelServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "GenerateTokens",
			Handler:       _LanguageModel_GenerateTokens_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "language_model.proto",
}

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

Functions

func RegisterLanguageModelServer

func RegisterLanguageModelServer(s grpc.ServiceRegistrar, srv LanguageModelServer)

Types

type DecodingParameters

type DecodingParameters struct {

	// MaxLen is the maximum number of tokens to generate.
	MaxLen int32 `protobuf:"varint,1,opt,name=max_len,json=maxLen,proto3" json:"max_len,omitempty"`
	// MinLen is the minimum number of tokens to generate.
	MinLen int32 `protobuf:"varint,2,opt,name=min_len,json=minLen,proto3" json:"min_len,omitempty"`
	// Temperature controls the randomness of the generated tokens. A higher temperature will result in more diverse generated tokens.
	Temperature float32 `protobuf:"fixed32,3,opt,name=temperature,proto3" json:"temperature,omitempty"`
	// TopK is the maximum number of tokens to consider when sampling the next token.
	TopK int32 `protobuf:"varint,4,opt,name=top_k,json=topK,proto3" json:"top_k,omitempty"`
	// TopP is the cumulative probability of the tokens to consider when sampling the next token.
	TopP float32 `protobuf:"fixed32,5,opt,name=top_p,json=topP,proto3" json:"top_p,omitempty"`
	// UseSampling uses sampling to generate the next token.
	UseSampling bool `protobuf:"varint,6,opt,name=use_sampling,json=useSampling,proto3" json:"use_sampling,omitempty"`
	// EndTokenID is the end-of-sequence token (default: 0).
	EndTokenId int32 `protobuf:"varint,7,opt,name=end_token_id,json=endTokenId,proto3" json:"end_token_id,omitempty"`
	// SkipEndTokenID when true, the end token is not added to the generated sequence.
	SkipEndTokenId bool `protobuf:"varint,8,opt,name=skip_end_token_id,json=skipEndTokenId,proto3" json:"skip_end_token_id,omitempty"`
	// StopSequences are the sequences of token ids that will cause the generation to stop.
	StopSequences []*Sequence `protobuf:"bytes,9,rep,name=stop_sequences,json=stopSequences,proto3" json:"stop_sequences,omitempty"`
	// contains filtered or unexported fields
}

DecodingParameters contains the parameters to use for token generation

func (*DecodingParameters) Descriptor deprecated

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

Deprecated: Use DecodingParameters.ProtoReflect.Descriptor instead.

func (*DecodingParameters) GetEndTokenId

func (x *DecodingParameters) GetEndTokenId() int32

func (*DecodingParameters) GetMaxLen

func (x *DecodingParameters) GetMaxLen() int32

func (*DecodingParameters) GetMinLen

func (x *DecodingParameters) GetMinLen() int32

func (*DecodingParameters) GetSkipEndTokenId

func (x *DecodingParameters) GetSkipEndTokenId() bool

func (*DecodingParameters) GetStopSequences

func (x *DecodingParameters) GetStopSequences() []*Sequence

func (*DecodingParameters) GetTemperature

func (x *DecodingParameters) GetTemperature() float32

func (*DecodingParameters) GetTopK

func (x *DecodingParameters) GetTopK() int32

func (*DecodingParameters) GetTopP

func (x *DecodingParameters) GetTopP() float32

func (*DecodingParameters) GetUseSampling

func (x *DecodingParameters) GetUseSampling() bool

func (*DecodingParameters) ProtoMessage

func (*DecodingParameters) ProtoMessage()

func (*DecodingParameters) ProtoReflect

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

func (*DecodingParameters) Reset

func (x *DecodingParameters) Reset()

func (*DecodingParameters) String

func (x *DecodingParameters) String() string

type GeneratedToken

type GeneratedToken struct {

	// Token is the generated token
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// Score is the sum of the negative log probabilities up to the current step.
	Score float32 `protobuf:"fixed32,2,opt,name=score,proto3" json:"score,omitempty"`
	// contains filtered or unexported fields
}

GeneratedToken contains a generated token, its score, and its encoded representation

func (*GeneratedToken) Descriptor deprecated

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

Deprecated: Use GeneratedToken.ProtoReflect.Descriptor instead.

func (*GeneratedToken) GetScore

func (x *GeneratedToken) GetScore() float32

func (*GeneratedToken) GetToken

func (x *GeneratedToken) GetToken() string

func (*GeneratedToken) ProtoMessage

func (*GeneratedToken) ProtoMessage()

func (*GeneratedToken) ProtoReflect

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

func (*GeneratedToken) Reset

func (x *GeneratedToken) Reset()

func (*GeneratedToken) String

func (x *GeneratedToken) String() string

type LanguageModelClient

type LanguageModelClient interface {
	// GenerateTokens generates tokens for the given prompt using the specified decoding parameters.
	// The response is a stream of GeneratedToken messages, each containing a generated token and its score and encoded representation.
	GenerateTokens(ctx context.Context, in *TokenGenerationRequest, opts ...grpc.CallOption) (LanguageModel_GenerateTokensClient, error)
}

LanguageModelClient is the client API for LanguageModel 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 LanguageModelServer

type LanguageModelServer interface {
	// GenerateTokens generates tokens for the given prompt using the specified decoding parameters.
	// The response is a stream of GeneratedToken messages, each containing a generated token and its score and encoded representation.
	GenerateTokens(*TokenGenerationRequest, LanguageModel_GenerateTokensServer) error
	// contains filtered or unexported methods
}

LanguageModelServer is the server API for LanguageModel service. All implementations must embed UnimplementedLanguageModelServer for forward compatibility

type LanguageModel_GenerateTokensClient

type LanguageModel_GenerateTokensClient interface {
	Recv() (*GeneratedToken, error)
	grpc.ClientStream
}

type LanguageModel_GenerateTokensServer

type LanguageModel_GenerateTokensServer interface {
	Send(*GeneratedToken) error
	grpc.ServerStream
}

type Sequence

type Sequence struct {
	Sequence []int32 `protobuf:"varint,1,rep,packed,name=sequence,proto3" json:"sequence,omitempty"`
	// contains filtered or unexported fields
}

func (*Sequence) Descriptor deprecated

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

Deprecated: Use Sequence.ProtoReflect.Descriptor instead.

func (*Sequence) GetSequence

func (x *Sequence) GetSequence() []int32

func (*Sequence) ProtoMessage

func (*Sequence) ProtoMessage()

func (*Sequence) ProtoReflect

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

func (*Sequence) Reset

func (x *Sequence) Reset()

func (*Sequence) String

func (x *Sequence) String() string

type TokenGenerationRequest

type TokenGenerationRequest struct {

	// Prompt is the input string to use as a starting point for token generation
	Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"`
	// DecodingParameters are the parameters to use for token generation
	DecodingParameters *DecodingParameters `protobuf:"bytes,2,opt,name=decoding_parameters,json=decodingParameters,proto3" json:"decoding_parameters,omitempty"`
	// contains filtered or unexported fields
}

TokenGenerationRequest contains the prompt and decoding parameters for generating tokens

func (*TokenGenerationRequest) Descriptor deprecated

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

Deprecated: Use TokenGenerationRequest.ProtoReflect.Descriptor instead.

func (*TokenGenerationRequest) GetDecodingParameters

func (x *TokenGenerationRequest) GetDecodingParameters() *DecodingParameters

func (*TokenGenerationRequest) GetPrompt

func (x *TokenGenerationRequest) GetPrompt() string

func (*TokenGenerationRequest) ProtoMessage

func (*TokenGenerationRequest) ProtoMessage()

func (*TokenGenerationRequest) ProtoReflect

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

func (*TokenGenerationRequest) Reset

func (x *TokenGenerationRequest) Reset()

func (*TokenGenerationRequest) String

func (x *TokenGenerationRequest) String() string

type UnimplementedLanguageModelServer

type UnimplementedLanguageModelServer struct {
}

UnimplementedLanguageModelServer must be embedded to have forward compatible implementations.

type UnsafeLanguageModelServer

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

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

Jump to

Keyboard shortcuts

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