Skip to content

guidellm.schemas.benchmark.outputs

BenchmarkOutputArgs

Bases: PydanticClassRegistryMixin['BenchmarkOutputArgs'], ABC

Base class for output creation arguments.

This class serves as a base for defining argument models used in the creation of output instances. It inherits from PydanticClassRegistryMixin to enable automatic registration of subclasses, allowing for flexible and extensible output configurations.

Attributes:

Name Type Description
schema_discriminator str

Field name for polymorphic deserialization

Source code in src/guidellm/schemas/benchmark/outputs/output.py
class BenchmarkOutputArgs(PydanticClassRegistryMixin["BenchmarkOutputArgs"], ABC):
    """Base class for output creation arguments.

    This class serves as a base for defining argument models used in the creation
    of output instances. It inherits from PydanticClassRegistryMixin to enable
    automatic registration of subclasses, allowing for flexible and extensible
    output configurations.

    :cvar schema_discriminator: Field name for polymorphic deserialization
    """

    model_config = standard_model_config()

    schema_discriminator: ClassVar[str] = "kind"

    @classmethod
    def __pydantic_schema_base_type__(cls) -> type[BenchmarkOutputArgs]:
        """
        Return base type for polymorphic validation hierarchy.

        :return: Base BenchmarkOutputArgs class for schema validation
        """
        if cls.__name__ == "BenchmarkOutputArgs":
            return cls

        return BenchmarkOutputArgs

    kind: str = Field(
        description="Type identifier for the output configuration.",
    )

__pydantic_schema_base_type__() classmethod

Return base type for polymorphic validation hierarchy.

Returns:

Type Description
type[BenchmarkOutputArgs]

Base BenchmarkOutputArgs class for schema validation

Source code in src/guidellm/schemas/benchmark/outputs/output.py
@classmethod
def __pydantic_schema_base_type__(cls) -> type[BenchmarkOutputArgs]:
    """
    Return base type for polymorphic validation hierarchy.

    :return: Base BenchmarkOutputArgs class for schema validation
    """
    if cls.__name__ == "BenchmarkOutputArgs":
        return cls

    return BenchmarkOutputArgs

CSVBenchmarkOutputArgs

Bases: BenchmarkOutputArgs

Model for CSV benchmark output arguments.

Source code in src/guidellm/schemas/benchmark/outputs/csv.py
@BenchmarkOutputArgs.register("csv")
class CSVBenchmarkOutputArgs(BenchmarkOutputArgs):
    """Model for CSV benchmark output arguments."""

    kind: Literal["csv"] = Field(
        default="csv",
        description="The kind of output.",
    )
    path: Path = Field(
        default_factory=lambda: settings.default_results_dir / "benchmarks.csv",
        description="The file to save the output to.",
    )

ConsoleBenchmarkOutputArgs

Bases: BenchmarkOutputArgs

Base class for console benchmark output arguments.

Source code in src/guidellm/schemas/benchmark/outputs/console.py
@BenchmarkOutputArgs.register("console")
class ConsoleBenchmarkOutputArgs(BenchmarkOutputArgs):
    """Base class for console benchmark output arguments."""

    kind: Literal["console"] = Field(
        default="console",
        description="The kind of output.",
    )

HTMLBenchmarkOutputArgs

Bases: BenchmarkOutputArgs

Model for HTML benchmark output arguments.

Source code in src/guidellm/schemas/benchmark/outputs/html.py
@BenchmarkOutputArgs.register("html")
class HTMLBenchmarkOutputArgs(BenchmarkOutputArgs):
    """Model for HTML benchmark output arguments."""

    kind: Literal["html"] = Field(
        default="html",
        description="The kind of output.",
    )
    path: Path = Field(
        default_factory=lambda: settings.default_results_dir / "benchmarks.html",
        description="The file to save the output to.",
    )

JSONBenchmarkOutputArgs

Bases: BenchmarkOutputArgs

Model for JSON benchmark output arguments.

Source code in src/guidellm/schemas/benchmark/outputs/serialized.py
@BenchmarkOutputArgs.register("json")
class JSONBenchmarkOutputArgs(BenchmarkOutputArgs):
    """Model for JSON benchmark output arguments."""

    kind: Literal["json"] = Field(
        default="json",
        description="The kind of output.",
        examples=["json"],
    )
    path: Path = Field(
        default_factory=lambda: settings.default_results_dir / "benchmarks.json",
        description="The file to save the output to.",
        examples=["./benchmarks.json"],
    )

PlotBenchmarkOutputArgs

Bases: BenchmarkOutputArgs

Model for Plot benchmark output arguments.

Defines parameters for generating static image visualizations, enforcing image output suffix.

Source code in src/guidellm/schemas/benchmark/outputs/plot.py
@BenchmarkOutputArgs.register("plot")
class PlotBenchmarkOutputArgs(BenchmarkOutputArgs):
    """Model for Plot benchmark output arguments.

    Defines parameters for generating static image visualizations, enforcing
    image output suffix.
    """

    kind: Literal["plot"] = Field(
        default="plot",
        description="Type identifier for the plot configuration.",
    )
    path: Path = Field(
        default_factory=lambda: settings.default_results_dir / "benchmarks.png",
        description="The file to save the output plot to.",
    )
    dpi: int = Field(
        default=100,
        description="Resolution of the output image in Dots Per Inch.",
    )

    @field_validator("path", mode="after")
    @classmethod
    def validate_plot_suffix(cls, v: Path) -> Path:
        """Ensures the output file path ends with a supported plotting format extension.

        If the suffix is missing, it defaults to .png.
        If an unsupported suffix is provided, it raises a ValueError.
        """
        if not v.suffix:
            return v.with_suffix(".png")
        suffix = v.suffix.lower()
        if suffix in _ALLOWED_PLOT_SUFFIXES:
            return v
        raise ValueError(
            f"Plot output type {suffix} is not supported: valid types are "
            f"{', '.join(sorted(_ALLOWED_PLOT_SUFFIXES))}"
        )

validate_plot_suffix(v) classmethod

Ensures the output file path ends with a supported plotting format extension.

If the suffix is missing, it defaults to .png. If an unsupported suffix is provided, it raises a ValueError.

Source code in src/guidellm/schemas/benchmark/outputs/plot.py
@field_validator("path", mode="after")
@classmethod
def validate_plot_suffix(cls, v: Path) -> Path:
    """Ensures the output file path ends with a supported plotting format extension.

    If the suffix is missing, it defaults to .png.
    If an unsupported suffix is provided, it raises a ValueError.
    """
    if not v.suffix:
        return v.with_suffix(".png")
    suffix = v.suffix.lower()
    if suffix in _ALLOWED_PLOT_SUFFIXES:
        return v
    raise ValueError(
        f"Plot output type {suffix} is not supported: valid types are "
        f"{', '.join(sorted(_ALLOWED_PLOT_SUFFIXES))}"
    )

YAMLBenchmarkOutputArgs

Bases: BenchmarkOutputArgs

Model for YAML benchmark output arguments.

Source code in src/guidellm/schemas/benchmark/outputs/serialized.py
@BenchmarkOutputArgs.register("yaml")
class YAMLBenchmarkOutputArgs(BenchmarkOutputArgs):
    """Model for YAML benchmark output arguments."""

    kind: Literal["yaml"] = Field(
        default="yaml",
        description="The kind of output.",
        examples=["yaml"],
    )
    path: Path = Field(
        default_factory=lambda: settings.default_results_dir / "benchmarks.yaml",
        description="The file to save the output to.",
        examples=["./benchmarks.yaml"],
    )