dalle

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client handles DALL-E API requests

func NewClient

func NewClient(apiKey string, httpClient *http.Client) *Client

NewClient creates a new DALL-E client

func (*Client) Prompt

func (c *Client) Prompt(ctx context.Context, r *rq.GenerateImageV1) (string, error)

Prompt sends an image generation request to DALL-E

type ReqDalle

type ReqDalle struct {
	// Prompt is the text prompt for image generation.
	// Required field that guides the image generation process.
	Prompt string `json:"prompt"`

	// Model specifies which DALL-E model to use
	Model llm.ServiceName `json:"model"`

	// N specifies the number of images to generate
	N int `json:"n"`

	// Size specifies the square image size.
	//
	//	- Valid values: "1024x1024", "1792x1024", "1024x1792"
	//	- Cannot be used together with Width and Height
	Size string `json:"size,omitempty"`

	// Width of the generated image in pixels.
	//
	//	- Cannot be used together with Size
	//	- Must be provided together with Height
	Width int `json:"width,omitempty"`

	// Height of the generated image in pixels.
	//
	//	- Cannot be used together with Size
	//	- Must be provided together with Width
	Height int `json:"height,omitempty"`

	// Quality specifies the image generation quality level.
	//
	//	- Only applicable for DALL-E 3
	//	- Valid values: "standard" (default), "hd"
	//	- "hd" provides higher quality but increased cost and latency
	Quality string `json:"quality,omitempty"`

	// Style specifies the visual style of the generated image.
	//
	//	- Valid values: "vivid" (default), "natural"
	//	- "vivid" produces more vibrant and dramatic images
	//	- "natural" produces more subtle and realistic images
	Style string `json:"style,omitempty"`
}

ReqDalle represents a request to generate an image using DALL-E models.

func (*ReqDalle) Build

func (r *ReqDalle) Build() (receiptModel llm.ServiceName, err error)

Build checks if the request parameters are valid. It also fills in default values for missing fields.

func (*ReqDalle) DimToSize

func (r *ReqDalle) DimToSize() (string, error)

func (*ReqDalle) ValidateSizeForModel

func (r *ReqDalle) ValidateSizeForModel() (receiptModel llm.ServiceName, err error)

Jump to

Keyboard shortcuts

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