NAME

Langertha::ImageGen - Image generation abstraction wrapping an engine with optional overrides

VERSION

version 0.302

SYNOPSIS

use Langertha::Engine::OpenAI;
use Langertha::ImageGen;

my $engine = Langertha::Engine::OpenAI->new(
    api_key => $ENV{OPENAI_API_KEY},
);

my $image_gen = Langertha::ImageGen->new(
    engine  => $engine,
    model   => 'dall-e-3',
    size    => '1024x1024',
    quality => 'hd',
    plugins => ['Langfuse'],
);

my $result = $image_gen->simple_image('A cat riding a bicycle through Paris');

DESCRIPTION

Langertha::ImageGen wraps any engine that consumes Langertha::Role::ImageGeneration and adds optional overrides for model, size, and quality, plus plugin lifecycle hooks via Langertha::Role::PluginHost.

Use this class when you need multiple image generation configurations from the same engine instance, or when you want plugin observability (e.g. Langertha::Plugin::Langfuse) without modifying the engine.

engine

The LLM engine to delegate image generation requests to. Must consume Langertha::Role::ImageGeneration.

model

Optional model name override. When set, overrides the engine's image_model via %extra pass-through.

size

Optional image size (e.g. '1024x1024', '1792x1024').

quality

Optional quality setting (e.g. 'standard', 'hd').

simple_image

my $result = $image_gen->simple_image('A cat in space');

Returns the image generation result for $prompt. If model, size, or quality overrides are set, uses them via %extra; otherwise delegates to the engine's simple_image. Plugin hooks plugin_before_image_gen and plugin_after_image_gen are fired.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudss.us/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.