llm aliases defaults to llm aliases list, refs #154

Refs #167
This commit is contained in:
Simon Willison 2023-08-19 21:48:20 -07:00
parent adb900be1a
commit 0cd9333054
3 changed files with 12 additions and 6 deletions

View file

@ -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

View file

@ -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"

View file

@ -4,9 +4,10 @@ import json
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"
@ -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",