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:
parent
c5e29693e7
commit
22f2422aff
2 changed files with 10 additions and 4 deletions
|
|
@ -12,6 +12,7 @@ from openai import OpenAI, OpenAIError
|
|||
from rich.console import Console
|
||||
from rich.markup import escape
|
||||
from rich.text import Text
|
||||
from tqdm import tqdm
|
||||
|
||||
from arcade.cli.authn import LocalAuthCallbackServer, check_existing_login
|
||||
from arcade.cli.constants import DEFAULT_CLOUD_HOST, DEFAULT_ENGINE_HOST, LOCALHOST
|
||||
|
|
@ -310,7 +311,7 @@ def evals(
|
|||
"gpt-4o",
|
||||
"--models",
|
||||
"-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(
|
||||
LOCALHOST,
|
||||
|
|
@ -401,10 +402,14 @@ def evals(
|
|||
)
|
||||
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
|
||||
# Wait for all suite functions to complete
|
||||
results = await asyncio.gather(*tasks)
|
||||
all_evaluations.extend(results)
|
||||
display_eval_results(all_evaluations, show_details=show_details)
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ openai = "^1.36.0" # TODO: relax to an earlier version that still has what we ne
|
|||
arcadepy = "~0.2.0"
|
||||
pyjwt = "^2.8.0"
|
||||
loguru = "^0.7.0"
|
||||
tqdm = "^4.1.0"
|
||||
types-python-dateutil = "2.9.0.20241003"
|
||||
types-pytz = "2024.2.0.20241003"
|
||||
opentelemetry-instrumentation-fastapi = {version = "0.48b0", optional = true}
|
||||
|
|
|
|||
Loading…
Reference in a new issue