Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaiduClient ¶
type BaiduClient struct {
// contains filtered or unexported fields
}
func NewBaiduClient ¶
func NewBaiduClient(key, secret string) *BaiduClient
func (*BaiduClient) Close ¶
func (bc *BaiduClient) Close()
func (*BaiduClient) Complete ¶
func (bc *BaiduClient) Complete(text string) (*ErnieBotResponse, error)
func (*BaiduClient) GetAccessToken ¶
func (bc *BaiduClient) GetAccessToken() string
func (*BaiduClient) RefreshToken ¶
func (bc *BaiduClient) RefreshToken()
RefreshToken periodically refreshes the access token
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
type ErnieBotResponse ¶
type ErnieBotResponse struct { ID string `json:"id"` Object string `json:"object"` Created int64 `json:"created"` Result string `json:"result"` IsTruncated bool `json:"is_truncated"` NeedClearHistory bool `json:"need_clear_history"` Usage map[string]interface{} `json:"usage"` }
ErnieBotResponse represents the response from ERNIE Bot
type Request ¶
type Request struct {
Messages []UserMessage `json:"messages"`
}
Update Request structure to use UserMessage
type UserMessage ¶
UserMessage represents the user message structure for the Baidu API
Click to show internal directories.
Click to hide internal directories.