Documentation
¶
Index ¶
- Constants
- type ErnieFunction
- type ErnieFunctionCall
- type ErnieFunctionExample
- type LLM
- type ModelType
- type Option
- func (p *Option) SetCache(val utils.KeyValueCache) *Option
- func (p *Option) SetHttpClient(val *http.Client) *Option
- func (p *Option) SetMsgLimit(val uint) *Option
- func (p *Option) SetPenaltyScore(val float32) *Option
- func (p *Option) SetTemperature(val float32) *Option
- func (p *Option) SetTopP(val float32) *Option
- type ReqChatCompMsg
- type Request
- type RespError
- type RespPluginUsage
- type RespSearchInfo
- type RespSearchResult
- type RespUsage
- type Response
- type ResponseAccessToken
Constants ¶
View Source
const (
TokenPrefix = "baidu:token:"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErnieFunction ¶
type ErnieFunction struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters any `json:"parameters"`
Responses any `json:"responses"`
Examples []*ErnieFunctionExample `json:"examples,omitempty"`
}
type ErnieFunctionCall ¶
type ErnieFunctionExample ¶
type ErnieFunctionExample struct {
Role string `json:"role"`
Content *string `json:"content"`
Name string `json:"name,omitempty"`
FunctionCall *ErnieFunctionCall `json:"function_call,omitempty"`
}
type LLM ¶
type LLM struct {
// contains filtered or unexported fields
}
func (*LLM) CheckSupport ¶ added in v0.0.2
func (llm *LLM) CheckSupport(v llms.LLMSupportType) bool
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
func (*Option) SetMsgLimit ¶
func (*Option) SetPenaltyScore ¶
func (*Option) SetTemperature ¶
type ReqChatCompMsg ¶
type ReqChatCompMsg struct {
Role string `json:"role"`
Content *string `json:"content"`
Name string `json:"name,omitempty"`
FunctionCall *ErnieFunctionCall `json:"function_call,omitempty"`
}
type Request ¶
type Request struct {
Messages []*ReqChatCompMsg `json:"messages"`
Temperature float32 `json:"temperature,omitempty"`
TopP float32 `json:"top_p,omitempty"`
PresencePenalty float32 `json:"presence_penalty,omitempty"`
Stream bool `json:"stream"`
UserId string `json:"user_id,omitempty"`
PenaltyScore float32 `json:"penalty_score,omitempty"`
Functions []*ErnieFunction `json:"functions,omitempty"`
System string `json:"system,omitempty"`
Stop []string `json:"stop,omitempty"`
DisableSearch bool `json:"disable_search,omitempty"`
EnableCitation bool `json:"enable_citation,omitempty"`
}
type RespPluginUsage ¶
type RespSearchInfo ¶
type RespSearchInfo struct {
IsBeset bool `json:"is_beset"`
ReWrite string `json:"re_write"`
SearchResults []*RespSearchResult `json:"search_results,omitempty"`
}
type RespSearchResult ¶
type RespUsage ¶
type RespUsage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
Plugins []*RespPluginUsage `json:"plugins,omitempty"`
}
type Response ¶
type Response struct {
RespError
ID string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
SentenceId int `json:"sentence_id"`
BanRound int `json:"ban_round"`
IsEnd bool `json:"is_end"`
IsTruncated bool `json:"is_truncated"`
NeedClearHistory bool `json:"need_clear_history"`
FinishReason string `json:"finish_reason"`
Result string `json:"result"`
Usage RespUsage `json:"usage"`
FunctionCall *ErnieFunctionCall `json:"function_call,omitempty"`
SearchInfo *RespSearchInfo `json:"search_info,omitempty"`
}
type ResponseAccessToken ¶
type ResponseAccessToken struct {
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
SessionKey string `json:"session_key"`
AccessToken string `json:"access_token"`
Scope string `json:"scope"`
SessionSecret string `json:"session_secret"`
Error string `json:"error"`
ErrorDescription string `json:"error_description"`
}
Click to show internal directories.
Click to hide internal directories.