api

package
v1.0.106 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthApi        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowApi          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupApi = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type ChatReq

type ChatReq struct {
	// Used model for inference
	Model *Model `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
	// User inputed prompt
	Messages []*Message `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"`
	// API specific parameters
	Parameters *Parameters `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"`
	// Whether use stream mode, if set, partial message deltas will be sent as
	// data-only server-sent events as they become available
	// The stream will be terminated by a data: [DONE]
	Stream bool `protobuf:"varint,4,opt,name=stream,proto3" json:"stream,omitempty"`
	// Unified request id
	ReqId                string   `protobuf:"bytes,5,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChatReq) Descriptor

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

func (*ChatReq) GetMessages

func (m *ChatReq) GetMessages() []*Message

func (*ChatReq) GetModel

func (m *ChatReq) GetModel() *Model

func (*ChatReq) GetParameters

func (m *ChatReq) GetParameters() *Parameters

func (*ChatReq) GetReqId

func (m *ChatReq) GetReqId() string

func (*ChatReq) GetStream

func (m *ChatReq) GetStream() bool

func (*ChatReq) Marshal

func (m *ChatReq) Marshal() (dAtA []byte, err error)

func (*ChatReq) MarshalTo

func (m *ChatReq) MarshalTo(dAtA []byte) (int, error)

func (*ChatReq) MarshalToSizedBuffer

func (m *ChatReq) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ChatReq) ProtoMessage

func (*ChatReq) ProtoMessage()

func (*ChatReq) Reset

func (m *ChatReq) Reset()

func (*ChatReq) Size

func (m *ChatReq) Size() (n int)

func (*ChatReq) String

func (m *ChatReq) String() string

func (*ChatReq) Unmarshal

func (m *ChatReq) Unmarshal(dAtA []byte) error

func (*ChatReq) XXX_DiscardUnknown

func (m *ChatReq) XXX_DiscardUnknown()

func (*ChatReq) XXX_Marshal

func (m *ChatReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChatReq) XXX_Merge

func (m *ChatReq) XXX_Merge(src proto.Message)

func (*ChatReq) XXX_Size

func (m *ChatReq) XXX_Size() int

func (*ChatReq) XXX_Unmarshal

func (m *ChatReq) XXX_Unmarshal(b []byte) error

type ChatResp

type ChatResp struct {
	// Unified request id
	ReqId string `protobuf:"bytes,1,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"`
	// Error if exists for the req
	Error *Error `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	// The generated result
	Choice *Choice `protobuf:"bytes,3,opt,name=choice,proto3" json:"choice,omitempty"`
	// The tokens usage
	Usage                *Usage   `protobuf:"bytes,4,opt,name=usage,proto3" json:"usage,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChatResp) Descriptor

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

func (*ChatResp) GetChoice

func (m *ChatResp) GetChoice() *Choice

func (*ChatResp) GetError

func (m *ChatResp) GetError() *Error

func (*ChatResp) GetReqId

func (m *ChatResp) GetReqId() string

func (*ChatResp) GetUsage

func (m *ChatResp) GetUsage() *Usage

func (*ChatResp) Marshal

func (m *ChatResp) Marshal() (dAtA []byte, err error)

func (*ChatResp) MarshalTo

func (m *ChatResp) MarshalTo(dAtA []byte) (int, error)

func (*ChatResp) MarshalToSizedBuffer

func (m *ChatResp) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ChatResp) ProtoMessage

func (*ChatResp) ProtoMessage()

func (*ChatResp) Reset

func (m *ChatResp) Reset()

func (*ChatResp) Size

func (m *ChatResp) Size() (n int)

func (*ChatResp) String

func (m *ChatResp) String() string

func (*ChatResp) Unmarshal

func (m *ChatResp) Unmarshal(dAtA []byte) error

func (*ChatResp) XXX_DiscardUnknown

func (m *ChatResp) XXX_DiscardUnknown()

func (*ChatResp) XXX_Marshal

func (m *ChatResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChatResp) XXX_Merge

func (m *ChatResp) XXX_Merge(src proto.Message)

func (*ChatResp) XXX_Size

func (m *ChatResp) XXX_Size() int

func (*ChatResp) XXX_Unmarshal

func (m *ChatResp) XXX_Unmarshal(b []byte) error

type Choice

type Choice struct {
	Index                int32    `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	Message              *Message `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	FinishReason         string   `protobuf:"bytes,3,opt,name=finish_reason,json=finishReason,proto3" json:"finish_reason,omitempty"`
	Logprobs             float32  `protobuf:"fixed32,4,opt,name=logprobs,proto3" json:"logprobs,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Choice) Descriptor

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

func (*Choice) GetFinishReason

func (m *Choice) GetFinishReason() string

func (*Choice) GetIndex

func (m *Choice) GetIndex() int32

func (*Choice) GetLogprobs

func (m *Choice) GetLogprobs() float32

func (*Choice) GetMessage

func (m *Choice) GetMessage() *Message

func (*Choice) Marshal

func (m *Choice) Marshal() (dAtA []byte, err error)

func (*Choice) MarshalTo

func (m *Choice) MarshalTo(dAtA []byte) (int, error)

func (*Choice) MarshalToSizedBuffer

func (m *Choice) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Choice) ProtoMessage

func (*Choice) ProtoMessage()

func (*Choice) Reset

func (m *Choice) Reset()

func (*Choice) Size

func (m *Choice) Size() (n int)

func (*Choice) String

func (m *Choice) String() string

func (*Choice) Unmarshal

func (m *Choice) Unmarshal(dAtA []byte) error

func (*Choice) XXX_DiscardUnknown

func (m *Choice) XXX_DiscardUnknown()

func (*Choice) XXX_Marshal

func (m *Choice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Choice) XXX_Merge

func (m *Choice) XXX_Merge(src proto.Message)

func (*Choice) XXX_Size

func (m *Choice) XXX_Size() int

func (*Choice) XXX_Unmarshal

func (m *Choice) XXX_Unmarshal(b []byte) error

type Error

type Error struct {
	Code                 string   `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	CodeN                int32    `protobuf:"varint,2,opt,name=code_n,json=codeN,proto3" json:"code_n,omitempty"`
	Message              string   `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewClientSDKRequestError

func NewClientSDKRequestError(raw string) *Error

NOTE: the returned value cannot be `nil`

func (*Error) Descriptor

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

func (*Error) Error

func (m *Error) Error() string

func (*Error) GetCode

func (m *Error) GetCode() string

func (*Error) GetCodeN

func (m *Error) GetCodeN() int32

func (*Error) GetMessage

func (m *Error) GetMessage() string

func (*Error) Marshal

func (m *Error) Marshal() (dAtA []byte, err error)

func (*Error) MarshalTo

func (m *Error) MarshalTo(dAtA []byte) (int, error)

func (*Error) MarshalToSizedBuffer

func (m *Error) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) Size

func (m *Error) Size() (n int)

func (*Error) String

func (m *Error) String() string

func (*Error) Unmarshal

func (m *Error) Unmarshal(dAtA []byte) error

func (*Error) XXX_DiscardUnknown

func (m *Error) XXX_DiscardUnknown()

func (*Error) XXX_Marshal

func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Error) XXX_Merge

func (m *Error) XXX_Merge(src proto.Message)

func (*Error) XXX_Size

func (m *Error) XXX_Size() int

func (*Error) XXX_Unmarshal

func (m *Error) XXX_Unmarshal(b []byte) error

type ErrorResp

type ErrorResp struct {
	Error                *Error   `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	ReqId                string   `protobuf:"bytes,2,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ErrorResp) Descriptor

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

func (*ErrorResp) GetError

func (m *ErrorResp) GetError() *Error

func (*ErrorResp) GetReqId

func (m *ErrorResp) GetReqId() string

func (*ErrorResp) Marshal

func (m *ErrorResp) Marshal() (dAtA []byte, err error)

func (*ErrorResp) MarshalTo

func (m *ErrorResp) MarshalTo(dAtA []byte) (int, error)

func (*ErrorResp) MarshalToSizedBuffer

func (m *ErrorResp) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ErrorResp) ProtoMessage

func (*ErrorResp) ProtoMessage()

func (*ErrorResp) Reset

func (m *ErrorResp) Reset()

func (*ErrorResp) Size

func (m *ErrorResp) Size() (n int)

func (*ErrorResp) String

func (m *ErrorResp) String() string

func (*ErrorResp) Unmarshal

func (m *ErrorResp) Unmarshal(dAtA []byte) error

func (*ErrorResp) XXX_DiscardUnknown

func (m *ErrorResp) XXX_DiscardUnknown()

func (*ErrorResp) XXX_Marshal

func (m *ErrorResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ErrorResp) XXX_Merge

func (m *ErrorResp) XXX_Merge(src proto.Message)

func (*ErrorResp) XXX_Size

func (m *ErrorResp) XXX_Size() int

func (*ErrorResp) XXX_Unmarshal

func (m *ErrorResp) XXX_Unmarshal(b []byte) error

type Message

type Message struct {
	// The role of the author of this message. One of system, user, or assistant.
	Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
	// The real context of the message
	Content              string   `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Message) Descriptor

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

func (*Message) GetContent

func (m *Message) GetContent() string

func (*Message) GetRole

func (m *Message) GetRole() string

func (*Message) Marshal

func (m *Message) Marshal() (dAtA []byte, err error)

func (*Message) MarshalTo

func (m *Message) MarshalTo(dAtA []byte) (int, error)

func (*Message) MarshalToSizedBuffer

func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) Reset

func (m *Message) Reset()

func (*Message) Size

func (m *Message) Size() (n int)

func (*Message) String

func (m *Message) String() string

func (*Message) Unmarshal

func (m *Message) Unmarshal(dAtA []byte) error

func (*Message) XXX_DiscardUnknown

func (m *Message) XXX_DiscardUnknown()

func (*Message) XXX_Marshal

func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Message) XXX_Merge

func (m *Message) XXX_Merge(src proto.Message)

func (*Message) XXX_Size

func (m *Message) XXX_Size() int

func (*Message) XXX_Unmarshal

func (m *Message) XXX_Unmarshal(b []byte) error

type Model

type Model struct {
	// Unified model name in model db
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Use specific endpoint id for inference, must set either name or id by now
	EndpointId           string   `protobuf:"bytes,2,opt,name=endpoint_id,json=endpointId,proto3" json:"endpoint_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Model) Descriptor

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

func (*Model) GetEndpointId

func (m *Model) GetEndpointId() string

func (*Model) GetName

func (m *Model) GetName() string

func (*Model) Marshal

func (m *Model) Marshal() (dAtA []byte, err error)

func (*Model) MarshalTo

func (m *Model) MarshalTo(dAtA []byte) (int, error)

func (*Model) MarshalToSizedBuffer

func (m *Model) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Model) ProtoMessage

func (*Model) ProtoMessage()

func (*Model) Reset

func (m *Model) Reset()

func (*Model) Size

func (m *Model) Size() (n int)

func (*Model) String

func (m *Model) String() string

func (*Model) Unmarshal

func (m *Model) Unmarshal(dAtA []byte) error

func (*Model) XXX_DiscardUnknown

func (m *Model) XXX_DiscardUnknown()

func (*Model) XXX_Marshal

func (m *Model) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Model) XXX_Merge

func (m *Model) XXX_Merge(src proto.Message)

func (*Model) XXX_Size

func (m *Model) XXX_Size() int

func (*Model) XXX_Unmarshal

func (m *Model) XXX_Unmarshal(b []byte) error

type Parameters

type Parameters struct {
	// Exponential scaling output probability distribution
	Temperature float32 `protobuf:"fixed32,1,opt,name=temperature,proto3" json:"temperature,omitempty"`
	// The maximum number of tokens to generate in the char completion.
	MaxTokens int64 `protobuf:"varint,2,opt,name=max_tokens,json=maxTokens,proto3" json:"max_tokens,omitempty"`
	// An alternative to sampling with temperature, called nucleus sampling,
	// where the model considers the results of the tokens with top_p probability
	// mass
	TopP float32 `protobuf:"fixed32,3,opt,name=top_p,json=topP,proto3" json:"top_p,omitempty"`
	// Number between -2.0 and 2.0. Positive values penalize new tokens based
	// on whether they appear in the text so far, increasing the model's
	// likelihood to talk about new topics.
	PresencePenalty float32 `protobuf:"fixed32,4,opt,name=presence_penalty,json=presencePenalty,proto3" json:"presence_penalty,omitempty"`
	// Number between -2.0 and 2.0. Positive values penalize new tokens based on
	// their existing frequency in the text so far, decreasing the model's
	// likelihood to repeat the same line verbatim.
	FrequencyPenalty float32 `protobuf:"fixed32,5,opt,name=frequency_penalty,json=frequencyPenalty,proto3" json:"frequency_penalty,omitempty"`
	// The maximum number of tokens to generate, ignoring the number of tokens in
	// the prompt
	MaxNewTokens int64 `protobuf:"varint,6,opt,name=max_new_tokens,json=maxNewTokens,proto3" json:"max_new_tokens,omitempty"`
	// The parameter for repetition penalty, from [1.0, 2.0]
	RepetitionPenalty float32 `protobuf:"fixed32,7,opt,name=repetition_penalty,json=repetitionPenalty,proto3" json:"repetition_penalty,omitempty"`
	// Whether or not to use sampling, use greedy decoding otherwise. Default to
	// false
	DoSample bool `protobuf:"varint,8,opt,name=do_sample,json=doSample,proto3" json:"do_sample,omitempty"`
	// The number of highest probability vocabulary tokens to keep for
	// top-k-filtering.
	TopK                 int64    `protobuf:"varint,9,opt,name=top_k,json=topK,proto3" json:"top_k,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Parameters) Descriptor

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

func (*Parameters) GetDoSample

func (m *Parameters) GetDoSample() bool

func (*Parameters) GetFrequencyPenalty

func (m *Parameters) GetFrequencyPenalty() float32

func (*Parameters) GetMaxNewTokens

func (m *Parameters) GetMaxNewTokens() int64

func (*Parameters) GetMaxTokens

func (m *Parameters) GetMaxTokens() int64

func (*Parameters) GetPresencePenalty

func (m *Parameters) GetPresencePenalty() float32

func (*Parameters) GetRepetitionPenalty

func (m *Parameters) GetRepetitionPenalty() float32

func (*Parameters) GetTemperature

func (m *Parameters) GetTemperature() float32

func (*Parameters) GetTopK

func (m *Parameters) GetTopK() int64

func (*Parameters) GetTopP

func (m *Parameters) GetTopP() float32

func (*Parameters) Marshal

func (m *Parameters) Marshal() (dAtA []byte, err error)

func (*Parameters) MarshalTo

func (m *Parameters) MarshalTo(dAtA []byte) (int, error)

func (*Parameters) MarshalToSizedBuffer

func (m *Parameters) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Parameters) ProtoMessage

func (*Parameters) ProtoMessage()

func (*Parameters) Reset

func (m *Parameters) Reset()

func (*Parameters) Size

func (m *Parameters) Size() (n int)

func (*Parameters) String

func (m *Parameters) String() string

func (*Parameters) Unmarshal

func (m *Parameters) Unmarshal(dAtA []byte) error

func (*Parameters) XXX_DiscardUnknown

func (m *Parameters) XXX_DiscardUnknown()

func (*Parameters) XXX_Marshal

func (m *Parameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Parameters) XXX_Merge

func (m *Parameters) XXX_Merge(src proto.Message)

func (*Parameters) XXX_Size

func (m *Parameters) XXX_Size() int

func (*Parameters) XXX_Unmarshal

func (m *Parameters) XXX_Unmarshal(b []byte) error

type Usage

type Usage struct {
	// The number of prompt tokens
	PromptTokens int64 `protobuf:"varint,1,opt,name=prompt_tokens,json=promptTokens,proto3" json:"prompt_tokens,omitempty"`
	// The number of generated tokens
	CompletionTokens int64 `protobuf:"varint,2,opt,name=completion_tokens,json=completionTokens,proto3" json:"completion_tokens,omitempty"`
	// The number of all: prompt_tokens + completion_tokens
	TotalTokens          int64    `protobuf:"varint,3,opt,name=total_tokens,json=totalTokens,proto3" json:"total_tokens,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Usage) Descriptor

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

func (*Usage) GetCompletionTokens

func (m *Usage) GetCompletionTokens() int64

func (*Usage) GetPromptTokens

func (m *Usage) GetPromptTokens() int64

func (*Usage) GetTotalTokens

func (m *Usage) GetTotalTokens() int64

func (*Usage) Marshal

func (m *Usage) Marshal() (dAtA []byte, err error)

func (*Usage) MarshalTo

func (m *Usage) MarshalTo(dAtA []byte) (int, error)

func (*Usage) MarshalToSizedBuffer

func (m *Usage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Usage) ProtoMessage

func (*Usage) ProtoMessage()

func (*Usage) Reset

func (m *Usage) Reset()

func (*Usage) Size

func (m *Usage) Size() (n int)

func (*Usage) String

func (m *Usage) String() string

func (*Usage) Unmarshal

func (m *Usage) Unmarshal(dAtA []byte) error

func (*Usage) XXX_DiscardUnknown

func (m *Usage) XXX_DiscardUnknown()

func (*Usage) XXX_Marshal

func (m *Usage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Usage) XXX_Merge

func (m *Usage) XXX_Merge(src proto.Message)

func (*Usage) XXX_Size

func (m *Usage) XXX_Size() int

func (*Usage) XXX_Unmarshal

func (m *Usage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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