Versions in this module Expand all Collapse all v1 v1.1.0 Nov 12, 2023 Changes in this version + const ACCESS_TOKEN_KEY + const RoleAssistant + const RoleUser + func ChatCompletion(ctx context.Context, request openai.ChatCompletionRequest, retry ...int) (openai.ChatCompletionResponse, error) + func ChatCompletionStream(ctx context.Context, request openai.ChatCompletionRequest, retry ...int) (responseChan chan openai.ChatCompletionStreamResponse, err error) + func GenImage(ctx context.Context, model, prompt string) (url string, err error) + func GenImageBase64(ctx context.Context, model, prompt string, retry ...int) (string, error) + func Init(ctx context.Context, model string) + func MidjourneyProxy(ctx context.Context, prompt string) (*model.Image, error) + func MidjourneyProxyBlend(ctx context.Context, midjourneyProxyBlendReq *model.MidjourneyProxyBlendReq) (*model.MidjourneyProxyBlendRes, error) + func MidjourneyProxyChange(ctx context.Context, midjourneyProxyChangeReq *model.MidjourneyProxyChangeReq) (*model.MidjourneyProxyChangeRes, error) + func MidjourneyProxyChanges(ctx context.Context, prompt string) (*model.Image, error) + func MidjourneyProxyDescribe(ctx context.Context, ...) (*model.MidjourneyProxyDescribeRes, error) + func MidjourneyProxyFetch(ctx context.Context, taskId string) (imageInfo *model.Image, midjourneyProxyFetchRes *model.MidjourneyProxyFetchRes, ...) + func MidjourneyProxyImagine(ctx context.Context, ...) (*model.MidjourneyProxyImagineRes, error) + func NumTokensFromMessages(messages []openai.ChatCompletionMessage, model string) (numTokens int, err error) + func NumTokensFromString(text, model string) (int, error) + func SparkStream(ctx context.Context, model, uid string, text []Text, ...) + type Chat struct + Domain string + MaxTokens int + RandomThreshold int + type Choices struct + Seq int + Status int + Text []Text + type ErnieBotMessage struct + Content string + Role string + type ErnieBotReq struct + Messages []ErnieBotMessage + type ErnieBotRes struct + Created int + ErrorCode int + ErrorMsg string + Id string + IsTruncated bool + NeedClearHistory bool + Object string + Result string + Usage struct{ ... } + func ErnieBot(ctx context.Context, model string, messages []ErnieBotMessage, retry ...int) (res *ErnieBotRes, err error) + type GetAccessTokenRes struct + AccessToken string + Error string + ErrorDescription string + ExpiresIn int64 + RefreshToken string + Scope string + SessionKey string + SessionSecret string + type Header struct + AppId string + Code int + Message string + Sid string + Status int + Uid string + type Input struct + History []QwenChatCompletionMessage + Prompt string + type Message struct + Text []Text + type Parameter struct + Chat *Chat + type Payload struct + Choices *Choices + Message *Message + Usage *Usage + type QwenChatCompletionMessage struct + Bot string + User string + type QwenChatCompletionReq struct + Input Input + Model string + Parameters struct{} + type QwenChatCompletionRes struct + Code string + Message string + Output struct{ ... } + RequestId string + Usage struct{ ... } + func QwenChatCompletion(ctx context.Context, model string, messages []QwenChatCompletionMessage, ...) (res *QwenChatCompletionRes, err error) + type SparkReq struct + Header Header + Parameter Parameter + Payload Payload + type SparkRes struct + Content string + Header Header + Payload Payload + func Spark(ctx context.Context, model, uid string, text []Text, retry ...int) (res *SparkRes, err error) + type Text struct + CompletionTokens int + Content string + Index int + PromptTokens int + QuestionTokens int + Role string + TotalTokens int + type Usage struct + Text *Text