Documentation
¶
Index ¶
- Constants
- Variables
- func DoRequest(t string) *resty.Request
- type Chatgpt
- type Choice
- type ChoiceText
- type Config
- type DataB64JSON
- type DataURL
- type Error
- type ErrorResponse
- type Message
- type ModelChat
- type ModelChatResponse
- type ModelImages
- type ModelImagesResponse
- type ModelImagesVariations
- type ModelText
- type ModelTextResponse
- type Usage
Constants ¶
View Source
const ChatGPTAPIV1 = "https://api.openai.com/v1"
Variables ¶
View Source
var ( Size1024 = "1024x1024" Size512 = "512x512" Size256 = "256x256" ResponseFormatURL = "url" ResponseFormatB64JSON = "b64_json" )
Functions ¶
Types ¶
type Chatgpt ¶
type Chatgpt interface { ChatCompletions(b ModelChat) (*ModelChatResponse, *ErrorResponse) Completions(b ModelText) (*ModelTextResponse, *ErrorResponse) ImagesGenerations(b ModelImages) (*ModelImagesResponse[DataURL], *ErrorResponse) ImagesGenerationsB64JSON(b ModelImages) (*ModelImagesResponse[DataB64JSON], *ErrorResponse) ImagesVariations(b ModelImagesVariations) (*ModelImagesResponse[DataURL], *ErrorResponse) ImagesVariationsB64JSON(b ModelImagesVariations) (*ModelImagesResponse[DataB64JSON], *ErrorResponse) }
type ChoiceText ¶
type DataB64JSON ¶
type DataB64JSON struct {
B64JSON string `json:"b64_json"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Error Error `json:"error"`
}
type ModelChat ¶
type ModelChat struct { Model string `json:"model"` Messages []Message `json:"messages"` MaxTokens int `json:"max_tokens,omitempty"` Temperature int `json:"temperature,omitempty"` TopP int `json:"top_p,omitempty"` FrequencyPenalty int `json:"frequency_penalty,omitempty"` PresencePenalty int `json:"presence_penalty,omitempty"` }
type ModelChatResponse ¶
type ModelImages ¶
type ModelImagesResponse ¶
type ModelImagesResponse[T DataURL | DataB64JSON] struct { Created int64 `json:"created"` Data []T `json:"data"` }
type ModelImagesVariations ¶
type ModelImagesVariations struct { Image string `json:"image"` // must be valid PNG file, less than 4MB, and square N string `json:"n,omitempty"` // default to 1 Size string `json:"size,omitempty"` // default 1024x1024 ResponseFormat string `json:"response_format,omitempty"` // url or b64_json User string `json:"user,omitempty"` }
type ModelText ¶
type ModelText struct { Model string `json:"model"` Prompt string `json:"prompt"` MaxTokens int `json:"max_tokens,omitempty"` Temperature int `json:"temperature,omitempty"` TopP int `json:"top_p,omitempty"` FrequencyPenalty int `json:"frequency_penalty,omitempty"` PresencePenalty int `json:"presence_penalty,omitempty"` }
type ModelTextResponse ¶
Click to show internal directories.
Click to hide internal directories.