Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/agentops/cli/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from pathlib import Path
from typing import Annotated, Optional
from typing import Annotated

import typer

Expand Down Expand Up @@ -137,15 +137,15 @@ def cmd_init(
@eval_app.command("run")
def cmd_eval_run(
config: Annotated[
Optional[Path],
Path | None,
typer.Option(
"--config",
"-c",
help="Path to run.yaml (default: .agentops/run.yaml).",
),
] = None,
output: Annotated[
Optional[Path],
Path | None,
typer.Option("--output", "-o", help="Output directory for results."),
] = None,
report_format: Annotated[
Expand Down Expand Up @@ -191,7 +191,7 @@ def cmd_eval_compare(
),
],
output: Annotated[
Optional[Path],
Path | None,
typer.Option("--output", "-o", help="Output directory for comparison results."),
] = None,
report_format: Annotated[
Expand Down Expand Up @@ -250,7 +250,7 @@ def cmd_eval_compare(
def cmd_report(
ctx: typer.Context,
results_in: Annotated[
Optional[Path],
Path | None,
typer.Option(
"--in",
help=(
Expand All @@ -260,7 +260,7 @@ def cmd_report(
),
] = None,
report_out: Annotated[
Optional[Path],
Path | None,
typer.Option("--out", help="Output path for report."),
] = None,
report_format: Annotated[
Expand Down Expand Up @@ -294,6 +294,8 @@ def cmd_report(

typer.echo(f"Loaded results: {report_result.input_results_path}")
typer.echo(f"Generated report: {report_result.output_report_path}")
if report_result.html_report_path:
typer.echo(f"Generated report: {report_result.html_report_path}")


@report_app.command("show")
Expand Down Expand Up @@ -324,7 +326,7 @@ def cmd_run_show() -> None:
def cmd_run_view(
run_id: str,
entry: Annotated[
Optional[int],
int | None,
typer.Option("--entry", help="Optional row/entry index for deep inspection."),
] = None,
) -> None:
Expand Down
4 changes: 4 additions & 0 deletions src/agentops/services/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class ReportResult:
input_results_path: Path
output_report_path: Path
html_report_path: Path | None = None


def generate_report_from_results(
Expand All @@ -35,6 +36,7 @@ def generate_report_from_results(
resolved_output_path.parent.mkdir(parents=True, exist_ok=True)

primary_path = resolved_output_path
html_report_path: Path | None = None
if report_format in ("md", "all"):
md_path = (
resolved_output_path
Expand All @@ -47,10 +49,12 @@ def generate_report_from_results(
html_path = resolved_output_path.with_suffix(".html")
html_path.write_text(generate_report_html(result), encoding="utf-8")
primary_path = html_path
html_report_path = html_path
if report_format == "all":
primary_path = resolved_output_path.with_suffix(".md")

return ReportResult(
input_results_path=resolved_results_path,
output_report_path=primary_path,
html_report_path=html_report_path,
)
Loading