Skip to content

Commit

Permalink
llm aliases defaults to llm aliases list, refs #154
Browse files Browse the repository at this point in the history
Refs #167
  • Loading branch information
simonw committed Aug 20, 2023
1 parent adb900b commit 0cd9333
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Options:
--help Show this message and exit.
Commands:
list List current aliases
list* List current aliases
path Output the path to the aliases.json file
remove Remove an alias
set Set an alias for a model
Expand Down
6 changes: 5 additions & 1 deletion llm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,11 @@ def templates_list():
click.echo(display_truncated(text))


@cli.group()
@cli.group(
cls=DefaultGroup,
default="list",
default_if_no_args=True,
)
def aliases():
"Manage model aliases"

Expand Down
10 changes: 6 additions & 4 deletions tests/test_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import pytest


def test_aliases_list():
@pytest.mark.parametrize("args", (["aliases", "list"], ["aliases"]))
def test_aliases_list(args):
runner = CliRunner()
result = runner.invoke(cli, ["aliases", "list"])
result = runner.invoke(cli, args)
assert result.exit_code == 0
assert result.output == (
"3.5 : gpt-3.5-turbo\n"
Expand All @@ -19,9 +20,10 @@ def test_aliases_list():
)


def test_aliases_list_json():
@pytest.mark.parametrize("args", (["aliases", "list"], ["aliases"]))
def test_aliases_list_json(args):
runner = CliRunner()
result = runner.invoke(cli, ["aliases", "list", "--json"])
result = runner.invoke(cli, args + ["--json"])
assert result.exit_code == 0
assert json.loads(result.output) == {
"3.5": "gpt-3.5-turbo",
Expand Down

0 comments on commit 0cd9333

Please sign in to comment.