code: def apply(
      self,
      records: Iterable[ServiceTokenClassificationRecord],
  ) -> Dict[str, Any]:
      ds_labels = set()
  
      for _ in range(
          0, self.records_to_fetch
      ):  # Only a few of records will be parsed
          record: ServiceTokenClassificationRecord = next(records, None)
          if record is None:
              break
  
          if record.annotation:
              ds_labels.update(
                  [
                      entity.label
                      for entity in record.annotation.entities
                  ]
              )
          if record.prediction:
              ds_labels.update(
                  [
                      entity.label
                      for entity in record.prediction.entities
                  ]
              )
      return {"labels": ds_labels or []}
  
imports: from typing import Any, ClassVar, Dict, Iterable, List, Optional, Set, Tuple
  from argilla.server.pydantic_v1 import BaseModel, 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.token_classification.model import EntitySpan, ServiceTokenClassificationAnnotation, ServiceTokenClassificationRecord
  from argilla.utils import SpanUtils
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