model

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 1 Imported by: 5

Documentation

Index

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 Button

type Button struct {
	CustomId string `json:"customId,omitempty"`
	Emoji    string `json:"emoji,omitempty"`
	Label    string `json:"label,omitempty"`
	Style    int    `json:"style,omitempty"`
	Type     int    `json:"type,omitempty"`
}

type Chat added in v0.1.2

type Chat struct {
	// req
	Domain          string `json:"domain"`
	RandomThreshold int    `json:"random_threshold"`
	MaxTokens       int    `json:"max_tokens"`
}

type ChatCompletionChoice added in v0.1.2

type ChatCompletionChoice struct {
	Index                int                                    `json:"index"`
	Message              openai.ChatCompletionMessage           `json:"message"`
	Delta                openai.ChatCompletionStreamChoiceDelta `json:"delta"`
	LogProbs             *openai.LogProbs                       `json:"logprobs"`
	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"`
	// Deprecated: use Tools instead.
	Functions []openai.FunctionDefinition `json:"functions,omitempty"`
	// Deprecated: use ToolChoice instead.
	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"`
	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 Choices added in v0.1.2

type Choices struct {
	// res
	Status int    `json:"status,omitempty"`
	Seq    int    `json:"seq,omitempty"`
	Text   []Text `json:"text,omitempty"`
}

type Filter

type Filter struct {
	ChannelId  string `json:"channelId,omitempty"`
	InstanceId string `json:"instanceId,omitempty"`
	Remark     string `json:"remark,omitempty"`
}
type Header struct {
	// req
	AppId string `json:"app_id"`
	Uid   string `json:"uid"`
	// res
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
	Sid     string `json:"sid,omitempty"`
	Status  int    `json:"status,omitempty"`
}

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 Parameter added in v0.1.2

type Parameter struct {
	// req
	Chat *Chat `json:"chat"`
}

type Payload added in v0.1.2

type Payload struct {
	// req
	Message *Message `json:"message"`
	// res
	Choices *Choices `json:"choices,omitempty"`
	Usage   *Usage   `json:"usage,omitempty"`
}

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 SparkReq added in v0.1.2

type SparkReq struct {
	Header    Header    `json:"header"`
	Parameter Parameter `json:"parameter"`
	Payload   Payload   `json:"payload"`
}

type SparkRes added in v0.1.2

type SparkRes struct {
	Content string  `json:"content"`
	Header  Header  `json:"header"`
	Payload Payload `json:"payload"`
}

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"`

	// 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"`
}

type Usage added in v0.1.2

type Usage struct {
	// res
	Text *Text `json:"text,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL