Module llms_wrapper.utils

Module for various utility functions.

Functions

def dict_except(d: dict, keys, ignore_underscored=True)
Expand source code
def dict_except(d: dict, keys, ignore_underscored=True):
    """
    Return a copy of the dict d, except for the keys in the list keys.
    """
    if isinstance(keys, str):
        keys = [keys]
    if ignore_underscored:
        keys = [k for k in d.keys() if k.startswith("_")] + keys
    return {k: v for k, v in d.items() if k not in keys}

Return a copy of the dict d, except for the keys in the list keys.

def pp_config(config)
Expand source code
def pp_config(config):
    """
    Pretty print the config dict
    """
    return json.dumps(config, indent=4, sort_keys=True)

Pretty print the config dict