Add progress bar to Evals CLI (#185)

Adds a progress bar to the arcade evals CLI command. Displays progress
on the number of `@tool_eval` functions that have completed.
This commit is contained in:
Eric Gustin 2025-01-08 22:40:45 -08:00 committed by GitHub
parent c5e29693e7
commit 22f2422aff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -12,6 +12,7 @@ from openai import OpenAI, OpenAIError
from rich.console import Console from rich.console import Console
from rich.markup import escape from rich.markup import escape
from rich.text import Text from rich.text import Text
from tqdm import tqdm
from arcade.cli.authn import LocalAuthCallbackServer, check_existing_login from arcade.cli.authn import LocalAuthCallbackServer, check_existing_login
from arcade.cli.constants import DEFAULT_CLOUD_HOST, DEFAULT_ENGINE_HOST, LOCALHOST from arcade.cli.constants import DEFAULT_CLOUD_HOST, DEFAULT_ENGINE_HOST, LOCALHOST
@ -310,7 +311,7 @@ def evals(
"gpt-4o", "gpt-4o",
"--models", "--models",
"-m", "-m",
help="The models to use for evaluation (default: gpt-4o)", help="The models to use for evaluation (default: gpt-4o). Use commas to separate multiple models.",
), ),
host: str = typer.Option( host: str = typer.Option(
LOCALHOST, LOCALHOST,
@ -401,10 +402,14 @@ def evals(
) )
tasks.append(task) tasks.append(task)
# TODO add a progress bar here # Track progress and results as suite functions complete
with tqdm(total=len(tasks), desc="Evaluations Progress") as pbar:
results = []
for f in asyncio.as_completed(tasks):
results.append(await f)
pbar.update(1)
# TODO error handling on each eval # TODO error handling on each eval
# Wait for all suite functions to complete
results = await asyncio.gather(*tasks)
all_evaluations.extend(results) all_evaluations.extend(results)
display_eval_results(all_evaluations, show_details=show_details) display_eval_results(all_evaluations, show_details=show_details)

View file

@ -26,6 +26,7 @@ openai = "^1.36.0" # TODO: relax to an earlier version that still has what we ne
arcadepy = "~0.2.0" arcadepy = "~0.2.0"
pyjwt = "^2.8.0" pyjwt = "^2.8.0"
loguru = "^0.7.0" loguru = "^0.7.0"
tqdm = "^4.1.0"
types-python-dateutil = "2.9.0.20241003" types-python-dateutil = "2.9.0.20241003"
types-pytz = "2024.2.0.20241003" types-pytz = "2024.2.0.20241003"
opentelemetry-instrumentation-fastapi = {version = "0.48b0", optional = true} opentelemetry-instrumentation-fastapi = {version = "0.48b0", optional = true}