INNER CODE UNIT · Python

_attach_sampling_defaults

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

def _attach_sampling_defaults(handler: Any, config: Any) -> Any:
    """Attach configured sampling-default attributes to a handler or proxy."""

    for field_name in _SAMPLING_DEFAULT_FIELDS:
        setattr(handler, field_name, getattr(config, field_name, None))
    setattr(handler, "_uses_model_sampling_defaults", True)
    return handler


def configure_logging(
    log_file: str | None = None, no_log_file: bool = False, log_level: str = "INFO"
) -> None:
    """Set up loguru handlers used by the server.

    This helper replaces the default loguru handler with a console
    handler using a compact, colored format. When ``no_log_file`` is
    False a rotating file handler is also added using ``log_file`` or
    a default path.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…