dev-strender's picture
Replace v24-era demo with v34 pipeline demo (engine-vendored bundle)
9c84f9d verified
Raw History Blame
2.54 kB
"""Dashboard commands — remote only."""
import click
from tabulate import tabulate
from solar_eval.cli.commands.projects import _resolve_project_id
from solar_eval.cli.formatters import format_dashboard_table, format_overall_score
@click.group("dashboard")
def dashboard_group() -> None:
"""View evaluation dashboards and trends (remote only)."""
@dashboard_group.command("show")
@click.argument("project")
@click.option("--task", "-t", default=None, help="Filter by task")
@click.pass_context
def show_dashboard(ctx: click.Context, project: str, task: str | None) -> None:
"""Show run comparison dashboard."""
cfg = ctx.obj["config"]
if not cfg.is_remote:
raise click.ClickException("Dashboard requires --remote (server connection)")
from solar_eval.cli.client import EvalClient
client = EvalClient(cfg.remote_url, cfg.timeout)
project_id = _resolve_project_id(client, project)
params = {"task": task} if task else {}
data = client.get(f"/api/projects/{project_id}/dashboard", params=params)
if not data.get("runs"):
click.secho("No dashboard data.", fg="yellow")
return
click.secho(f"Dashboard: {data.get('task', 'all tasks')}", fg="blue", bold=True)
click.echo()
click.secho(format_dashboard_table(data))
@dashboard_group.command("trend")
@click.argument("project")
@click.option("--task", "-t", default=None, help="Filter by task")
@click.pass_context
def show_trend(ctx: click.Context, project: str, task: str | None) -> None:
"""Show score trend over time."""
cfg = ctx.obj["config"]
if not cfg.is_remote:
raise click.ClickException("Trend requires --remote (server connection)")
from solar_eval.cli.client import EvalClient
client = EvalClient(cfg.remote_url, cfg.timeout)
project_id = _resolve_project_id(client, project)
params = {"task": task} if task else {}
data = client.get(f"/api/projects/{project_id}/dashboard/trend", params=params)
points = data.get("data_points", [])
if not points:
click.secho("No trend data.", fg="yellow")
return
click.secho(f"Score Trend: {data.get('task', 'all tasks')}", fg="blue", bold=True)
click.echo()
rows = [[
pt.get("date", "")[:10],
format_overall_score(pt.get("score")),
f"v{pt.get('prompt_version', '?')}",
pt.get("model", ""),
pt.get("run_id", "")[:12],
] for pt in points]
click.echo(tabulate(rows, headers=["Date", "Score", "Version", "Model", "Run ID"], tablefmt="simple"))