Documentation ¶
Index ¶
- Constants
- type ChatBot
- func (bot *ChatBot) Ask(question string) bool
- func (bot *ChatBot) CheckConnectivity() bool
- func (bot *ChatBot) Close(exit bool)
- func (bot *ChatBot) CommandProcessor(original_msg string, arr_cmd []string) (string, bool, error)
- func (bot *ChatBot) Run()
- func (bot *ChatBot) Say(msg string, need_dump bool)
- func (bot *ChatBot) ShakeHands() (string, error)
- type ChatGPTCLient
- func (c *ChatGPTCLient) AddMsgHistory(role_name string, content string)
- func (c *ChatGPTCLient) AdjustMsgHistory(init_msg_len int, question_len int, model string) (bool, int)
- func (c *ChatGPTCLient) CreateChatCompletionEx(model string, token_len int, temperature float32, role_name string, ...) (response gpt3.ChatCompletionResponse, err error)
- func (c *ChatGPTCLient) EstimateAvailableTokenNumber(model string, question_leng int) int
- func (c *ChatGPTCLient) GetMaxTokens(model string) int
- func (c *ChatGPTCLient) GetMsgHistoryLength() int
- func (c *ChatGPTCLient) IsAvailable(model string) bool
- func (c *ChatGPTCLient) ListAllModels() []string
- func (c *ChatGPTCLient) ResetMsgHistory(prompt string, opening string)
- func (c *ChatGPTCLient) UserLogin() (string, error)
- func (c *ChatGPTCLient) UserLogout() (string, error)
- func (c *ChatGPTCLient) UserRegistration(email string, endpoint_url string) (string, error)
- type FilePlugin
- type LivePrefixState
- type ModelData
- type ModelPermission
- type ModelsListResponse
- type ObjectType
- type Plugin
- type PluginManager
- type WebSummaryPlugin
Constants ¶
View Source
const ( // execute host command on local machine Ask suggestionType = iota // translate text Translate // data from web page contents Web // data from file contents File // execute host command on local machine Cmd // clear all conversation history Clear // Config system setting Config // show all supported models Models // Reset suggestion Reset // Quit suggestion Quit // Others is key for various arbitrary suggestions Others )
View Source
const PLUGIN_NAME_FILE_CONTENT = "file-content"
View Source
const PLUGIN_NAME_FILE_SUMMARY = "file-summary"
View Source
const PLUGIN_NAME_FILE_TRANSLATE_CN = "file-translate-cn"
View Source
const PLUGIN_NAME_FILE_TRANSLATE_EN = "file-translate-en"
View Source
const PLUGIN_NAME_FILE_TRANSLATE_JP = "file-translate-jp"
View Source
const PLUGIN_NAME_WEB_CONTENT = "web-content"
View Source
const PLUGIN_NAME_WEB_SUMMARY = "web-summary"
View Source
const PLUGIN_NAME_WEB_TRANSLATE_CN = "web-translate-cn"
View Source
const PLUGIN_NAME_WEB_TRANSLATE_EN = "web-translate-en"
View Source
const PLUGIN_NAME_WEB_TRANSLATE_JP = "web-translate-jp"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatBot ¶
type ChatBot struct {
// contains filtered or unexported fields
}
func NewChatbot ¶
func (*ChatBot) CheckConnectivity ¶
func (*ChatBot) CommandProcessor ¶
func (*ChatBot) ShakeHands ¶
type ChatGPTCLient ¶
type ChatGPTCLient struct { gpt3.Client HTTPClient *http.Client // contains filtered or unexported fields }
func NewChatBotClient ¶ added in v0.1.10
func NewChatBotClient(api_key string, api_endpoint string) *ChatGPTCLient
func (*ChatGPTCLient) AddMsgHistory ¶ added in v0.1.10
func (c *ChatGPTCLient) AddMsgHistory(role_name string, content string)
func (*ChatGPTCLient) AdjustMsgHistory ¶ added in v0.1.10
func (*ChatGPTCLient) CreateChatCompletionEx ¶ added in v0.1.10
func (c *ChatGPTCLient) CreateChatCompletionEx( model string, token_len int, temperature float32, role_name string, username string, chat_history *model.ConversationHistory, ) (response gpt3.ChatCompletionResponse, err error)
API call to Create a completion for the chat message.
func (*ChatGPTCLient) EstimateAvailableTokenNumber ¶ added in v0.1.10
func (c *ChatGPTCLient) EstimateAvailableTokenNumber(model string, question_leng int) int
func (*ChatGPTCLient) GetMaxTokens ¶ added in v0.1.8
func (c *ChatGPTCLient) GetMaxTokens(model string) int
please refer to this page for limitation:
https://platform.openai.com/docs/models/gpt-3-5
func (*ChatGPTCLient) GetMsgHistoryLength ¶ added in v0.1.10
func (c *ChatGPTCLient) GetMsgHistoryLength() int
func (*ChatGPTCLient) IsAvailable ¶ added in v0.2.0
func (c *ChatGPTCLient) IsAvailable(model string) bool
check if the model is available
func (*ChatGPTCLient) ListAllModels ¶ added in v0.2.0
func (c *ChatGPTCLient) ListAllModels() []string
func (*ChatGPTCLient) ResetMsgHistory ¶ added in v0.1.10
func (c *ChatGPTCLient) ResetMsgHistory(prompt string, opening string)
func (*ChatGPTCLient) UserLogin ¶
func (c *ChatGPTCLient) UserLogin() (string, error)
func (*ChatGPTCLient) UserLogout ¶
func (c *ChatGPTCLient) UserLogout() (string, error)
func (*ChatGPTCLient) UserRegistration ¶
func (c *ChatGPTCLient) UserRegistration(email string, endpoint_url string) (string, error)
type FilePlugin ¶
type FilePlugin struct {
// contains filtered or unexported fields
}
func (*FilePlugin) Close ¶
func (*FilePlugin) Close() error
func (*FilePlugin) Open ¶
func (plugin *FilePlugin) Open() error
type LivePrefixState ¶
func (*LivePrefixState) ChangeLivePrefix ¶
func (lps *LivePrefixState) ChangeLivePrefix() (string, bool)
func (*LivePrefixState) InputModePadding ¶
func (lps *LivePrefixState) InputModePadding(cmds string) bool
func (*LivePrefixState) ResetInputMode ¶
func (lps *LivePrefixState) ResetInputMode()
type ModelData ¶ added in v0.1.10
type ModelData struct { ID string `json:"id"` Object ObjectType `json:"object"` Created int64 `json:"created"` OwnedBy string `json:"owned_by"` Permission []ModelPermission `json:"permission"` Root string `json:"root"` Parent string `json:"parent"` }
type ModelPermission ¶ added in v0.1.10
type ModelPermission struct { ID string `json:"id"` Object ObjectType `json:"object"` Created int64 `json:"created"` AllowCreateEngine bool `json:"allow_create_engine"` AllowSampling bool `json:"allow_sampling"` AllowLogProbs bool `json:"allow_logprobs"` AllowSearchIndices bool `json:"allow_search_indices"` AllowView bool `json:"allow_view"` AllowFineTuning bool `json:"allow_fine_tuning"` Organization string `json:"organization"` Group string `json:"group"` IsBlocking bool `json:"is_blocking"` }
type ModelsListResponse ¶ added in v0.1.10
type ModelsListResponse struct { Data []ModelData `json:"data"` Object ObjectType }
type ObjectType ¶ added in v0.1.10
type ObjectType string
const ( OTModel ObjectType = "model" OTModelPermission ObjectType = "model_permission" OTList ObjectType = "list" OTEdit ObjectType = "edit" OTTextCompletion ObjectType = "text_completion" OTEEmbedding ObjectType = "embedding" OTFile ObjectType = "file" OTFineTune ObjectType = "fine-tune" OTFineTuneEvent ObjectType = "fine-tune-event" )
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
func NewPluginManager ¶
func NewPluginManager() *PluginManager
func (*PluginManager) AddPlugin ¶
func (pm *PluginManager) AddPlugin(p Plugin)
func (*PluginManager) Close ¶
func (pm *PluginManager) Close() error
func (*PluginManager) Open ¶
func (pm *PluginManager) Open() error
type WebSummaryPlugin ¶
type WebSummaryPlugin struct {
// contains filtered or unexported fields
}
func (*WebSummaryPlugin) Close ¶
func (*WebSummaryPlugin) Close() error
func (*WebSummaryPlugin) Open ¶
func (plugin *WebSummaryPlugin) Open() error
Click to show internal directories.
Click to hide internal directories.