mirror of
https://github.com/Hopiu/llm.git
synced 2026-05-04 20:04:44 +00:00
llm aliases path command, refs #151
This commit is contained in:
parent
8fc9cd1902
commit
4a68aa408a
3 changed files with 28 additions and 0 deletions
|
|
@ -59,3 +59,18 @@ Now you can run the `gpt-3.5-turbo-16k` model using the `turbo` alias like this:
|
|||
```bash
|
||||
llm -m turbo 'An epic Greek-style saga about a cheesecake that builds a SQL database from scratch'
|
||||
```
|
||||
|
||||
## Viewing the aliases file
|
||||
|
||||
Aliases are stored in an `aliases.json` file in the LLM configuration directory.
|
||||
|
||||
To see the path to that file, run this:
|
||||
|
||||
```bash
|
||||
llm aliases path
|
||||
```
|
||||
To view the content of that file, run this:
|
||||
|
||||
```bash
|
||||
cat "$(llm aliases path)"
|
||||
```
|
||||
|
|
@ -600,6 +600,12 @@ def aliases_set(alias, model_id):
|
|||
path.write_text(json.dumps(current, indent=4) + "\n")
|
||||
|
||||
|
||||
@aliases.command(name="path")
|
||||
def aliases_path():
|
||||
"Output the path to the aliases.json file"
|
||||
click.echo(user_dir() / "aliases.json")
|
||||
|
||||
|
||||
@cli.command(name="plugins")
|
||||
def plugins_list():
|
||||
"List installed plugins"
|
||||
|
|
|
|||
|
|
@ -41,3 +41,10 @@ def test_aliases_set(user_path):
|
|||
assert result.exit_code == 0
|
||||
assert (user_path / "aliases.json").exists()
|
||||
assert json.loads((user_path / "aliases.json").read_text("utf-8")) == {"foo": "bar"}
|
||||
|
||||
|
||||
def test_aliases_path(user_path):
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(cli, ["aliases", "path"])
|
||||
assert result.exit_code == 0
|
||||
assert result.output.strip() == str(user_path / "aliases.json")
|
||||
|
|
|
|||
Loading…
Reference in a new issue