Skip to content

trulens.dashboard.utils.records_utils

trulens.dashboard.utils.records_utils

Classes

Functions

df_cell_highlight

df_cell_highlight(
    score: float,
    feedback_name: str,
    feedback_directions: Dict[str, bool],
    n_cells: int = 1,
) -> list[str]

Returns the background color for a cell in a DataFrame based on the score and feedback name.

PARAMETER DESCRIPTION
score

The score value to determine the background color.

TYPE: float

feedback_name

The feedback name to determine the background color.

TYPE: str

feedback_directions

A dictionary mapping feedback names to their directions. True if higher is better, False otherwise.

TYPE: dict

n_cells

The number of cells to apply the background color. Defaults to 1.

TYPE: int DEFAULT: 1

RETURNS DESCRIPTION
list[str]

A list of CSS styles representing the background color.

display_feedback_call

display_feedback_call(
    record_id: str,
    call: List[Dict[str, Any]],
    feedback_name: str,
    feedback_directions: Dict[str, bool],
)

Display the feedback call details in a DataFrame.

PARAMETER DESCRIPTION
record_id

The record ID.

TYPE: str

call

The feedback call details, including call metadata.

TYPE: List[Dict[str, Any]]

feedback_name

The feedback name.

TYPE: str

feedback_directions

A dictionary mapping feedback names to their directions. True if higher is better, False otherwise.

TYPE: Dict[str, bool]