Documentation ¶
Index ¶
- type CertReq
- type CertResp
- type ChatReq
- func (x *ChatReq) GetCryptoToken() string
- func (x *ChatReq) GetExtra() map[string]string
- func (x *ChatReq) GetFunctions() []*Function
- func (x *ChatReq) GetMessages() []*Message
- func (x *ChatReq) GetMethod() string
- func (x *ChatReq) GetModel() *Model
- func (x *ChatReq) GetParameters() *Parameters
- func (x *ChatReq) GetPlugins() []string
- func (x *ChatReq) GetReqId() string
- func (x *ChatReq) GetStream() bool
- type ChatResp
- type Choice
- type ClassificationReq
- type ClassificationResp
- type Embedding
- type EmbeddingsReq
- type EmbeddingsResp
- type Error
- type ErrorResp
- type Function
- type FunctionCall
- type LabelLogprobosValue
- type ListString
- type Logprobs
- type Message
- type Model
- type Parameters
- func (x *Parameters) GetDoSample() bool
- func (x *Parameters) GetFrequencyPenalty() float32
- func (x *Parameters) GetLogprobs() int64
- func (x *Parameters) GetMaxNewTokens() int64
- func (x *Parameters) GetMaxPromptTokens() int64
- func (x *Parameters) GetMaxTokens() int64
- func (x *Parameters) GetMinNewTokens() int64
- func (x *Parameters) GetPresencePenalty() float32
- func (x *Parameters) GetRepetitionPenalty() float32
- func (x *Parameters) GetStop() []string
- func (x *Parameters) GetTemperature() float32
- func (x *Parameters) GetTopK() int64
- func (x *Parameters) GetTopP() float32
- type Reference
- type TokenizeReq
- type TokenizeResp
- type TopLogprobsItem
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertReq ¶ added in v1.0.113
type CertReq struct {
Model *Model `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
}
type CertResp ¶ added in v1.0.113
type ChatReq ¶
type ChatReq struct { // Used model for inference Model *Model `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"` // User input 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"` // symmetric key to encrypt messages, the key itself is encrypted // with model's public key. CryptoToken string `protobuf:"bytes,6,opt,name=crypto_token,json=cryptoToken,proto3" json:"crypto_token,omitempty"` //[ (api.header) = "Ml-Maas-Crypto-Token" ]; // list of functions the model may generate json inputs for. Functions []*Function `protobuf:"bytes,7,rep,name=functions,proto3" json:"functions,omitempty"` // list of plugins the model may call. Plugins []string `protobuf:"bytes,8,rep,name=plugins,proto3" json:"plugins,omitempty"` // Method supports chat/tokenize/classification Method string `protobuf:"bytes,9,opt,name=method,proto3" json:"method,omitempty"` // extra info Extra map[string]string `` /* 153-byte string literal not displayed */ }
func (*ChatReq) GetCryptoToken ¶ added in v1.0.113
func (*ChatReq) GetFunctions ¶ added in v1.0.121
func (*ChatReq) GetMessages ¶
func (*ChatReq) GetParameters ¶
func (x *ChatReq) GetParameters() *Parameters
func (*ChatReq) GetPlugins ¶ added in v1.0.122
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"` // extra info Extra map[string]string `` /* 153-byte string literal not displayed */ }
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 *Logprobs `protobuf:"bytes,4,opt,name=logprobs,proto3" json:"logprobs,omitempty"` }
func (*Choice) GetFinishReason ¶
func (*Choice) GetLogprobs ¶
func (*Choice) GetMessage ¶
type ClassificationReq ¶ added in v1.0.123
type ClassificationReq struct { Model *Model `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"` ReqId string `protobuf:"bytes,2,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` Query string `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"` Labels []string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels,omitempty"` }
func (*ClassificationReq) GetLabels ¶ added in v1.0.123
func (x *ClassificationReq) GetLabels() []string
func (*ClassificationReq) GetModel ¶ added in v1.0.123
func (x *ClassificationReq) GetModel() *Model
func (*ClassificationReq) GetQuery ¶ added in v1.0.123
func (x *ClassificationReq) GetQuery() string
func (*ClassificationReq) GetReqId ¶ added in v1.0.123
func (x *ClassificationReq) GetReqId() string
type ClassificationResp ¶ added in v1.0.123
type ClassificationResp struct { Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` LabelLogprobos map[string]*LabelLogprobosValue `` /* 191-byte string literal not displayed */ // The tokens usage Usage *Usage `protobuf:"bytes,3,opt,name=usage,proto3" json:"usage,omitempty"` // Unified request id ReqId string `protobuf:"bytes,4,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` // Error if exists for the req Error *Error `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` }
func (*ClassificationResp) GetError ¶ added in v1.0.123
func (x *ClassificationResp) GetError() *Error
func (*ClassificationResp) GetLabel ¶ added in v1.0.123
func (x *ClassificationResp) GetLabel() string
func (*ClassificationResp) GetLabelLogprobos ¶ added in v1.0.123
func (x *ClassificationResp) GetLabelLogprobos() map[string]*LabelLogprobosValue
func (*ClassificationResp) GetReqId ¶ added in v1.0.123
func (x *ClassificationResp) GetReqId() string
func (*ClassificationResp) GetUsage ¶ added in v1.0.123
func (x *ClassificationResp) GetUsage() *Usage
type Embedding ¶ added in v1.0.128
type Embedding struct { Index *int64 `protobuf:"varint,1,opt,name=index,proto3,oneof" json:"index,omitempty"` Embedding []float64 `protobuf:"fixed64,2,rep,packed,name=embedding,proto3" json:"embedding,omitempty"` Object string `protobuf:"bytes,3,opt,name=object,proto3" json:"object,omitempty"` }
func (*Embedding) GetEmbedding ¶ added in v1.0.128
type EmbeddingsReq ¶ added in v1.0.128
type EmbeddingsReq struct { ReqId string `protobuf:"bytes,1,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` Input []string `protobuf:"bytes,2,rep,name=input,proto3" json:"input,omitempty"` Model *Model `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"` EncodingFormat *string `protobuf:"bytes,4,opt,name=encoding_format,json=encodingFormat,proto3,oneof" json:"encoding_format,omitempty"` User *string `protobuf:"bytes,5,opt,name=user,proto3,oneof" json:"user,omitempty"` }
func (*EmbeddingsReq) GetEncodingFormat ¶ added in v1.0.128
func (x *EmbeddingsReq) GetEncodingFormat() string
func (*EmbeddingsReq) GetInput ¶ added in v1.0.128
func (x *EmbeddingsReq) GetInput() []string
func (*EmbeddingsReq) GetModel ¶ added in v1.0.128
func (x *EmbeddingsReq) GetModel() *Model
func (*EmbeddingsReq) GetReqId ¶ added in v1.0.128
func (x *EmbeddingsReq) GetReqId() string
func (*EmbeddingsReq) GetUser ¶ added in v1.0.128
func (x *EmbeddingsReq) GetUser() string
type EmbeddingsResp ¶ added in v1.0.128
type EmbeddingsResp struct { ReqId string `protobuf:"bytes,1,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` Object string `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"` Data []*Embedding `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"` Model *Model `protobuf:"bytes,4,opt,name=model,proto3" json:"model,omitempty"` Usage *Usage `protobuf:"bytes,5,opt,name=usage,proto3" json:"usage,omitempty"` Error *Error `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"` }
func (*EmbeddingsResp) GetData ¶ added in v1.0.128
func (x *EmbeddingsResp) GetData() []*Embedding
func (*EmbeddingsResp) GetError ¶ added in v1.0.128
func (x *EmbeddingsResp) GetError() *Error
func (*EmbeddingsResp) GetModel ¶ added in v1.0.128
func (x *EmbeddingsResp) GetModel() *Model
func (*EmbeddingsResp) GetObject ¶ added in v1.0.128
func (x *EmbeddingsResp) GetObject() string
func (*EmbeddingsResp) GetReqId ¶ added in v1.0.128
func (x *EmbeddingsResp) GetReqId() string
func (*EmbeddingsResp) GetUsage ¶ added in v1.0.128
func (x *EmbeddingsResp) GetUsage() *Usage
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"` }
func NewClientSDKRequestError ¶
NOTE: the returned value cannot be `nil`
func (*Error) GetMessage ¶
type ErrorResp ¶
type Function ¶ added in v1.0.121
type Function struct { // The name of the function. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // A description of the function, used by the model to choose when and how to // call the function. Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // The parameters of the function, described as Json Schema. Parameters *structpb.Struct `protobuf:"bytes,3,opt,name=parameters,proto3" json:"parameters,omitempty"` // The examples of the function parameters, as the above json schema // describes. Examples []string `protobuf:"bytes,4,rep,name=examples,proto3" json:"examples,omitempty"` }
func (*Function) GetDescription ¶ added in v1.0.121
func (*Function) GetExamples ¶ added in v1.0.121
func (*Function) GetParameters ¶ added in v1.0.121
type FunctionCall ¶ added in v1.0.121
type FunctionCall struct { // The name of the function to call. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The arguments to call the function with, generated by model, formatted as // json, may not valid, the caller should validate the arguments before // calling the function. Arguments string `protobuf:"bytes,2,opt,name=arguments,proto3" json:"arguments,omitempty"` }
func (*FunctionCall) GetArguments ¶ added in v1.0.121
func (x *FunctionCall) GetArguments() string
func (*FunctionCall) GetName ¶ added in v1.0.121
func (x *FunctionCall) GetName() string
type LabelLogprobosValue ¶ added in v1.0.123
type LabelLogprobosValue struct { Tokens []string `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` TokenLogprobs []float64 `protobuf:"fixed64,2,rep,packed,name=token_logprobs,json=tokenLogprobs,proto3" json:"token_logprobs,omitempty"` ReqId string `protobuf:"bytes,3,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` }
func (*LabelLogprobosValue) GetReqId ¶ added in v1.0.123
func (x *LabelLogprobosValue) GetReqId() string
func (*LabelLogprobosValue) GetTokenLogprobs ¶ added in v1.0.123
func (x *LabelLogprobosValue) GetTokenLogprobs() []float64
func (*LabelLogprobosValue) GetTokens ¶ added in v1.0.123
func (x *LabelLogprobosValue) GetTokens() []string
type ListString ¶ added in v1.0.128
type ListString struct {
Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
}
func (*ListString) GetValues ¶ added in v1.0.128
func (x *ListString) GetValues() []string
type Logprobs ¶ added in v1.0.123
type Logprobs struct { TextOffset []int64 `protobuf:"varint,1,rep,packed,name=text_offset,json=textOffset,proto3" json:"text_offset,omitempty"` TokenLogprobs []float64 `protobuf:"fixed64,2,rep,packed,name=token_logprobs,json=tokenLogprobs,proto3" json:"token_logprobs,omitempty"` Tokens []string `protobuf:"bytes,3,rep,name=tokens,proto3" json:"tokens,omitempty"` TopLogprobs *structpb.ListValue `protobuf:"bytes,4,opt,name=top_logprobs,json=topLogprobs,proto3" json:"top_logprobs,omitempty"` }
func (*Logprobs) GetTextOffset ¶ added in v1.0.123
func (*Logprobs) GetTokenLogprobs ¶ added in v1.0.123
func (*Logprobs) GetTopLogprobs ¶ added in v1.0.123
type Message ¶
type Message struct { // The role of the author of this message. One of system, user, assistant or // function. Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` // The real content of the message, may be empty for assistant message with // function call. Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // If the role is `function`, is the name of the function which generate the // content. Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` // The name and arguments of a function call generated by model. FunctionCall *FunctionCall `protobuf:"bytes,5,opt,name=function_call,json=functionCall,proto3" json:"function_call,omitempty"` // url reference for searching, optional References []*Reference `protobuf:"bytes,3,rep,name=references,proto3" json:"references,omitempty"` }
func (*Message) GetContent ¶
func (*Message) GetFunctionCall ¶ added in v1.0.121
func (x *Message) GetFunctionCall() *FunctionCall
func (*Message) GetReferences ¶ added in v1.0.121
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, if set, parameters `name` and // `version` will be ignored. EndpointId string `protobuf:"bytes,2,opt,name=endpoint_id,json=endpointId,proto3" json:"endpoint_id,omitempty"` // Use specific model version for inference, optional. Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` }
func (*Model) GetEndpointId ¶
func (*Model) GetVersion ¶ added in v1.0.114
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"` // the minimum number of tokens to generate MinNewTokens int64 `protobuf:"varint,10,opt,name=min_new_tokens,json=minNewTokens,proto3" json:"min_new_tokens,omitempty"` // the maximum number of prompt tokens, if prompt tokens length over this // limit, it will be truncated as prompt[-max_prompt_tokens:] MaxPromptTokens int64 `protobuf:"varint,11,opt,name=max_prompt_tokens,json=maxPromptTokens,proto3" json:"max_prompt_tokens,omitempty"` Logprobs int64 `protobuf:"varint,12,opt,name=logprobs,proto3" json:"logprobs,omitempty"` Stop []string `protobuf:"bytes,13,rep,name=stop,proto3" json:"stop,omitempty"` }
func (*Parameters) GetDoSample ¶
func (x *Parameters) GetDoSample() bool
func (*Parameters) GetFrequencyPenalty ¶
func (x *Parameters) GetFrequencyPenalty() float32
func (*Parameters) GetLogprobs ¶ added in v1.0.123
func (x *Parameters) GetLogprobs() int64
func (*Parameters) GetMaxNewTokens ¶
func (x *Parameters) GetMaxNewTokens() int64
func (*Parameters) GetMaxPromptTokens ¶ added in v1.0.116
func (x *Parameters) GetMaxPromptTokens() int64
func (*Parameters) GetMaxTokens ¶
func (x *Parameters) GetMaxTokens() int64
func (*Parameters) GetMinNewTokens ¶ added in v1.0.113
func (x *Parameters) GetMinNewTokens() int64
func (*Parameters) GetPresencePenalty ¶
func (x *Parameters) GetPresencePenalty() float32
func (*Parameters) GetRepetitionPenalty ¶
func (x *Parameters) GetRepetitionPenalty() float32
func (*Parameters) GetStop ¶ added in v1.0.128
func (x *Parameters) GetStop() []string
func (*Parameters) GetTemperature ¶
func (x *Parameters) GetTemperature() float32
func (*Parameters) GetTopK ¶
func (x *Parameters) GetTopK() int64
func (*Parameters) GetTopP ¶
func (x *Parameters) GetTopP() float32
type Reference ¶ added in v1.0.121
type Reference struct { // url Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` // the index of url Idx int32 `protobuf:"varint,2,opt,name=idx,proto3" json:"idx,omitempty"` // the logo of url LogoUrl string `protobuf:"bytes,3,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty"` // the url be used for pc PcUrl string `protobuf:"bytes,4,opt,name=pc_url,json=pcUrl,proto3" json:"pc_url,omitempty"` // the topic of url SiteName string `protobuf:"bytes,5,opt,name=site_name,json=siteName,proto3" json:"site_name,omitempty"` }
func (*Reference) GetLogoUrl ¶ added in v1.0.121
func (*Reference) GetSiteName ¶ added in v1.0.121
type TokenizeReq ¶ added in v1.0.123
type TokenizeReq struct { Model *Model `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"` ReqId string `protobuf:"bytes,2,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` }
func (*TokenizeReq) GetModel ¶ added in v1.0.123
func (x *TokenizeReq) GetModel() *Model
func (*TokenizeReq) GetReqId ¶ added in v1.0.123
func (x *TokenizeReq) GetReqId() string
func (*TokenizeReq) GetText ¶ added in v1.0.123
func (x *TokenizeReq) GetText() string
type TokenizeResp ¶ added in v1.0.123
type TokenizeResp struct { TotalTokens int64 `protobuf:"varint,1,opt,name=total_tokens,json=totalTokens,proto3" json:"total_tokens,omitempty"` Tokens []string `protobuf:"bytes,2,rep,name=tokens,proto3" json:"tokens,omitempty"` // Unified request id ReqId string `protobuf:"bytes,3,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` // Error if exists for the req Error *Error `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` }
func (*TokenizeResp) GetError ¶ added in v1.0.123
func (x *TokenizeResp) GetError() *Error
func (*TokenizeResp) GetReqId ¶ added in v1.0.123
func (x *TokenizeResp) GetReqId() string
func (*TokenizeResp) GetTokens ¶ added in v1.0.123
func (x *TokenizeResp) GetTokens() []string
func (*TokenizeResp) GetTotalTokens ¶ added in v1.0.123
func (x *TokenizeResp) GetTotalTokens() int64
type TopLogprobsItem ¶ added in v1.0.123
type TopLogprobsItem struct {
Item map[string]float32 `` /* 151-byte string literal not displayed */
}
func (*TopLogprobsItem) GetItem ¶ added in v1.0.123
func (x *TopLogprobsItem) GetItem() map[string]float32
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"` }
func (*Usage) GetCompletionTokens ¶
func (*Usage) GetPromptTokens ¶
func (*Usage) GetTotalTokens ¶
Click to show internal directories.
Click to hide internal directories.