def verify_modules():
    """Verify that required modules are available."""
    required_modules = {
        "services": [
            "assemblyai",
            "aws",
            "cartesia",
            "deepgram",
            "google",
            "lmnt",
            "riva",
            "simli",
        ],
        "serializers": ["livekit"],
        "vad": ["silero", "vad_analyzer"],
        "transports": {
            "services": ["daily", "livekit"],
            "local": ["audio", "tk"],
            "network": ["fastapi_websocket", "websocket_server"],
        },
    }

    # Skip importing modules that are in autodoc_mock_imports
    skipped_modules = set(autodoc_mock_imports)

    missing = []
    for category, modules in required_modules.items():
        if isinstance(modules, dict):
            # Handle nested structure
            for subcategory, submodules in modules.items():
                for module in submodules:
                    # Check if module is in autodoc_mock_imports
                    if (
                        f"pipecat.{category}.{subcategory}.{module}" in skipped_modules
                        or module in skipped_modules
                    ):
                        logger.info(
                            f"Skipping import of mocked module: pipecat.{category}.{subcategory}.{module}"
                        )
                        continue

                    try:
                        __import__(f"pipecat.{category}.{subcategory}.{module}")
                        logger.info(
                            f"Successfully imported pipecat.{category}.{subcategory}.{module}"
                        )
                    except (ImportError, TypeError, NameError) as e:
                        missing.append(f"pipecat.{category}.{subcategory}.{module}")
                        logger.warning(
                            f"Optional module not available: pipecat.{category}.{subcategory}.{module} - {str(e)}"
                        )
        else:
            # Handle flat structure
            for module in modules:
                # Check if module is in autodoc_mock_imports
                if f"pipecat.{category}.{module}" in skipped_modules or module in skipped_modules:
                    logger.info(f"Skipping import of mocked module: pipecat.{category}.{module}")
                    continue

                try:
                    __import__(f"pipecat.{category}.{module}")
                    logger.info(f"Successfully imported pipecat.{category}.{module}")
                except (ImportError, TypeError, NameError) as e:
                    missing.append(f"pipecat.{category}.{module}")
                    logger.warning(
                        f"Optional module not available: pipecat.{category}.{module} - {str(e)}"
                    )

    if missing:
        logger.warning(f"Some optional modules are not available: {missing}")
Verify that required modules are available.
docs/api/conf.py