Skip to content

trulens.core.schema.groundtruth

trulens.core.schema.groundtruth

Serializable groundtruth-related classes.

Classes

VirtualGroundTruthSchemaMapping

Bases: BaseModel

Functions
validate_mapping classmethod
validate_mapping(
    schema_mapping: Dict[str, str]
) -> "VirtualGroundTruthSchemaMapping"

Validate and parse the schema mapping dictionary.

PARAMETER DESCRIPTION
schema_mapping

User-provided schema mapping.

TYPE: Dict[str, str]

RETURNS DESCRIPTION
SchemaMapping

Parsed and validated schema mapping.

TYPE: 'VirtualGroundTruthSchemaMapping'

RAISES DESCRIPTION
ValidationError

If mandatory fields are missing or invalid.

GroundTruth

Bases: SerialModel, Hashable

The class that represents a single ground truth data entry.

Attributes
query instance-attribute
query: str

The query for which the ground truth is provided.

query_id class-attribute instance-attribute
query_id: Optional[str] = None

Unique identifier for the query.

expected_response class-attribute instance-attribute
expected_response: Optional[str] = None

The expected response for the query.

expected_chunks class-attribute instance-attribute
expected_chunks: Optional[Sequence[Dict]] = None

Expected chunks for the ground truth.

meta class-attribute instance-attribute
meta: Optional[Metadata] = None

Metadata for the ground truth.

dataset_id instance-attribute
dataset_id: DatasetID

The dataset ID to which this ground truth belongs. See Dataset.dataset_id.

ground_truth_id instance-attribute
ground_truth_id: GroundTruthID = ground_truth_id

The unique identifier for the ground truth.

Functions
__rich_repr__
__rich_repr__() -> Result

Requirement for pretty printing using the rich package.