lmcli/README.md

60 lines
1.8 KiB
Markdown
Raw Normal View History

2023-11-05 02:18:06 -07:00
# lmcli
2023-11-13 21:33:24 -07:00
`lmcli` is a (Large) Language Model CLI.
2023-11-05 02:18:06 -07:00
2023-11-13 21:33:24 -07:00
Current features:
- Perform one-shot prompts with `lmcli prompt <message>`
2024-01-11 10:25:52 -07:00
- Manage persistent conversations with the `new`, `reply`, `view`, `rm`,
`edit`, `retry`, `continue` sub-commands.
- Syntax highlighted output
2023-11-28 22:45:03 -07:00
- Tool calling, see the [Tools](#tools) section.
2023-11-13 21:33:24 -07:00
Maybe features:
2024-01-11 10:25:52 -07:00
- Chat-like interface (`lmcli chat`) for rapid back-and-forth conversations
2023-11-28 22:45:03 -07:00
- Support for additional models/APIs besides just OpenAI
2023-11-05 02:18:06 -07:00
2023-11-28 22:39:37 -07:00
## Tools
2023-11-29 08:38:48 -07:00
Tools must be explicitly enabled by adding the tool's name to the
`openai.enabledTools` array in `config.yaml`.
2023-11-28 22:39:37 -07:00
Note: all filesystem related tools operate relative to the current directory
2024-01-11 10:25:52 -07:00
only. They do not accept absolute paths, and efforts are made to ensure they
cannot escape above the working directory). **Close attention must be paid to
where you are running `lmcli`, as the model could at any time decide to use one
of these tools to discover and read potentially sensitive information from your
filesystem.**
2023-11-28 22:39:37 -07:00
2023-11-29 08:38:48 -07:00
It's best to only have tools enabled in `config.yaml` when you intend to be
using them, since their descriptions (see `pkg/cli/functions.go`) count towards
context usage.
2023-11-28 22:39:37 -07:00
Available tools:
2023-11-29 08:29:10 -07:00
- `read_dir` - Read the contents of a directory.
- `read_file` - Read the contents of a file.
- `write_file` - Write contents to a file.
- `file_insert_lines` - Insert lines at a position within a file. Tricky for
2023-11-28 22:39:37 -07:00
the model to use, but can potentially save tokens.
2023-11-29 08:29:10 -07:00
- `file_replace_lines` - Remove or replace a range of lines within a file. Even
2023-11-28 22:39:37 -07:00
trickier for the model to use.
2023-11-05 02:18:06 -07:00
## Install
```shell
$ go install git.mlow.ca/mlow/lmcli@latest
```
## Usage
Invoke `lmcli` at least once:
```shell
$ lmcli help
```
Edit `~/.config/lmcli/config.yaml` and set `openai.apiKey` to your API key.
Refer back to the output of `lmcli help` for usage.
Enjoy!