Skip to content

Commit ffea3f3

Browse files
committed
docs(cli): audit and complete help text examples for all commands
1 parent 6539586 commit ffea3f3

File tree

1 file changed

+150
-13
lines changed

1 file changed

+150
-13
lines changed

src/evalhub/cli/main.py

Lines changed: 150 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,17 @@ def main(
6363
token: str | None,
6464
verbose: bool,
6565
) -> None:
66-
"""EvalHub CLI - manage evaluations, providers, collections, and configuration."""
66+
"""EvalHub CLI - manage evaluations, providers, collections, and configuration.
67+
68+
\b
69+
Quick start:
70+
evalhub config set base_url http://localhost:8080
71+
evalhub config set token my-api-token
72+
evalhub config set tenant my-tenant
73+
evalhub health
74+
evalhub eval run --config eval.yaml
75+
evalhub eval status
76+
"""
6777
if not verbose:
6878
logging.getLogger("evalhub").setLevel(logging.ERROR)
6979
ctx.ensure_object(dict)
@@ -74,13 +84,31 @@ def main(
7484

7585
@main.command()
7686
def version() -> None:
77-
"""Print version and build info."""
87+
"""Print the EvalHub CLI version.
88+
89+
\b
90+
Examples:
91+
evalhub version
92+
"""
7893
click.echo(f"evalhub {evalhub.__version__}")
7994

8095

8196
@main.group()
8297
def eval() -> None:
83-
"""Submit and manage evaluation jobs."""
98+
"""Submit and manage evaluation jobs.
99+
100+
\b
101+
Use 'eval run' to submit a new evaluation, 'eval status' to track
102+
progress, 'eval results' to fetch outcomes, and 'eval cancel' to
103+
abort a running job.
104+
105+
\b
106+
Examples:
107+
evalhub eval run --config eval.yaml
108+
evalhub eval status
109+
evalhub eval results eval-123
110+
evalhub eval cancel eval-123
111+
"""
84112

85113

86114
def _load_config_file(path: str) -> dict[str, Any]:
@@ -480,7 +508,20 @@ def eval_cancel(ctx: click.Context, job_id: str, hard_delete: bool) -> None:
480508

481509
@main.group()
482510
def collections() -> None:
483-
"""Browse and manage benchmark collections."""
511+
"""Browse and manage benchmark collections.
512+
513+
\b
514+
Collections group related benchmarks together for convenient
515+
evaluation. Use 'collections list' to browse, 'collections describe'
516+
for details, 'collections run' to evaluate a model against a
517+
collection, or 'collections create/delete' to manage them.
518+
519+
\b
520+
Examples:
521+
evalhub collections list
522+
evalhub collections describe rag-safety
523+
evalhub collections run rag-safety --model-url http://vllm:8000/v1 --model-name llama3
524+
"""
484525

485526

486527
@collections.command("list")
@@ -696,15 +737,36 @@ def collections_run(
696737

697738
@main.group()
698739
def providers() -> None:
699-
"""List and inspect evaluation providers."""
740+
"""List and inspect evaluation providers.
741+
742+
\b
743+
Providers are evaluation frameworks (e.g. lm-evaluation-harness,
744+
ragas, garak) registered with EvalHub. Each provider exposes a
745+
set of benchmarks that can be used in evaluation jobs.
746+
747+
\b
748+
Examples:
749+
evalhub providers list
750+
evalhub providers describe lm_evaluation_harness
751+
"""
700752

701753

702754
@providers.command("list")
703755
@format_option()
704756
@click.pass_context
705757
@handle_api_errors
706758
def providers_list(ctx: click.Context, output_format: str) -> None:
707-
"""List all registered evaluation providers."""
759+
"""List all registered evaluation providers.
760+
761+
\b
762+
Shows provider ID, name, description, and number of benchmarks.
763+
764+
\b
765+
Examples:
766+
evalhub providers list
767+
evalhub providers list --format json
768+
evalhub providers list --format csv
769+
"""
708770
client = get_client(ctx)
709771
items = client.providers.list()
710772
rows = [
@@ -731,7 +793,18 @@ def providers_list(ctx: click.Context, output_format: str) -> None:
731793
def providers_describe(
732794
ctx: click.Context, provider_id: str, output_format: str
733795
) -> None:
734-
"""Show detailed information about a provider."""
796+
"""Show detailed information about a provider.
797+
798+
\b
799+
Displays provider metadata and its available benchmarks with
800+
categories and supported metrics.
801+
802+
\b
803+
Examples:
804+
evalhub providers describe lm_evaluation_harness
805+
evalhub providers describe ragas --format json
806+
evalhub providers describe garak --format yaml
807+
"""
735808
client = get_client(ctx)
736809
provider = client.providers.get(provider_id)
737810

@@ -767,7 +840,18 @@ def providers_describe(
767840
@click.pass_context
768841
@handle_api_errors
769842
def health(ctx: click.Context) -> None:
770-
"""Check health of the EvalHub service."""
843+
"""Check health of the EvalHub service.
844+
845+
\b
846+
Sends a health check request and reports service status with
847+
response time. Exits with code 1 if the service is unhealthy
848+
or unreachable.
849+
850+
\b
851+
Examples:
852+
evalhub health
853+
evalhub --base-url https://evalhub.example.com health
854+
"""
771855
client = get_client(ctx)
772856
start = time.monotonic()
773857
try:
@@ -786,15 +870,41 @@ def health(ctx: click.Context) -> None:
786870
@main.group()
787871
@click.pass_context
788872
def config(ctx: click.Context) -> None:
789-
"""View and update CLI configuration."""
873+
"""View and update CLI configuration.
874+
875+
\b
876+
Configuration is stored in ~/.config/evalhub/config.yaml and
877+
supports multiple profiles. Use 'config set' to store values,
878+
'config get' to read them, 'config list' to see the full
879+
profile, and 'config use' to switch profiles.
880+
881+
\b
882+
Examples:
883+
evalhub config set base_url http://localhost:8080
884+
evalhub config get base_url
885+
evalhub config list
886+
evalhub config use prod
887+
"""
790888

791889

792890
@config.command("set")
793891
@click.argument("key")
794892
@click.argument("value")
795893
@click.pass_context
796894
def config_set(ctx: click.Context, key: str, value: str) -> None:
797-
"""Set a configuration value in the active profile."""
895+
"""Set a configuration value in the active profile.
896+
897+
\b
898+
Known keys: base_url, token, tenant, provider, insecure, timeout.
899+
900+
\b
901+
Examples:
902+
evalhub config set base_url http://localhost:8080
903+
evalhub config set token my-api-token
904+
evalhub config set tenant my-tenant
905+
evalhub config set insecure true
906+
evalhub --profile prod config set base_url https://evalhub.example.com
907+
"""
798908
if not cfg.is_known_key(key):
799909
click.echo(
800910
f"Warning: '{key}' is not a recognised config key. "
@@ -813,7 +923,14 @@ def config_set(ctx: click.Context, key: str, value: str) -> None:
813923
@click.argument("key")
814924
@click.pass_context
815925
def config_get(ctx: click.Context, key: str) -> None:
816-
"""Get a configuration value from the active profile."""
926+
"""Get a configuration value from the active profile.
927+
928+
\b
929+
Examples:
930+
evalhub config get base_url
931+
evalhub config get token
932+
evalhub --profile prod config get base_url
933+
"""
817934
profile = ctx.obj.get("profile")
818935
data = cfg.load_config()
819936
value = cfg.get_value(data, key, profile=profile)
@@ -826,7 +943,16 @@ def config_get(ctx: click.Context, key: str) -> None:
826943
@config.command("list")
827944
@click.pass_context
828945
def config_list(ctx: click.Context) -> None:
829-
"""List all configuration values in the active profile."""
946+
"""List all configuration values in the active profile.
947+
948+
\b
949+
Shows all key-value pairs and flags any missing required keys.
950+
951+
\b
952+
Examples:
953+
evalhub config list
954+
evalhub --profile prod config list
955+
"""
830956
profile = ctx.obj.get("profile")
831957
data = cfg.load_config()
832958
profile_name = profile or cfg.get_active_profile(data)
@@ -845,7 +971,18 @@ def config_list(ctx: click.Context) -> None:
845971
@config.command("use")
846972
@click.argument("profile")
847973
def config_use(profile: str) -> None:
848-
"""Switch the active configuration profile."""
974+
"""Switch the active configuration profile.
975+
976+
\b
977+
Sets the given profile as the default for all subsequent commands.
978+
The profile must already exist (create it by setting a value with
979+
--profile).
980+
981+
\b
982+
Examples:
983+
evalhub config use prod
984+
evalhub config use staging
985+
"""
849986
data = cfg.load_config()
850987
profiles = data.get("profiles", {})
851988
if profile not in profiles:

0 commit comments

Comments
 (0)