aidial_adapter_openai/utils/json.py (2 lines of code) (raw):

def remove_nones(d: dict) -> dict: return {k: v for k, v in d.items() if v is not None}