Documentation ¶
Index ¶
- Constants
- func TransDecorate(content, language string) (string, error)
- func Version() string
- type ChatCompChoice
- type ChatCompMsg
- type ChatCompReq
- type ChatCompRes
- type Client
- func (client *Client) Ask(ctx context.Context, content string) (ans string, err error)
- func (client *Client) ChatCompletions(ctx context.Context, req *ChatCompReq) (res *ChatCompRes, err error)
- func (client *Client) ImgGen(ctx context.Context, req *ImgGenReq) (res *ImgGenRes, err error)
- func (client *Client) Models(ctx context.Context) (res *ModelsRes, err error)
- func (client *Client) Trans2Cn(ctx context.Context, content string) (ans string, err error)
- func (client *Client) Trans2En(ctx context.Context, content string) (ans string, err error)
- type Config
- type ImgGenReq
- type ImgGenRes
- type Model
- type ModelsRes
- type Permission
Constants ¶
View Source
const ( English = "English" Chinese = "Chinese" )
Variables ¶
This section is empty.
Functions ¶
func TransDecorate ¶
Types ¶
type ChatCompChoice ¶
type ChatCompChoice struct { Message ChatCompMsg `json:"message,omitempty"` FinishReason string `json:"finish_reason,omitempty"` Index uint `json:"index,omitempty"` }
type ChatCompMsg ¶
type ChatCompReq ¶
type ChatCompReq struct { Model string `json:"model"` Temperature float32 `json:"temperature"` Messages []ChatCompMsg `json:"messages"` }
func (*ChatCompReq) Validate ¶
func (req *ChatCompReq) Validate() (err error)
type ChatCompRes ¶
type ChatCompRes struct { Id string `json:"id,omitempty"` Object string `json:"object,omitempty"` Created int64 `json:"created,omitempty"` Model string `json:"model,omitempty"` Usage struct { PromptTokens uint32 `json:"prompt_tokens,omitempty"` CompletionTokens uint32 `json:"completion_tokens,omitempty"` TotalTokens uint32 `json:"total_tokens,omitempty"` } `json:"usage,omitempty"` Choices []ChatCompChoice `json:"choices,omitempty"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChatCompletions ¶
func (client *Client) ChatCompletions(ctx context.Context, req *ChatCompReq) (res *ChatCompRes, err error)
type Config ¶
type ImgGenReq ¶
type ImgGenRes ¶
type Permission ¶
type Permission struct { Id string `json:"id,omitempty"` Object string `json:"object,omitempty"` Created int64 `json:"created,omitempty"` Organization string `json:"organization,omitempty"` AllowCreateEngine bool `json:"allow_create_engine,omitempty"` AllowSampling bool `json:"allow_sampling,omitempty"` AllowLogprobs bool `json:"allow_logprobs,omitempty"` AllowSearch_indices bool `json:"allow_search_indices,omitempty"` AllowView bool `json:"allow_view,omitempty"` AllowFineTuning bool `json:"allow_fine_tuning,omitempty"` IsBlocking bool `json:"is_blocking,omitempty"` }
Click to show internal directories.
Click to hide internal directories.