def METHOD_NAME(
    self,
    task: str,
    input_data: Union[List[Any], Any],
    response: Union[List[Any], Any],
    kwargs: Dict[str, Any],
) -> List[Dict[str, Any]]:
    """Formats input data, response, and kwargs into a list of dictionaries.
    :param task: the task name
    :param input_data: the input data
    :param response: the response data
    :param kwargs: dictionary of keyword arguments
    :returns: list of dictionaries containing formatted data
    """
    input_data = input_data if isinstance(input_data, list) else [input_data]
    response = response if isinstance(response, list) else [response]
    formatted_data = []
    for i_text, r_text in zip(input_data, response):
        # Unpack single element responses for better rendering in wandb UI when it is a task without top_k
        # top_k = 1 would unpack the response into a single element while top_k > 1 would be a list
        # this would cause the UI to not properly concatenate the tables of the same task by omitting the elements past the first
        if (
            (isinstance(r_text, list))
            and (len(r_text) == 1)
            and task not in PIPELINES_WITH_TOP_K
        ):
            r_text = r_text[0]
        formatted_data.append(
            {"input": i_text, "response": r_text, "kwargs": kwargs}
        )
    return formatted_data