Documentation ¶
Index ¶
- Variables
- func Client() *http.Client
- type ChatCompletionsMessage
- type ChatCompletionsUsage
- type Config
- type ImagesGenerationsReq
- type ImagesGenerationsRes
- type ImagesGenerationsResData
- type ReqChatCompletions
- type Request
- func ChatCompletions(apiKey string, reqChatCompletions *ReqChatCompletions) (*Request[ReqChatCompletions, ResChatCompletions], error)
- func ImagesEdit(apiKey string, reqChatCompletions *ImagesGenerationsReq) (*Request[ImagesGenerationsReq, ImagesGenerationsRes], error)
- func ImagesGenerations(apiKey string, reqChatCompletions *ImagesGenerationsReq) (*Request[ImagesGenerationsReq, ImagesGenerationsRes], error)
- type ResChatCompletions
- type ResChatCompletionsChoice
Constants ¶
This section is empty.
Variables ¶
View Source
var ( URL = "https://api.openai.com" ContentType = "application/json" Timeout = 10 * time.Minute MaxIdleConns = 100 Bearer = "Bearer " Authorization = "Authorization" )
Functions ¶
Types ¶
type ChatCompletionsMessage ¶
type ChatCompletionsUsage ¶
type ImagesGenerationsReq ¶ added in v0.2.0
type ImagesGenerationsRes ¶ added in v0.2.0
type ImagesGenerationsRes struct { Created int64 `json:"created"` Data []ImagesGenerationsResData `json:"data"` }
type ImagesGenerationsResData ¶ added in v0.2.0
type ImagesGenerationsResData struct {
Url string `json:"url"`
}
type ReqChatCompletions ¶
type ReqChatCompletions struct { Model string `json:"model"` Messages []ChatCompletionsMessage `json:"messages"` Stream bool `json:"stream"` }
type Request ¶
type Request[RequestBody any, ResponseResult any] struct { Url string Method string Headers map[string]string Body *RequestBody Response *ResponseResult StatusCode int HttpResponse *http.Response ApiKey string }
func ChatCompletions ¶
func ChatCompletions(apiKey string, reqChatCompletions *ReqChatCompletions) (*Request[ReqChatCompletions, ResChatCompletions], error)
func ImagesEdit ¶ added in v0.2.1
func ImagesEdit(apiKey string, reqChatCompletions *ImagesGenerationsReq) (*Request[ImagesGenerationsReq, ImagesGenerationsRes], error)
func ImagesGenerations ¶ added in v0.2.0
func ImagesGenerations(apiKey string, reqChatCompletions *ImagesGenerationsReq) (*Request[ImagesGenerationsReq, ImagesGenerationsRes], error)
type ResChatCompletions ¶
type ResChatCompletions struct { Id string `json:"id"` Object string `json:"object"` Created int64 `json:"created"` Model string `json:"model"` Usage ChatCompletionsUsage `json:"usage"` Choices []ResChatCompletionsChoice `json:"choices"` }
type ResChatCompletionsChoice ¶
type ResChatCompletionsChoice struct { Index int `json:"index"` Message ChatCompletionsMessage `json:"message"` FinishReason string `json:"finish_reason"` }
Click to show internal directories.
Click to hide internal directories.