Skip to content

lasagnastack.stages.reel_pipeline.direct

lasagnastack.stages.reel_pipeline.direct

run

run(
    inventories: list[ClipInventory],
    brief_path: Path,
    output_dir: Path,
    client: LLMClient | None = None,
    skill_path: Path | None = None,
) -> CutList

Generate an ordered cut list from all segment inventories and the brief.

Writes cut_list.json to output_dir via io.write_json / io.cut_list_path.

Parameters:

Name Type Description Default
inventories list[ClipInventory]

All ClipInventory objects from Stage 2.

required
brief_path Path

Path to the freeform .txt creator brief.

required
output_dir Path

Pipeline root; cut_list.json written here.

required
client LLMClient | None

LLM client to use. Defaults to GeminiClient.

None
skill_path Path | None

Optional path to a Markdown skill file injected into the prompt before the creator brief.

None

Returns:

Type Description
CutList

A CutList ready for critique or rendering.

Source code in src/lasagnastack/stages/reel_pipeline/direct.py
def run(
    inventories: list[ClipInventory],
    brief_path: Path,
    output_dir: Path,
    client: LLMClient | None = None,
    skill_path: Path | None = None,
) -> CutList:
    """Generate an ordered cut list from all segment inventories and the brief.

    Writes cut_list.json to output_dir via io.write_json / io.cut_list_path.

    Args:
        inventories: All ClipInventory objects from Stage 2.
        brief_path: Path to the freeform .txt creator brief.
        output_dir: Pipeline root; cut_list.json written here.
        client: LLM client to use. Defaults to GeminiClient.
        skill_path: Optional path to a Markdown skill file injected into the
            prompt before the creator brief.

    Returns:
        A CutList ready for critique or rendering.
    """
    if client is None:
        client = GeminiClient()

    prompt = _build_prompt(inventories, brief_path, skill_path)
    total_segments = sum(len(inv.segments) for inv in inventories)
    log.info("direct_start", clips=len(inventories), segments=total_segments)

    cut_list: CutList = client.generate(prompt, CutList, temperature=0.6)

    io.write_json(cut_list, io.cut_list_path(output_dir))
    log.info("direct_done", cuts=len(cut_list.cuts))
    return cut_list