Skip to content

Exceptions

This section contains the distilabel custom exceptions. Unlike errors, exceptions in distilabel are used to handle specific situations that can be anticipated and that can be handled in a controlled way internally by the library.

DistilabelException

Bases: Exception

Base exception (can be gracefully handled) for distilabel framework.

Source code in src/distilabel/exceptions.py
class DistilabelException(Exception):
    """Base exception (can be gracefully handled) for `distilabel` framework."""

    pass

DistilabelGenerationException

Bases: DistilabelException

Base exception for LLM generation errors.

Source code in src/distilabel/exceptions.py
class DistilabelGenerationException(DistilabelException):
    """Base exception for `LLM` generation errors."""

    pass

DistilabelOfflineBatchGenerationNotFinishedException

Bases: DistilabelGenerationException

Exception raised when a batch generation is not finished.

Source code in src/distilabel/exceptions.py
class DistilabelOfflineBatchGenerationNotFinishedException(
    DistilabelGenerationException
):
    """Exception raised when a batch generation is not finished."""

    jobs_ids: Tuple[str, ...]

    def __init__(self, jobs_ids: Tuple[str, ...]) -> None:
        self.jobs_ids = jobs_ids
        super().__init__(f"Batch generation with jobs_ids={jobs_ids} is not finished")