Inspect Viz supports creating direct links from visualizations to published Inspect log transcripts. Links can be made at the eval level, or to individual samples, messages, or events.
The basic steps required for creating links to logs from visualizations are:
Read logs into a data frame using the log dataframe functions, then ammend the data frame with log viewer URLs that point to the published bundle (we’ll cover how to do this below).
Include the log viewer URLs as a custom channels on your plot marks as appropriate. The link will be available within the tooltip for your mark.
Step 1: Publish Logs
You can use the command inspect view bundle (or the bundle_log_dir() function from Python) to create a self contained directory with the log viewer and a set of logs for display. This directory can then be deployed to any static web server (GitHub Pages, S3 buckets, Netlify, etc.) to provide a standalone version of the viewer.
For example, to bundle the logs directory to a directory named logs-www:
You can then deploy logs-www to any static web host.
Step 2: Prepare Data
Next, you’ll want to ammend the data frame that you’ve read with e.g. evals_df() or samples_df() with log viewer URLs that point to the published logs.
You can do this using the prepare() and log_viewer() functions from the inspect_ai.analysis module. For example, if you have previously published your “logs” directory to https://example.com/logs/:
from inspect_viz import Datafrom inspect_ai.analysis import evals_df, prepare, log_viewer# read evals and ammend with log viewer URLdf = evals_df("logs")df = prepare(df, log_viewer("evals", {"logs": "https://example.com/logs/"}))# read as inspect viz dataevals = Data.from_dataframe(df)
Step 3: Link Channel
Once your data is prepared, you need to ensure that links are incorporated onto plots.
Custom Plot
If you are creating a custom plot, you should add a mapping to the “log_viewer” column to your mark’s channels. For example: