Documentation
¶
Index ¶
- type AccountFilter
- type Button
- type Chat
- type ChatCompletionChoice
- type ChatCompletionRequest
- type ChatCompletionResponse
- type Choices
- type Filter
- type Functions
- type Header
- type ImageRequest
- type ImageResponse
- type Message
- type MidjourneyProxy
- type MidjourneyProxyFetchResponse
- type MidjourneyProxyRequest
- type MidjourneyProxyResponse
- type Parameter
- type Payload
- type Properties
- type SparkReq
- type SparkRes
- type Text
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountFilter ¶
type AccountFilter struct {
ChannelId string `json:"channelId,omitempty"`
InstanceId string `json:"instanceId,omitempty"`
Modes []string `json:"modes,omitempty"`
Remark string `json:"remark,omitempty"`
Remix bool `json:"remix,omitempty"`
RemixAutoConsidered bool `json:"remixAutoConsidered,omitempty"`
}
type ChatCompletionChoice ¶ added in v0.1.2
type ChatCompletionChoice struct {
Index int `json:"index"`
Message *openai.ChatCompletionMessage `json:"message,omitempty"`
Delta *openai.ChatCompletionStreamChoiceDelta `json:"delta,omitempty"`
LogProbs *openai.LogProbs `json:"logprobs,omitempty"`
FinishReason openai.FinishReason `json:"finish_reason"`
ContentFilterResults *openai.ContentFilterResults `json:"content_filter_results,omitempty"`
}
type ChatCompletionRequest ¶ added in v0.1.2
type ChatCompletionRequest struct {
Model string `json:"model"`
Messages []openai.ChatCompletionMessage `json:"messages"`
MaxTokens int `json:"max_tokens,omitempty" d:"4096"`
Temperature float32 `json:"temperature,omitempty"`
TopP float32 `json:"top_p,omitempty"`
N int `json:"n,omitempty"`
Stream bool `json:"stream,omitempty"`
Stop []string `json:"stop,omitempty"`
PresencePenalty float32 `json:"presence_penalty,omitempty"`
ResponseFormat *openai.ChatCompletionResponseFormat `json:"response_format,omitempty"`
Seed *int `json:"seed,omitempty"`
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
// LogitBias is must be a token id string (specified by their token ID in the tokenizer), not a word string.
// incorrect: `"logit_bias":{"You": 6}`, correct: `"logit_bias":{"1639": 6}`
// refs: https://platform.openai.com/docs/api-reference/chat/create#chat/create-logit_bias
LogitBias map[string]int `json:"logit_bias,omitempty"`
// LogProbs indicates whether to return log probabilities of the output tokens or not.
// If true, returns the log probabilities of each output token returned in the content of message.
// This option is currently not available on the gpt-4-vision-preview model.
LogProbs bool `json:"logprobs,omitempty"`
// TopLogProbs is an integer between 0 and 5 specifying the number of most likely tokens to return at each
// token position, each with an associated log probability.
// logprobs must be set to true if this parameter is used.
TopLogProbs int `json:"top_logprobs,omitempty"`
User string `json:"user,omitempty"`
Functions []openai.FunctionDefinition `json:"functions,omitempty"`
FunctionCall any `json:"function_call,omitempty"`
Tools []openai.Tool `json:"tools,omitempty"`
// This can be either a string or an ToolChoice object.
ToolChoice any `json:"tool_choice,omitempty"`
}
ChatCompletionRequest represents a request structure for chat completion API.
type ChatCompletionResponse ¶
type ChatCompletionResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []ChatCompletionChoice `json:"choices"`
Usage *openai.Usage `json:"usage"`
SystemFingerprint string `json:"system_fingerprint,omitempty"`
PromptAnnotations []openai.PromptAnnotation `json:"prompt_annotations,omitempty"`
ConnTime int64 `json:"-"`
Duration int64 `json:"-"`
TotalTime int64 `json:"-"`
}
ChatCompletionResponse represents a response structure for chat completion API.
type Functions ¶ added in v0.1.3
type Functions struct {
// req
Text []openai.FunctionDefinition `json:"text"`
}
type ImageRequest ¶ added in v0.1.2
type ImageRequest struct {
Prompt string `json:"prompt,omitempty"`
Model string `json:"model,omitempty"`
N int `json:"n,omitempty"`
Quality string `json:"quality,omitempty"`
Size string `json:"size,omitempty"`
Style string `json:"style,omitempty"`
ResponseFormat string `json:"response_format,omitempty"`
User string `json:"user,omitempty"`
}
ImageRequest represents the request structure for the image API.
type ImageResponse ¶
type ImageResponse struct {
Created int64 `json:"created,omitempty"`
Data []openai.ImageResponseDataInner `json:"data,omitempty"`
TotalTime int64 `json:"-"`
}
type Message ¶ added in v0.1.2
type Message struct {
// req
Text []openai.ChatCompletionMessage `json:"text"`
}
type MidjourneyProxy ¶
type MidjourneyProxy struct {
ApiSecret string `json:"api_secret"`
ApiSecretHeader string `json:"api_secret_header"`
ImagineUrl string `json:"imagine_url"`
ChangeUrl string `json:"change_url"`
DescribeUrl string `json:"describe_url"`
BlendUrl string `json:"blend_url"`
SwapFaceUrl string `json:"swap_face_url"`
ActionUrl string `json:"action_url"`
ModalUrl string `json:"modal_url"`
ShortenUrl string `json:"shorten_url"`
UploadDiscordImagesUrl string `json:"upload_discord_images_url"`
FetchUrl string `json:"fetch_url"`
}
type MidjourneyProxyFetchResponse ¶
type MidjourneyProxyFetchResponse struct {
Id string `json:"id,omitempty"`
Action string `json:"action,omitempty"`
Buttons []*Button `json:"buttons,omitempty"`
Description string `json:"description,omitempty"`
FailReason string `json:"failReason,omitempty"`
ImageUrl string `json:"imageUrl,omitempty"`
Progress string `json:"progress,omitempty"`
Prompt string `json:"prompt,omitempty"`
PromptEn string `json:"promptEn,omitempty"`
Properties *Properties `json:"properties,omitempty"`
SubmitTime int `json:"submitTime,omitempty"`
StartTime int `json:"startTime,omitempty"`
FinishTime int `json:"finishTime,omitempty"`
State string `json:"state,omitempty"`
Status string `json:"status,omitempty"`
TotalTime int64 `json:"-"`
}
type MidjourneyProxyRequest ¶
type MidjourneyProxyRequest struct {
Prompt string `json:"prompt,omitempty"`
Base64 string `json:"base64,omitempty"`
Base64Array []string `json:"base64Array,omitempty"`
Action string `json:"action,omitempty"`
Index int `json:"index,omitempty"`
TaskId string `json:"taskId,omitempty"`
SourceBase64 string `json:"sourceBase64,omitempty"`
TargetBase64 string `json:"targetBase64,omitempty"`
NotifyHook string `json:"notifyHook,omitempty"`
State string `json:"state,omitempty"`
BotType string `json:"botType,omitempty"`
Dimensions string `json:"dimensions,omitempty"`
AccountFilter *AccountFilter `json:"accountFilter,omitempty"`
MaskBase64 string `json:"maskBase64,omitempty"`
Filter *Filter `json:"filter,omitempty"`
}
type MidjourneyProxyResponse ¶
type MidjourneyProxyResponse struct {
Code int `json:"code,omitempty"`
Description string `json:"description,omitempty"`
Result string `json:"result,omitempty"`
Properties *Properties `json:"properties,omitempty"`
TotalTime int64 `json:"-"`
}
type Properties ¶
type Properties struct {
NotifyHook string `json:"notifyHook,omitempty"`
FinalPrompt string `json:"finalPrompt,omitempty"`
MessageId string `json:"messageId,omitempty"`
MessageHash string `json:"messageHash,omitempty"`
ProgressMessageId string `json:"progressMessageId,omitempty"`
Flags int `json:"flags,omitempty"`
Nonce string `json:"nonce,omitempty"`
DiscordInstanceId string `json:"discordInstanceId,omitempty"`
PromptEn string `json:"promptEn,omitempty"`
BannedWord string `json:"bannedWord,omitempty"`
}
type Text ¶ added in v0.1.2
type Text struct {
// req res
Role string `json:"role"`
Content string `json:"content"`
// Choices
Index int `json:"index,omitempty"`
ContentType string `json:"content_type"`
FunctionCall *openai.FunctionCall `json:"function_call"`
// Usage
QuestionTokens int `json:"question_tokens,omitempty"`
PromptTokens int `json:"prompt_tokens,omitempty"`
CompletionTokens int `json:"completion_tokens,omitempty"`
TotalTokens int `json:"total_tokens,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.