Skip to content
FastVideo
Esc
↑↓navigate↵open⌘Jpreview
On this page

playground

Same-origin prompt UI for the H3 text-to-video/audio server.

fastvideo.entrypoints.openai.playground.explicit_request_updates

explicit_request_updates(request: GenerationRequest) -> dict[str, Any]

Project a GenerationRequest down to explicitly set fields only.

Returns a flat kwargs dict suitable for merging into a generator call. The projection uses _fastvideo_explicit_paths (populated during parse_config / raw binding) so schema defaults on the dataclass are not emitted — only paths the caller/operator actually wrote.

This is what makes ServeConfig.default_request work as an operator-pinned baseline rather than a full override: a YAML with just sampling.seed: 42 yields {"seed": 42}, not the full sampling config with its 15 schema defaults.

Precondition: the request must carry _fastvideo_explicit_paths — populated by :func:fastvideo.api.parser.parse_config or :func:fastvideo.api.compat.normalize_generation_request. Calling on a raw GenerationRequest() asserts.

fastvideo.entrypoints.openai.playground.get_default_request

get_default_request() -> GenerationRequest | None

Return the ServeConfig.default_request set at startup, if any.

fastvideo.entrypoints.openai.playground.get_served_model_name

get_served_model_name() -> str

Return the public model id advertised by the OpenAI server.

fastvideo.entrypoints.openai.playground.get_server_args

get_server_args() -> FastVideoArgs

Return the global FastVideoArgs (set during startup).

fastvideo.entrypoints.openai.playground.get_preset_selection

get_preset_selection(model_path: str) -> tuple[str | None, str | None]

Return (default_preset, model_family) for a model path.

Single-lookup variant of :func:get_default_preset + :func:get_model_family; callers that need both should prefer this to avoid walking the registry twice.

fastvideo.entrypoints.openai.playground.require_h3

require_h3() -> None
Source
def require_h3() -> None:
    args = get_server_args()
    _, family = get_preset_selection(args.model_path)
    override = getattr(args, "override_pipeline_cls_name", None)
    if family != "minimax_h3" or (override and override != "MiniMaxH3ModularPipeline"):
        raise HTTPException(status_code=404, detail="The playground requires an H3 text-to-video/audio server.")

fastvideo.entrypoints.openai.playground.playground

playground() -> FileResponse
Source
@router.get("/")
async def playground() -> FileResponse:
    return FileResponse(ASSETS / "playground.html", headers=HEADERS)

fastvideo.entrypoints.openai.playground.playground_config

playground_config(raw_request: Request) -> dict
Source
@router.get("/config")
async def playground_config(raw_request: Request) -> dict:
    request = get_default_request()
    # Report operator defaults only; do not guess model presets or hardware.
    sampling = explicit_request_updates(request) if request is not None else {}
    fields = ("width", "height", "num_frames", "fps", "seed")
    return {
        "model": get_served_model_name(),
        "runtime": raw_request.app.state.runtime,
        "defaults": {
            field: sampling.get(field)
            for field in fields
        },
    }

fastvideo.entrypoints.openai.playground.playground_asset

playground_asset(asset: str) -> FileResponse
Source
@router.get("/{asset}")
async def playground_asset(asset: str) -> FileResponse:
    if asset not in {"playground.css", "playground.js"}:
        raise HTTPException(status_code=404, detail="Playground asset not found.")
    return FileResponse(ASSETS / asset, headers=HEADERS)

Was this page helpful?