code: def get_unified_responses_and_suggestions(
      dataset: Union["FeedbackDataset", "RemoteFeedbackDataset"],
      question_name: str,
      strategy_name: str = "majority",
      filter_by: Optional[
          Dict[
              str,
              Union[
                  "ResponseStatusFilter", List["ResponseStatusFilter"]
              ],
          ]
      ] = None,
      sort_by: Optional[List["SortBy"]] = None,
      max_records: Optional[int] = None,
  ) -> Tuple["Responses", "Suggestions"]:
      """Extract the unified responses and the suggestions from a FeedbackDataset.
  
      Helper function for the metrics module where we want to compare the responses
      in relation to the suggestions offered.
  
      Args:
          dataset: FeedbackDataset or RemoteFeedbackDataset.
          question_name: The name of the question to filter from the dataset.
          strategy_name: The name of the strategy to use to unify the responses.
          filter_by: A dict with key the field to filter by, and values the filters to apply.
              Can be one of: draft, pending, submitted, and discarded. If set to None,
              no filter will be applied. Defaults to None (no filter is applied).
          sort_by: A list of `SortBy` objects to sort your dataset by.
              Defaults to None (no filter is applied).
          max_records: The maximum number of records to use for training. Defaults to None.
  
      Raises:
          NotImplementedError:
              When asked for a TextQuestion.
          ValueError:
              If the dataset hasn't been unified yet.
  
      Returns:
          Tuple containing the unified responses and the suggestions.
      """
      if filter_by:
          dataset = dataset.filter_by(**filter_by)
      if sort_by:
          dataset = dataset.sort_by(sort_by)
      if max_records:
          dataset = dataset.pull(max_records=max_records)
  
      question_type = type(dataset.question_by_name(question_name))
      if question_type == TextQuestion:
          raise NotImplementedError(
              "This function is not available for `TextQuestion`."
          )
  
      if isinstance(dataset, RemoteFeedbackDataset):
          dataset = dataset.pull()
  
      dataset.compute_unified_responses(
          question_name, strategy=strategy_name
      )
  
      unified_responses = []
      suggestions = []
  
      if not dataset.records[0].unified_responses:
          raise ValueError(
              "Please unify the responses first: `dataset.compute_unified_responses(question, strategy)`."
          )
  
      # Get the position of the suggestion from the first record to avoid the nested loop,
      # and the type of the value to cast the unified responses.
      for idx_suggestion, suggestion in enumerate(
          dataset.records[0].suggestions
      ):
          if suggestion.question_name == question_name:
              value_type = type(suggestion.value)
              break
  
      if value_type == list:
          # To make MultiLabelQuestion hashable
          value_type = tuple
  
      for record in dataset.records:
          unified_response = value_type(
              record.unified_responses[question_name][0].value
          )
          unified_responses.append(unified_response)
          suggestions.append(
              value_type(record.suggestions[idx_suggestion].value)
          )
  
      if question_type == RankingQuestion:
          unified_responses = [
              tuple(ranking_schema.rank for ranking_schema in response)
              for response in unified_responses
          ]
          suggestions = [
              tuple(s["rank"] for s in suggestion)
              for suggestion in suggestions
          ]
  
      return unified_responses, suggestions
  
file_path: argilla/src/argilla/client/feedback/metrics/utils.py
imports: from collections import defaultdict
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
  import numpy
  from tqdm import tqdm
  from argilla.client.feedback.dataset.remote.dataset import RemoteFeedbackDataset
  from argilla.client.feedback.schemas import RankingQuestion, TextQuestion
  from argilla.client.feedback.schemas.enums import ResponseStatusFilter
  from argilla.client.feedback.schemas.remote.questions import RemoteRankingQuestion
label_desc: Use image node_id 2 for calling a global function with example usage: get_unified_responses_and_suggestions(dataset, question_name, strategy_name, filter_by, sort_by, max_records) and returns: unified_responses,  suggestions