class_docstr: Resolver for HuggingFace's pipeline request and responses, providing necessary data transformations and formatting.
  
  This is based off (from wandb.sdk.integration_utils.auto_logging import RequestResponseResolver)
class_docstr_tok: ["Resolver","for","HuggingFace","'s","pipeline","request","and","responses",",","providing","necessary","data","transformations","and","formatting",".","This","is","based","off","(","from","wandb.sdk.integration_utils.auto_logging","import","RequestResponseResolver",")"]
docstr: 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
docstr_tok: ["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"]
code: def _format_data(
      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
  
file_path: wandb/wandb/integration/huggingface/resolver.py
imports: import logging
  import os
  from datetime import datetime
  from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
  import pytz
  import wandb
  from wandb.sdk.integration_utils.auto_logging import Response
  from wandb.sdk.lib.runid import generate_id
label_desc: Use image node_id 4 for calling the HuggingFacePipelineRequestResponseResolver obj's underlying member method code with example usage: obj._format_data(task, input_data, response, kwargs) and returns: formatted_data