irthomasthomas / llm

Access large language models from the command-line
https://llm.datasette.io
Apache License 2.0
0 stars 0 forks source link

Shell Functions using LLM #7

Open irthomasthomas opened 1 year ago

irthomasthomas commented 1 year ago

Temporary location for my collection of (mostly ZSH) functions using llm cli.

irthomasthomas commented 1 year ago
makefilename() {
  file_content="$1"
  # Truncate to <=400 tokens
  trunc_content=$(ttok "$file_content" -t 400)
  llm_template="makefilename"
  echo "$trunc_content" | llm -m 3.5 -t $llm_template -o temperature 0 -o max_tokens 15
  }

prompt: $input
system: Generate a file name for supplied input. Following Linux best practice naming
    conventions.
irthomasthomas commented 1 year ago

That file name generator prompt is very unreliable. I must have a better version somewhere.