Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:869413421 Ai moive studio KeyframePromptBuilder

From Leeroopedia
Knowledge Sources
Domains Prompt_Engineering, Generative_AI
Last Updated 2026-10-23 12:00 GMT

Overview

Pattern that constructs keyframe image generation prompts by composing static style constants with dynamic shot, scene, character, and previous-shot context.

Description

KeyframePromptBuilder is a pattern doc that defines the interface for building keyframe generation prompts. It uses class-level constants (CORE_STYLE, TECHNICAL_SPECS, FORBIDDEN_ELEMENTS, NO_PEOPLE_FORBIDDEN_ELEMENTS) combined with dynamic context (shot description, dialogue, previous shot context) to produce a full English prompt.

The builder adapts the forbidden elements list based on whether the shot contains characters: shots with people use FORBIDDEN_ELEMENTS (no 3D, CGI, game style), while empty shots use NO_PEOPLE_FORBIDDEN_ELEMENTS (no human presence, portraits, or human-like shapes).

Custom prompts are supported but still get CORE_STYLE and TECHNICAL_SPECS appended for consistency.

Usage

Used by VisualIdentityService.batch_generate_keyframes for each shot's keyframe generation. Called with the shot, scene, characters, and optional previous shot for relay continuity.

Code Reference

Source Location

  • Repository: ai-moive-studio
  • File: backend/src/services/keyframe_prompt_builder.py:L79-168

Signature

class KeyframePromptBuilder:
    CORE_STYLE = "..."
    TECHNICAL_SPECS = "..."
    FORBIDDEN_ELEMENTS = "..."
    NO_PEOPLE_FORBIDDEN_ELEMENTS = "..."

    @staticmethod
    def build_prompt(
        shot: MovieShot,
        scene: MovieScene,
        characters: List[MovieCharacter],
        custom_prompt: Optional[str] = None,
        previous_shot: Optional[MovieShot] = None
    ) -> str:
        """Build a keyframe generation prompt."""

Import

from src.services.keyframe_prompt_builder import KeyframePromptBuilder

I/O Contract

Inputs

Name Type Required Description
shot MovieShot Yes Shot with description and dialogue
scene MovieScene Yes Scene context
characters List[MovieCharacter] Yes Character list
custom_prompt str No Custom prompt override
previous_shot MovieShot No Previous shot for visual continuity

Outputs

Name Type Description
return value str Full English prompt with CORE_STYLE, TECHNICAL_SPECS, FORBIDDEN_ELEMENTS

Usage Examples

Building a Keyframe Prompt

from src.services.keyframe_prompt_builder import KeyframePromptBuilder

prompt = KeyframePromptBuilder.build_prompt(
    shot=current_shot,
    scene=current_scene,
    characters=project_characters,
    previous_shot=previous_shot,  # for visual continuity
)
# Use prompt with GatewayProvider.generate_image()

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment