Documentation
¶
Overview ¶
Package luma wraps Luma's current Agents API using the official Go SDK.
NewImageModel targets the async /v1/generations endpoint for the uni-1 family. It submits, polls, and downloads expiring output URLs before returning provider-neutral image bytes. ImageModelConfig.OutputOrigins must explicitly authorize their destinations; presigned assets receive neither API credentials nor cookies from the borrowed HTTP client.
ImageRequestOptions supplies native options under ImageRequestExtensionKey. SDK outbound parameter wrappers are not extension input types. Core owns prompt, model, and output format. Video generation is outside core/image.
See https://docs.agents.lumalabs.ai/ for the official reference. Submission and polling metadata, including error envelopes, use Core's httpclient.DefaultMaxJSONResponseBytes. Asset downloads retain their separate MaxOutputBytes budget because binary output has a different lifetime.
Index ¶
Constants ¶
const ( ImageRequestExtensionKey = Provider + "/image_request" ResponseExtensionKey = Provider + "/response" DefaultBaseURL = "https://agents.lumalabs.ai/v1" DefaultPollInterval = 2 * time.Second DefaultPollTimeout = 5 * time.Minute ModelUni1 = "uni-1" ModelUni1Max = "uni-1-max" )
const DefaultMaxOutputBytes = int64(32 * 1024 * 1024)
DefaultMaxOutputBytes bounds how much generated media is read into memory. A provider that returns an unexpectedly large asset would otherwise be able to exhaust the process before the response is ever validated.
const (
Provider = "luma"
)
Provider is the stable backend name for host-side attribution.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImageModel ¶
type ImageModel struct {
// contains filtered or unexported fields
}
ImageModel implements Luma Agents image generation and editing with the official SDK. Provider output URLs are downloaded before they expire.
func NewImageModel ¶
func NewImageModel(ctx context.Context, config ImageModelConfig) (*ImageModel, error)
type ImageModelConfig ¶
type ImageModelConfig struct {
APIKey string
DefaultOptions image.Options
BaseURL string
HTTPClient *http.Client
// OutputOrigins is the host-authorized set of origins for presigned assets.
// The output client never borrows API credentials or the HTTP client cookie jar.
OutputOrigins []string
PollInterval time.Duration
PollTimeout time.Duration
MaxOutputBytes int64
}
func (ImageModelConfig) Validate ¶
func (i ImageModelConfig) Validate() error
type ImageReference ¶ added in v0.38.0
type ImageReference struct {
Data string `json:"data,omitempty"`
FileID string `json:"file_id,omitempty"`
GenerationID string `json:"generation_id,omitempty"`
MediaType string `json:"media_type,omitempty"`
URL string `json:"url,omitempty"`
}
ImageReference identifies one reference through URL, inline base64 Data, GenerationID, or FileID. MediaType describes inline data when used.
func (ImageReference) Validate ¶ added in v0.61.0
func (i ImageReference) Validate() error
type ImageRequestOptions ¶ added in v0.38.0
type ImageRequestOptions struct {
AspectRatio string `json:"aspect_ratio,omitempty"`
ImageRef []ImageReference `json:"image_ref,omitzero"`
Source *ImageReference `json:"source,omitzero"`
Style string `json:"style,omitempty"`
Type string `json:"type,omitempty"`
UserID string `json:"user_id,omitempty"`
WebSearch *bool `json:"web_search,omitzero"`
}
ImageRequestOptions carries Luma image controls under ImageRequestExtensionKey. Core owns prompt, model, and output format. Type defaults to image; image_edit accepts Source as the image to edit. Video and layering use other protocols.
func (*ImageRequestOptions) UnmarshalJSON ¶ added in v0.38.0
func (i *ImageRequestOptions) UnmarshalJSON(data []byte) error
func (ImageRequestOptions) Validate ¶ added in v0.61.0
func (i ImageRequestOptions) Validate() error