dalle

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddFiles

type AddFiles struct {
	Image    []byte `json:"image"`
	FileName string `json:"file_name"`
}

AddFiles is the request for the addFiles endpoint

type Dalle

type Dalle constants.SubClient

Dalle allows access to all Dalle type endpoints

func (*Dalle) Do

func (d *Dalle) Do(data constants.RequestData, i interface{}) *errors.HttpError

Do fires the request as needed

func (*Dalle) GenerateImages

func (d *Dalle) GenerateImages(prompt string, n int, size string, userId string) (*GenerateImagesResponse, error)

GenerateImages generates images from a prompt

prompt: The prompt to generate images from n: The number of images to generate size: The size of the images to generate userId: The user id to generate the images for that specific user, openAI keeps a track of the images generated for each user

func (*Dalle) InitEditImages

func (d *Dalle) InitEditImages(prompt string, n int, size string, userId string) *EditImagesRequest

InitEditImages initialises the EditImagesRequest struct

type EditImageResponse

type EditImageResponse struct {
	Created int `json:"created"`
	Data    []struct {
		Url string `json:"url"`
	} `json:"data"`
}

EditImageResponse is the response sent by the editImages endpoint

type EditImagesPrompt

type EditImagesPrompt struct {
	Prompt   string `json:"prompt"`
	N        int    `json:"n"`
	Size     string `json:"size"`
	UserName string `json:"user"`
}

EditImagesPrompt is the prompt for the editImages endpoint

type EditImagesRequest

type EditImagesRequest struct {
	Image []byte `json:"image"`
	Mask  []byte `json:"mask"`
	// contains filtered or unexported fields
}

EditImagesRequest is the request for the editImages endpoint

func (*EditImagesRequest) AddImage

func (e *EditImagesRequest) AddImage(image []byte) *EditImagesRequest

AddImage adds bytes to EditImagesRequest, this is used to add the image to the request

func (*EditImagesRequest) AddImageFromFileSystem

func (e *EditImagesRequest) AddImageFromFileSystem(image *os.File) *EditImagesRequest

AddImageFromFileSystem adds an image to the EditImagesRequest

func (*EditImagesRequest) AddMask

func (e *EditImagesRequest) AddMask(mask []byte) *EditImagesRequest

AddMask adds bytes to EditImagesRequest, this is used to add the mask to the request

func (*EditImagesRequest) AddMaskFromFileSystem

func (e *EditImagesRequest) AddMaskFromFileSystem(mask *os.File) *EditImagesRequest

AddMaskFromFileSystem adds a mask to the EditImagesRequest

func (*EditImagesRequest) Do

Do fires the request, returns an EditImageResponse

type GenerateImagesPrompt

type GenerateImagesPrompt struct {
	Prompt   string `json:"prompt"`
	N        int    `json:"n"`
	Size     string `json:"size"`
	UserName string `json:"user"`
}

GenerateImagesPrompt is the prompt for the generateImages endpoint

type GenerateImagesResponse

type GenerateImagesResponse struct {
	Created int `json:"created"`
	Data    []struct {
		Url string `json:"url"`
	} `json:"data"`
}

GenerateImagesRequest is the request for the generateImages endpoint

Jump to

Keyboard shortcuts

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