Skip to content

Prompt image generation engine

PromptImageGenerationEngine

Bases: BaseImageGenerationEngine

Source code in griptape/griptape/engines/image/prompt_image_generation_engine.py
@define
class PromptImageGenerationEngine(BaseImageGenerationEngine):
    def run(
        self,
        prompts: list[str],
        negative_prompts: list[str] | None = None,
        rulesets: list[Ruleset] | None = None,
        negative_rulesets: list[Ruleset] | None = None,
    ) -> ImageArtifact:
        prompts = self._ruleset_to_prompts(prompts, rulesets)
        negative_prompts = self._ruleset_to_prompts(negative_prompts, negative_rulesets)

        return self.image_generation_driver.run_text_to_image(prompts, negative_prompts=negative_prompts)

run(prompts, negative_prompts=None, rulesets=None, negative_rulesets=None)

Source code in griptape/griptape/engines/image/prompt_image_generation_engine.py
def run(
    self,
    prompts: list[str],
    negative_prompts: list[str] | None = None,
    rulesets: list[Ruleset] | None = None,
    negative_rulesets: list[Ruleset] | None = None,
) -> ImageArtifact:
    prompts = self._ruleset_to_prompts(prompts, rulesets)
    negative_prompts = self._ruleset_to_prompts(negative_prompts, negative_rulesets)

    return self.image_generation_driver.run_text_to_image(prompts, negative_prompts=negative_prompts)