INNER CODE UNIT · Python

setup_server

cubist38/mlx-openai-server · app/server.py:497

def setup_server(config_args: MLXServerConfig | MultiModelServerConfig) -> uvicorn.Config:
    """Create and configure the FastAPI app and return a Uvicorn config.

    This function sets up logging, constructs the FastAPI application with
    a configured lifespan, registers routes and middleware, and returns a
    :class:`uvicorn.Config` ready to be used to run the server.

    When ``config_args`` is a ``MultiModelServerConfig`` the multi-handler
    lifespan is used, which registers all models in a ``ModelRegistry``.

    Note: This function mutates the module-level ``app`` global variable.

    Parameters
    ----------
    config_args : MLXServerConfig | MultiModelServerConfig
        Configuration object produced by the CLI or by YAML loading.

    Returns

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…