Skip to main content

module cleanlab_codex.types.response_validation

Types for response validation.


class BaseResponseValidationResult


class SingleResponseValidationResult

Result of a single response validation check.

This class represents the outcome of an individual validation check performed on an AI response.

class SingleResponseValidationResult(BaseModel):
name: 'typing.Literal['fallback', 'untrustworthy', 'unhelpful']'
fails_check: 'bool'
score: 'typing.Dict[str, float]'
metadata: 'typing.Dict[str, typing.Any]'

Args:

  • name (typing.Literal[‘fallback’, ‘untrustworthy’, ‘unhelpful’]): The name of the validation check.
  • fails_check (bool): Whether the check failed. True if the check failed, False otherwise.
  • score (typing.Dict[str, float]): The score of the response. Typically a single score’s value is between 0.0 and 1.0, but this can vary by check.
  • metadata (typing.Dict[str, typing.Any]): Additional metadata about the response. This can include the threshold values, or other information relevant to the check.

class AggregatedResponseValidationResult

Result of multiple combined response validation checks.

This class aggregates multiple SingleResponseValidationResults and provides a combined validation outcome.

The class is typically used in a boolean context to determine if any of the underlying checks failed. But each of the individual results are also accessible, via the results field.

class AggregatedResponseValidationResult(BaseModel):
name: 'typing.Literal['bad']'
results: 'typing.List[cleanlab_codex.types.response_validation.SingleResponseValidationResult]'

Args:

  • name (typing.Literal[‘bad’]): The name of the aggregated validation check.
  • results (typing.List[cleanlab_codex.types.response_validation.SingleResponseValidationResult]): The individual results of the validation checks.

property fails_check

Whether any of the underlying checks failed.