Setting LLM ClI default template with a wrapper
The LLM tool is easily one of my
favourite CL’S in the past year. In my regular usage, I often bust it out to just get a quick response for a short query.
Most LLMs can’t help themselves and insist on being overly verbose. I noticed
that all of my queries contained the phrase “be short” or “be direct” or some
other variation therein. This is precisely what llm template addresses
Here’s what I entered into the yaml created by llm template edit default:
name: default
system: |
Be as short, direct and concise as possible. Do not make any further
suggestions --- I'll ask exactly what I need and nothing more. If I need some
coding help, just return the required code with minimal explanation. Again ---
I will ask you if I need you to explain it further. Lists are preferredBut now to use this, I need to add the flag -t default to every llm call.
There’s support to configure a default model, but not a default template.
Instead of dealing with the extra error-prone keystrokes, I’ve got this script
at ~/.local/bin/lm:
#!/usr/bin/env bash
subcommands="prompt aliases chat collections embed embed-models embed-multi \
fragments install keys logs models openai openrouter plugins \
schemas similar templates tools uninstall"
if [[ "$1" == -* ]] || [[ " $subcommands " == *" $1 "* ]]; then
command llm "$@"
else
command llm -t default "$@"
fiAnd now, if I call lm instead of llm, it’ll add the flag -t default
unless I’ve specifically invoked a subcommand of the CLI!
Reply to this post by email blZake@proZbableodyssey.blog (remove Z characters) ↪