INNER CODE UNIT · Python

ensure_image_support_available

cubist38/mlx-openai-server · app/cli.py:93

def ensure_image_support_available(model_types: set[str]) -> None:
    """Raise a usage error when image features are requested without mflux."""
    if not any(model_type in {"image-generation", "image-edit"} for model_type in model_types):
        return

    try:
        import mflux  # noqa: F401
    except ImportError as exc:
        detail = f" Optional import failed: {exc!s}"
        raise click.UsageError(f"{MFLUX_INSTALL_HINT}{detail}") from exc
    except RuntimeError as exc:
        detail = f" Optional import failed: {exc!s}"
        raise click.UsageError(f"{MFLUX_INSTALL_HINT}{detail}") from exc
    else:
        return


# Configure basic logging for CLI (will be overridden by main.py)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…