generate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_PROMPT_LENGTH = 10000

MAX_PROMPT_LENGTH is the maximum length of a prompt

View Source
const MAX_SEED = 4294967294

MAX_SEED is the maximum seed value

View Source
const MODULE_NAME = "stabilityV3"

Variables

View Source
var ASPECT_RATIOS = []string{"16:9", "1:1", "21:9", "2:3", "3:2", "4:5", "5:4", "9:16", "9:21"}

ASPECT_RATIOS is a list of valid aspect ratios

View Source
var ENDPOINT = stability.ENDPOINT_ROOT + "/v2beta/stable-image/generate/sd3"

ENDPOINT is the endpoint for V3 requests

View Source
var MODELS = []string{"sd3", "sd3-turbo"}

MODELS is a list of valid models for V3 endpoints

View Source
var OUTPUT_FORMATS = []string{"jpeg", "png"}

OUTPUT_FORMATS is a list of valid output formats for V3 endpoints

Functions

This section is empty.

Types

type ErrEmptyResponse

type ErrEmptyResponse struct {
	Err error
	Msg string
}

func (*ErrEmptyResponse) Error

func (e *ErrEmptyResponse) Error() string

type ErrFetchingReturnHeader

type ErrFetchingReturnHeader struct {
	Err    error
	Msg    string
	Header string
}

func (*ErrFetchingReturnHeader) Error

func (e *ErrFetchingReturnHeader) Error() string

type ErrInvalidAspectRatio

type ErrInvalidAspectRatio struct {
	Err error
	Msg string
}

func (*ErrInvalidAspectRatio) Error

func (e *ErrInvalidAspectRatio) Error() string

type ErrInvalidModel

type ErrInvalidModel struct {
	Err error
	Msg string
}

func (*ErrInvalidModel) Error

func (e *ErrInvalidModel) Error() string

type ErrInvalidOutputFormat

type ErrInvalidOutputFormat struct {
	Err error
	Msg string
}

func (*ErrInvalidOutputFormat) Error

func (e *ErrInvalidOutputFormat) Error() string

type ErrInvalidSeed

type ErrInvalidSeed struct {
	Err error
	Msg string
}

func (*ErrInvalidSeed) Error

func (e *ErrInvalidSeed) Error() string

type ErrJsonResponseNotSupported

type ErrJsonResponseNotSupported struct {
	Err error
	Msg string
}

func (*ErrJsonResponseNotSupported) Error

type ErrMissingLogger

type ErrMissingLogger struct {
	Err error
	Msg string
}

func (*ErrMissingLogger) Error

func (e *ErrMissingLogger) Error() string

type ErrMissingPrompt

type ErrMissingPrompt struct {
	Err error
	Msg string
}

func (*ErrMissingPrompt) Error

func (e *ErrMissingPrompt) Error() string

type ErrMissingStability

type ErrMissingStability struct {
	Err error
	Msg string
}

func (*ErrMissingStability) Error

func (e *ErrMissingStability) Error() string

type Option

type Option func(config *StabilityV3)

func WithAspectRatio

func WithAspectRatio(aspectRatio string) Option

func WithLogger

func WithLogger(log *slog.Logger) Option

func WithModel

func WithModel(model string) Option

func WithNegativePrompt

func WithNegativePrompt(negativePrompt string) Option

func WithOutputFormat

func WithOutputFormat(outputFormat string) Option

func WithPrompt

func WithPrompt(prompt string) Option

func WithSeed

func WithSeed(seed int) Option

func WithStability

func WithStability(stability *stability.Stability) Option

type Request

type Request struct {
	Prompt         string `json:"prompt"`
	AspectRatio    string `json:"aspect_ratio"`
	Mode           string `json:"mode"`
	NegativePrompt string `json:"negative_prompt"`
	Model          string `json:"model"`
	Seed           int    `json:"seed"`
	OutputFormat   string `json:"output_format"`
}

type Response

type Response struct {
	Metadata *ResponseMetadata `json:"data,omitempty"`
	Errors   *ResponseErrors   `json:"errors,omitempty"`
	Image    *[]byte           `json:"image,omitempty"`
}

type ResponseErrors

type ResponseErrors struct {
	Name   string   `json:"name"`
	Errors []string `json:"errors"`
}

type ResponseMetadata

type ResponseMetadata struct {
	ContextType  string `json:"context_type"`
	FinishReason string `json:"finish_reason"`
	Seed         int    `json:"seed"`
}

type StabilityV3

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

Configuration structure.

func New

func New(opts ...func(*StabilityV3)) (*StabilityV3, error)

func (*StabilityV3) Generate

func (c *StabilityV3) Generate() (*Response, error)

func (*StabilityV3) SetAspectRatio

func (c *StabilityV3) SetAspectRatio(aspectRatio string)

func (*StabilityV3) SetModel

func (c *StabilityV3) SetModel(model string)

func (*StabilityV3) SetNegativePrompt

func (c *StabilityV3) SetNegativePrompt(negativePrompt string)

func (*StabilityV3) SetPrompt

func (c *StabilityV3) SetPrompt(prompt string)

func (*StabilityV3) SetSeed

func (c *StabilityV3) SetSeed(seed int)

Jump to

Keyboard shortcuts

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