code: def tokens_length(
      name: str, query: Optional[str] = None, interval: int = 1
  ) -> MetricSummary:
      """Computes the text length distribution measured in number of tokens.
  
      Args:
          name: The dataset name.
          query: An ElasticSearch query with the
              `query string syntax <https://docs.argilla.io/en/latest/practical_guides/filter_dataset.html>`_
          interval: The bins or bucket for result histogram
  
      Returns:
          The summary for token distribution
  
      Examples:
          >>> from argilla.metrics.token_classification import tokens_length
          >>> summary = tokens_length(name="example-dataset", interval=5)
          >>> summary.visualize() # will plot a histogram with results
          >>> summary.data # the raw histogram data with bins of size 5
      """
      warnings.warn(
          message=_UNUSED_METRIC_WARNING_MESSAGE,
          category=DeprecationWarning,
      )
  
      metric = singleton.active_api().compute_metric(
          name, metric="tokens_length", query=query, interval=interval
      )
  
      return MetricSummary.new_summary(
          data=metric.results,
          visualization=lambda: helpers.histogram(
              metric.results,
              title=metric.description,
              x_legend="# tokens",
          ),
      )
  
imports: import warnings
  from enum import Enum
  from typing import Optional, Set, Union
  import deprecated
  from argilla.client import singleton
  from argilla.metrics import helpers
  from argilla.metrics.models import MetricSummary
label_desc: Use image node_id 1 for calling a global function with example usage: tokens_length(name, query, interval) and returns: MetricSummary