class_docstr: The dataset metrics service singleton
class_docstr_tok: ["The","dataset","metrics","service","singleton"]
docstr: Return the number of annotated records for a dataset
docstr_tok: ["Return","the","number","of","annotated","records","for","a","dataset"]
code: def annotated_records(self, dataset: ServiceDataset) -> int:
      """Return the number of annotated records for a dataset"""
      results = self.__dao__.search_records(
          dataset,
          size=0,
          search=DaoRecordsSearch(
              query=ServiceBaseRecordsQuery(has_annotation=True)
          ),
      )
      return results.total
  
file_path: argilla/src/argilla/server/services/metrics/service.py
imports: from typing import Any, Dict, Optional, Type
  from fastapi import Depends
  from argilla.server.daos.backend.search.model import SortConfig
  from argilla.server.daos.models.records import DaoRecordsSearch
  from argilla.server.daos.records import DatasetRecordsDAO
  from argilla.server.services.datasets import ServiceDataset
  from argilla.server.services.metrics.models import ServiceMetric, ServicePythonMetric
  from argilla.server.services.search.model import ServiceBaseRecordsQuery, ServiceRecordsQuery
  from argilla.server.services.tasks.commons import ServiceRecord
label_desc: Use image node_id 4 for calling the MetricsService obj's underlying member method code with example usage: obj.annotated_records(dataset) and returns: results