Skip to content

trulens.dashboard.utils.dashboard_utils

trulens.dashboard.utils.dashboard_utils

Classes

Functions

format_sample_rate

format_sample_rate(value: Any) -> str

Format a nullable sample rate for display.

format_leaderboard_sample_rate

format_leaderboard_sample_rate(row: Series) -> str

Format the latest observed rate as a percentage.

add_online_eval_columns

add_online_eval_columns(records_df: DataFrame) -> DataFrame

Add stable display columns for nullable sampling telemetry.

read_query_params_into_session_state

read_query_params_into_session_state(
    page_name: str,
    transforms: Optional[
        Dict[str, Callable[[str], Any]]
    ] = None,
)

This method loads query params into the session state. This function should only be called only once when the page is first initialized.

PARAMETER DESCRIPTION
page_name

Name of the page being initialized. Used to prefix page-specific session keys.

TYPE: str

transforms

An optional dictionary mapping query param names to a function that deserializes the respective query arg value. Defaults to None.

TYPE: Optional[dict[str, Callable]] DEFAULT: None

read_spcs_oauth_token

read_spcs_oauth_token() -> Optional[str]

Reads the OAuth token from the file system. This is only available if the container is running in SPCS.

get_session

get_session() -> TruSession

Parse command line arguments and initialize TruSession with them.

As TruSession is a singleton, further TruSession() uses will get the same configuration.

get_events_for_records

get_events_for_records(
    app_name: Optional[str] = None,
    record_ids: Optional[List[str]] = None,
)

Fetch all OTEL span events for the given record ids.

Used to build a combined conversation timeline across the turns (records) that make up a thread.