class_docstr: Computes the entity consistency distribution
code: def _inner_aggregation(
      self,
      size: int,
      interval: int = 1,
      entity_size: int = _DEFAULT_MAX_ENTITY_BUCKET,
  ) -> Dict[str, Any]:
      size = size or 50
      interval = interval or 1
      return {
          "consistency": {
              **aggregations.terms_aggregation(
                  self.compound_nested_field(self.mention_field),
                  size=size,
              ),
              "aggs": {
                  "entities": aggregations.terms_aggregation(
                      self.compound_nested_field(self.labels_field),
                      size=entity_size,
                  ),
                  "count": {
                      "cardinality": {
                          "field": self.compound_nested_field(
                              self.labels_field
                          )
                      }
                  },
                  "entities_variability_filter": {
                      "bucket_selector": {
                          "buckets_path": {"numLabels": "count"},
                          "script": f"params.numLabels >= {interval}",
                      }
                  },
                  "sortby_entities_count": {
                      "bucket_sort": {
                          "sort": [{"count": {"order": "desc"}}],
                          "size": size,
                      }
                  },
              },
          }
      }
  
file_path: argilla/src/argilla/server/daos/backend/metrics/token_classification.py
imports: import dataclasses
  from typing import Any, Dict
  from argilla.server.daos.backend.metrics.base import BidimensionalTermsAggregation, HistogramAggregation, NestedBidimensionalTermsAggregation, NestedHistogramAggregation, NestedPathElasticsearchMetric, NestedTermsAggregation, TermsAggregation
  from argilla.server.daos.backend.query_helpers import aggregations
label_desc: Use image node_id 1 for calling the TopKMentionsConsistency obj's underlying member method code with example usage: obj._inner_aggregation(size, interval, entity_size) and returns: dict