image

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package image contains a client for OpenAI's images API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// CreateEndpoint allows overriding the default
	// for the image generation API endpoint.
	// Set this field before using the client.
	CreateEndpoint string
	// contains filtered or unexported fields
}

Client is a client to communicate with Open AI's images API.

func NewClient

func NewClient(session *openai.Session) *Client

func (*Client) Create

func (c *Client) Create(ctx context.Context, p *CreateParams) (*CreateResponse, error)

type CreateParams

type CreateParams struct {
	Prompt string `json:"prompt,omitempty"`
	N      int    `json:"n,omitempty"`
	Size   string `json:"size,omitempty"`
	Format string `json:"response_format,omitempty"`
	User   string `json:"user,omitempty"`
}

type CreateResponse

type CreateResponse struct {
	CreatedAt int64    `json:"created_at,omitempty"`
	Data      []*Image `json:"data,omitempty"`
}

type Image

type Image struct {
	URL        string `json:"url,omitempty"`
	Base64JSON string `json:"b64_json,omitempty"`
}

func (*Image) Reader

func (i *Image) Reader() (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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