code: def apply(
      self,
      records: Iterable[ServiceTextClassificationRecord],
  ) -> Dict[str, Any]:
      ds_labels = set()
      for _ in range(
          0, self.records_to_fetch
      ):  # Only a few of records will be parsed
          record = next(records, None)
          if record is None:
              break
  
          if record.annotation:
              ds_labels.update(
                  [
                      label.class_label
                      for label in record.annotation.labels
                  ]
              )
          if record.prediction:
              ds_labels.update(
                  [
                      label.class_label
                      for label in record.prediction.labels
                  ]
              )
      return {"labels": ds_labels or []}
  
file_path: argilla/src/argilla/server/services/tasks/text_classification/metrics.py
imports: from typing import Any, ClassVar, Dict, Iterable, List
  from argilla.server.pydantic_v1 import Field
  from argilla.server.services.metrics import ServiceBaseMetric, ServicePythonMetric
  from argilla.server.services.metrics.models import CommonTasksMetrics
  from argilla.server.services.search.model import ServiceRecordsQuery
  from argilla.server.services.tasks.text_classification.model import ServiceTextClassificationRecord
  from argilla.utils.dependency import requires_dependencies
label_desc: Use image node_id 2 for calling the DatasetLabels obj's underlying member method code with example usage: obj.apply(records) and returns: dict