When Structure Meets Modality

The prompts.chat toolkit carries the build-bind-check model beyond text chat by giving image, video, and audio prompts their own structured builders. This chapter asks which design decisions remain common across modalities and which must become specialized fields. The practical value is a way to describe a media request precisely without mistaking a TypeScript schema for a guarantee that every target generator supports or realizes the same instruction.

One construction surface, several kinds of output

The common idea is familiar from the chat builder: a useful prompt contains decisions that should be named, inspected, and changed independently. In chat, those decisions include persona, context, task, messages, memory, and output format. In media generation, the output is still an instruction for a model, but the controllable dimensions change. A visual request may depend on subject, environment, camera, lighting, composition, style, color, mood, and technical output. A video request adds scene, action, motion, pacing, transitions, and duration. An audio request may depend on genre, mood, tempo, vocals, instruments, structure, and production choices.

prompts.chat presents these as branches of one developer toolkit. The package exports chat, image, video, and audio builders through a common entry point, while each builder exposes domain-specific methods and structured results. That combination matters. A single generic text field would be easy to share but would hide the decisions that make a media prompt useful. A separate, unrelated API for every modality would preserve detail but make the developer’s workflow harder to learn and maintain.

classDiagram class PromptConstruction { +build() +toJSON() +rendered prompt +structured representation } class ChatPrompt { +persona +context +task +messages +output } class ImagePrompt { +subject +environment +camera +lighting +style +technical output } class VideoPrompt { +scene +subject +movement +pacing +audio +duration } class AudioPrompt { +genre +mood +tempo +vocals +instrumentation +structure } PromptConstruction <|-- ChatPrompt PromptConstruction <|-- ImagePrompt PromptConstruction <|-- VideoPrompt PromptConstruction <|-- AudioPrompt

The diagram is an architectural comparison, not a claim that the four builders share identical fields. They share a construction pattern: collect choices, retain a structured representation, and render an output suitable for a model or an integration. Their fields differ because the causal factors in the generated artifact differ.

This distinction prevents two opposite mistakes. The first is to treat a media prompt as an ordinary sentence that becomes better only by adding adjectives. The second is to assume that every available field must be filled. A schema exposes options; it does not say that a given task needs every option. The builder is useful when it makes a meaningful decision explicit, not when it turns a small request into an inventory.