src.asqi.response_schemas

Classes

GeneratedDataset

Represents a dataset produced by a container during execution.

GeneratedReport

Runtime output for a generated report.

ContainerOutput

Complete container output schema.

Functions

validate_container_output(→ ContainerOutput)

Validate container output against the schema.

Module Contents

class src.asqi.response_schemas.GeneratedDataset(/, **data: Any)

Bases: pydantic.BaseModel

Represents a dataset produced by a container during execution. The paths are container-internal and get translated to host paths by the workflow system.

dataset_name: str = None
dataset_type: Literal['huggingface', 'pdf', 'txt'] = None
dataset_path: str = None
format: str | None = None
metadata: Dict[str, Any] | None = None
classmethod validate_path_not_empty(v: str) str

Validate that dataset_path is not empty or whitespace-only.

classmethod validate_name_not_empty(v: str) str

Validate that dataset_name is not empty or whitespace-only.

class src.asqi.response_schemas.GeneratedReport(/, **data: Any)

Bases: pydantic.BaseModel

Runtime output for a generated report.

Represents a report (HTML, PDF, JSON, etc.) produced by a container during execution. The paths are container-internal and get translated to host paths by the workflow system.

report_name: str = None
report_type: Literal['html', 'pdf', 'json'] = None
report_path: str = None
metadata: Dict[str, Any] | None = None
classmethod validate_path_not_empty(v: str) str

Validate that report_path is not empty or whitespace-only.

classmethod validate_name_not_empty(v: str) str

Validate that report_name is not empty or whitespace-only.

class src.asqi.response_schemas.ContainerOutput(/, **data: Any)

Bases: pydantic.BaseModel

Complete container output schema.

Supports both ‘results’ (recommended) and ‘test_results’ (legacy) field names for backward compatibility.

results: Dict[str, Any] | None = None
test_results: Dict[str, Any] | None = None
generated_reports: List[GeneratedReport] = None
generated_datasets: List[GeneratedDataset] = None
model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod validate_results_not_empty_if_present(v: Dict[str, Any] | None) Dict[str, Any] | None

Ensure results field is not empty if present.

At least one results field must contain the ‘success’ key.

get_results() Dict[str, Any]

Get results, preferring ‘results’ over ‘test_results’.

Returns:

Results dictionary, preferring ‘results’ field over ‘test_results’. Returns empty dict if neither field is present.

src.asqi.response_schemas.validate_container_output(output_dict: Dict[str, Any]) ContainerOutput

Validate container output against the schema.

It supports both ‘results’ (recommended) and ‘test_results’ (legacy) field names for backward compatibility.

Args:

output_dict: Raw container output dictionary parsed from JSON

Returns:

Validated ContainerOutput object

Raises:
ValidationError: If output doesn’t match schema (missing required fields,

invalid types, etc.)

ValueError: If neither ‘results’ nor ‘test_results’ field is present