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]

_render_feedback_pills ΒΆ

_render_feedback_pills(
    feedback_col_names: Sequence[str],
    feedback_directions: Dict[str, bool],
    selected_row: Optional[Series] = None,
)

Render each feedback as pills.

PARAMETER DESCRIPTION
feedback_col_names

The name of the feedback function columns.

TYPE: Sequence[str]

feedback_directions

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

TYPE: Dict[str, bool]

selected_row

The selected row (if any). If provided, renders the feedback values. Defaults to None.

TYPE: Optional[Series] DEFAULT: None

RETURNS DESCRIPTION
Any

The feedback pills streamlit component.