|
| 1 | +""" |
| 2 | +Evals CLI for formal verification benchmarks. |
| 3 | +""" |
| 4 | + |
| 5 | +import typer |
| 6 | +from typing_extensions import Annotated |
| 7 | + |
| 8 | +app = typer.Typer(help="Evaluation tools for formal verification benchmarks") |
| 9 | + |
| 10 | + |
| 11 | +@app.command() |
| 12 | +def solve( |
| 13 | + benchmark: Annotated[ |
| 14 | + str, |
| 15 | + typer.Argument(help="Benchmark name (e.g., 'dafnybench')"), |
| 16 | + ], |
| 17 | + framework: Annotated[ |
| 18 | + str, |
| 19 | + typer.Option( |
| 20 | + "--framework", |
| 21 | + "-f", |
| 22 | + help="Framework to use: 'inspect' or 'rawdog'", |
| 23 | + ), |
| 24 | + ] = "inspect", |
| 25 | + max_attempts: Annotated[ |
| 26 | + int | None, |
| 27 | + typer.Option( |
| 28 | + "--max-attempts", |
| 29 | + "-n", |
| 30 | + help="Maximum verification attempts with error feedback (default: let Inspect AI decide)", |
| 31 | + ), |
| 32 | + ] = None, |
| 33 | + model: Annotated[ |
| 34 | + str | None, |
| 35 | + typer.Option( |
| 36 | + "--model", |
| 37 | + "-m", |
| 38 | + help="Model to evaluate (e.g., 'anthropic/claude-3-5-sonnet-20241022')", |
| 39 | + ), |
| 40 | + ] = None, |
| 41 | + limit: Annotated[ |
| 42 | + int, |
| 43 | + typer.Option( |
| 44 | + "--limit", |
| 45 | + "-l", |
| 46 | + help="Limit number of samples to evaluate (default: 10, use -1 for all 782 samples)", |
| 47 | + ), |
| 48 | + ] = 10, |
| 49 | +) -> None: |
| 50 | + """ |
| 51 | + Run evaluation on a formal verification benchmark. |
| 52 | +
|
| 53 | + Examples: |
| 54 | +
|
| 55 | + # Run DafnyBench with Inspect AI (default: 10 samples, natural iteration) |
| 56 | + uv run solve dafnybench --framework inspect |
| 57 | +
|
| 58 | + # Run with all 782 samples |
| 59 | + uv run solve dafnybench --framework inspect --limit -1 |
| 60 | +
|
| 61 | + # Run with explicit max attempts |
| 62 | + uv run solve dafnybench --framework inspect --max-attempts 3 |
| 63 | +
|
| 64 | + # Run with specific model |
| 65 | + uv run solve dafnybench -f inspect -m anthropic/claude-3-5-sonnet-20241022 |
| 66 | + """ |
| 67 | + if benchmark.lower() == "dafnybench": |
| 68 | + if framework.lower() == "inspect": |
| 69 | + from evals.dafnybench.inspect_ai import run_dafnybench_eval |
| 70 | + |
| 71 | + # Convert limit=-1 to None (all samples) |
| 72 | + eval_limit = None if limit == -1 else limit |
| 73 | + |
| 74 | + if max_attempts is not None: |
| 75 | + typer.echo(f"Running DafnyBench with Inspect AI (max_attempts={max_attempts}, limit={limit if limit != -1 else 'all'})...") |
| 76 | + else: |
| 77 | + typer.echo(f"Running DafnyBench with Inspect AI (natural iteration, limit={limit if limit != -1 else 'all'})...") |
| 78 | + run_dafnybench_eval( |
| 79 | + max_attempts=max_attempts, |
| 80 | + model=model, |
| 81 | + limit=eval_limit, |
| 82 | + ) |
| 83 | + elif framework.lower() == "rawdog": |
| 84 | + typer.echo("rawdog framework not yet implemented", err=True) |
| 85 | + raise typer.Exit(code=1) |
| 86 | + else: |
| 87 | + typer.echo(f"Unknown framework: {framework}", err=True) |
| 88 | + typer.echo("Available frameworks: inspect, rawdog", err=True) |
| 89 | + raise typer.Exit(code=1) |
| 90 | + else: |
| 91 | + typer.echo(f"Unknown benchmark: {benchmark}", err=True) |
| 92 | + typer.echo("Available benchmarks: dafnybench", err=True) |
| 93 | + raise typer.Exit(code=1) |
| 94 | + |
| 95 | + |
1 | 96 | def main() -> None: |
2 | | - print("Hello from evals!") |
| 97 | + """Entry point for the CLI.""" |
| 98 | + app() |
0 commit comments