def monitor(
    task_model: Union[Language, Pipeline, SequenceTagger],
    dataset: str,
    sample_rate: float = 0.3,
    agent: Optional[str] = None,
    log_interval: float = 5,
) -> Union[BaseMonitor, Language, Pipeline, SequenceTagger]:
    """Automatically monitor (i.e. log) data fed through Transformer pipelines,
    spaCy models or flAIr taggers.

    Args:
        task_model (Union[Language, Pipeline, SequenceTagger]): The spaCy `Language`,
            transformers `Pipeline` or flAIr `SequenceTagger`.
        dataset (str): The Argilla dataset to log data into.
        sample_rate (float, optional): The portion of processed data to log. Defaults to 0.3.
        agent (Optional[str], optional): The name of the logging agent. Defaults to None.
        log_interval (float, optional): The interval for uploading in seconds. Defaults to 5.

    Returns:
        Union[BaseMonitor, Language, Pipeline, SequenceTagger]: The monitor that acts equivalently
            to the input task_model.
    """
    model_monitor = None
    api = active_api()
    if isinstance(task_model, Language):
        model_monitor = ner_monitor(
            task_model,
            api=api,
            dataset=dataset,
            sample_rate=sample_rate,
            log_interval=log_interval,
        )
    elif isinstance(task_model, Pipeline):
        model_monitor = huggingface_monitor(
            task_model,
            api=api,
            dataset=dataset,
            sample_rate=sample_rate,
            log_interval=log_interval,
        )
    elif isinstance(task_model, SequenceTagger):
        model_monitor = flair_monitor(
            task_model,
            api=api,
            dataset=dataset,
            sample_rate=sample_rate,
            log_interval=log_interval,
        )
    if model_monitor:
        model_monitor.agent = agent
        return model_monitor

    warnings.warn(
        "The provided task model is not supported by monitoring module. Predictions won't be logged into argilla."
    )
    return task_model
Automatically monitor (i.e. log) data fed through Transformer pipelines,
    spaCy models or flAIr taggers.

    Args:
        task_model (Union[Language, Pipeline, SequenceTagger]): The spaCy `Language`,
            transformers `Pipeline` or flAIr `SequenceTagger`.
        dataset (str): The Argilla dataset to log data into.
        sample_rate (float, optional): The portion of processed data to log. Defaults to 0.3.
        agent (Optional[str], optional): The name of the logging agent. Defaults to None.
        log_interval (float, optional): The interval for uploading in seconds. Defaults to 5.

    Returns:
        Union[BaseMonitor, Language, Pipeline, SequenceTagger]: The monitor that acts equivalently
            to the input task_model.
    
argilla-v1/src/argilla_v1/monitoring/model_monitor.py