Docs and tests for llm aliases list, refs #151

This commit is contained in:
Simon Willison 2023-08-11 23:00:11 -07:00
parent 4980f5a7c0
commit a8059a24a9
2 changed files with 49 additions and 0 deletions

32
docs/aliases.md Normal file
View file

@ -0,0 +1,32 @@
(aliases)=
# Model aliases
LLM supports model aliases, which allow you to refer to a model by a short name instead of its full ID.
To list current aliases, run this:
```bash
llm aliases
```
Example output:
<!-- [[[cog
from click.testing import CliRunner
import sys
sys._called_from_test = True
from llm.cli import cli
result = CliRunner().invoke(cli, ["aliases", "list"])
cog.out("```\n{}```".format(result.output))
]]] -->
```
3.5 : gpt-3.5-turbo
chatgpt : gpt-3.5-turbo
chatgpt-16k : gpt-3.5-turbo-16k
3.5-16k : gpt-3.5-turbo-16k
4 : gpt-4
gpt4 : gpt-4
4-32k : gpt-4-32k
orca : orca-openai-compat
0613 : gpt-3.5-turbo-0613
```
<!-- [[[end]]] -->

17
tests/test_aliases.py Normal file
View file

@ -0,0 +1,17 @@
from click.testing import CliRunner
from llm.cli import cli
def test_aliases_list():
runner = CliRunner()
result = runner.invoke(cli, ["aliases", "list"])
assert result.exit_code == 0
assert result.output == (
"3.5 = gpt-3.5-turbo\n"
"chatgpt = gpt-3.5-turbo\n"
"chatgpt-16k = gpt-3.5-turbo-16k\n"
"3.5-16k = gpt-3.5-turbo-16k\n"
"4 = gpt-4\n"
"gpt4 = gpt-4\n"
"4-32k = gpt-4-32k\n"
)