Skip to content

trulens.feedback.computer

trulens.feedback.computer

Classes

RecordGraphNode

Graph form of a record (i.e. a list of spans).

Functions

_compute_feedback

_compute_feedback(
    record_root: RecordGraphNode,
    feedback_function: Callable[
        [Any], Union[float, Tuple[float, Dict[str, Any]]]
    ],
    feedback_name: str,
    selector_function: Callable[
        [RecordGraphNode], List[Dict[str, Any]]
    ],
) -> None

Compute feedback for a record. This is a utility function that can compute feedback functions quite arbitrarily and so is quite powerful.

PARAMETER DESCRIPTION
record

Record to compute feedback for.

feedback_function

Function to compute feedback.

TYPE: Callable[[Any], Union[float, Tuple[float, Dict[str, Any]]]]

feedback_name

Name of feedback.

TYPE: str

selector_function

Function to select inputs for feedback computation. Given a record in graph form, it returns a list of inputs to the feedback function. Each entry in the list is a dictionary that represents the kwargs to the feedback function.

TYPE: Callable[[RecordGraphNode], List[Dict[str, Any]]]