Image Gen Utility

Advanced utilities for cleaning image prompts and handling fallbacks

Image Gen Utility

AI-generated

Summary

Clean and extract a refined image generation prompt from raw LLM output by optionally filtering acronyms and handling specific markup.

Inputs

  • Raw LLM Output (required) — The raw textual output from an Image Prompt agent (LLM), which may contain special markers and labeled sections.
  • Filter for Acronyms — Boolean flag to control whether to strip regular words and keep only uppercase acronyms/icons in the prompt, useful for styles requiring acronym filtering; defaults to true.

Output shape

A list of JSON objects each containing 'finalPrompt' (the cleaned and optionally filtered prompt string) and 'original' (the original raw LLM output string).

If the raw output contains markers 'START IMAGE GENERATION OUTPUT HERE' and 'END IMAGE GENERATION OUTPUT HERE', the text between them is extracted. If the extracted text includes '### Primary Prompt', only the text following this label up to two newlines is kept. If 'Filter for Acronyms' is true, a simplified whitespace normalization is applied by trimming and joining lines. Errors are captured per item if 'continueOnFail' is enabled.

Links

Discussion