def f1(name: str, query: Optional[str] = None) -> MetricSummary:
    """Computes the single label f1 metric for a dataset

    Args:
        name:
            The dataset name.
        query:
            An ElasticSearch query with the [query string syntax](https://docs.v1.argilla.io/en/latest/practical_guides/filter_dataset.html)

    Returns:
        The f1 metric summary

    Examples:
        >>> from argilla_v1.metrics.text_classification import f1
        >>> summary = f1(name="example-dataset")
        >>> summary.visualize() # will plot a bar chart with results
        >>> summary.data # returns the raw result data
    """
    metric = singleton.active_api().compute_metric(name, metric="F1", query=query)

    return MetricSummary.new_summary(
        data=metric.results,
        visualization=lambda: helpers.f1(data=metric.results, title=metric.description),
    )
Computes the single label f1 metric for a dataset

    Args:
        name:
            The dataset name.
        query:
            An ElasticSearch query with the [query string syntax](https://docs.v1.argilla.io/en/latest/practical_guides/filter_dataset.html)

    Returns:
        The f1 metric summary

    Examples:
        >>> from argilla_v1.metrics.text_classification import f1
        >>> summary = f1(name="example-dataset")
        >>> summary.visualize() # will plot a bar chart with results
        >>> summary.data # returns the raw result data
    
argilla-v1/src/argilla_v1/metrics/text_classification/metrics.py