openai_dalle

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseApiUrl = "https://api.openai.com/v1/images"

	ApiImageGeneration = "/generations"
	ApiImageEdit       = "/edits"
	ApiImageVariation  = "/variations"
)
View Source
const (
	Size256  = "256x256"
	Size512  = "512x512"
	Size1024 = "1024x1024"
)

256x256, 512x512, or 1024x1024

Variables

This section is empty.

Functions

This section is empty.

Types

type DALLESettings

type DALLESettings struct {
	N int `json:"n"`
}

func (*DALLESettings) Load

func (instance *DALLESettings) Load(m map[string]interface{}) (err error)

func (*DALLESettings) Map

func (instance *DALLESettings) Map() (m map[string]interface{})

type OpenAIDALLE

type OpenAIDALLE struct {
	// contains filtered or unexported fields
}

func NewOpenAIDALLE

func NewOpenAIDALLE(settings *commons.SettingsExternal) (instance *OpenAIDALLE, err error)

func (*OpenAIDALLE) Download

func (instance *OpenAIDALLE) Download(url string) (data []byte, err error)

func (*OpenAIDALLE) Generate

func (instance *OpenAIDALLE) Generate(prompt string, payload map[string]interface{}) (images []*model.ProducerItem, err error)

Generate send the prompt to chatGPT payload: optional map to override default parameters (

"n": 1,
"size": "1024x1024")

func (*OpenAIDALLE) Get

func (instance *OpenAIDALLE) Get(url string) (response map[string]interface{}, err error)

func (*OpenAIDALLE) Post

func (instance *OpenAIDALLE) Post(url string, body interface{}) (response map[string]interface{}, err error)

func (*OpenAIDALLE) Upload

func (instance *OpenAIDALLE) Upload(url string, filename string, params map[string]interface{}) (response map[string]interface{}, err error)

func (*OpenAIDALLE) UploadData

func (instance *OpenAIDALLE) UploadData(url string, data []byte, params map[string]interface{}) (response map[string]interface{}, err error)

func (*OpenAIDALLE) Variation

func (instance *OpenAIDALLE) Variation(sourceBytes []byte, payload map[string]interface{}) (images []*model.ProducerItem, err error)

Jump to

Keyboard shortcuts

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