CLI tools for working with ChatGPT and other LLMs
simonwillison.net
simonwillison.net
In addition to a shell, functions for inserting GPT responses can be pretty neat too. For example, creating org tables [4].
[1]: https://xenodium.com/chatgpt-shell-available-on-melpa
[2]: https://xenodium.com/images/chatgpt-shell-available-on-melpa...
[3]: https://xenodium.com/images/chatgpt-shell-available-on-melpa...
[4]: https://raw.githubusercontent.com/xenodium/chatgpt-shell/mai...
EDIT- my mistake, the first link points it out as https://github.com/xenodium/ob-swiftui. Thanks for sharing!
Everything that goes through the tool can be logged to SQLite so this should make it easier to build up comparisons of different models.
$ curl -s https://news.ycombinator.com | strip-tags | ttok -t 4000 | llm --system 'summary bullet points' -sIf you want to use GPT-4 to manipulate and edit files in your local file system, you can use my cli tool aider [2]. It’s intended for generating and editing code, but you can use it to chat with GPT-4 to read, edit and write any text files in your local. If the files are under git source control, it will commit the changes as they happen as well.
Here’s a transcript of aider editing the ANSI-escape codes in an asciinema screencast recording, for example[3].
[1] https://github.com/sigoden/aichat
My preferred method is to run a WhatsApp bot, this way I can easily use the LLM also on my phone. And on a computer I just use WhatsApp web, which I keep running anyways. Also this method natively supports iterated conversations.
That, plus some scripts for repetitive stuff.
From what I understand this might get killed by Facebook at some point as they never approved this method.
[1]: https://apps.apple.com/us/app/openai-chatgpt/id6448311069
If you want to run against GPT-4 (and your API key has access) you can pass "-4" or "--gpt4" as an option.
CORRECTION: Sorry, I was talking about my "llm" tool - https://github.com/simonw/llm - it looks like "mods" does indeed default to 4: https://github.com/charmbracelet/mods/blob/e6352fdd8487ff8fc...
I've been experimenting with CLI/LLM tools and found my favorite approach is to make the LLM constantly accessible in my shell. The way I do this is to add a transparent wrapper around whatever your shell is (bash,zsh,etc), send commands that start with capital letters to ChatGPT, and manage a history of local commands and GPT responses. This means you can ask questions about a command's output and autocomplete based on ChatGPT suggestions, etc.
You can see this approach here, I hope it proves useful to other folks! https://github.com/bakks/butterfish
Early days, but you can see some of the ways this is already helping me out quite a bit (and increasing my enjoyment of things I already like to do): github.com/zackproser/automations
echo "Who are you?" | lmql run "argmax '\"Q:{await input()} A:[RESULT]';print(RESULT) from 'chatgpt'" --no-realtime
Gives you: I am an AI language model created by OpenAI.I am one of the LMQL devs and we plan to also add a little more seamless CLI interface, e.g. to support processing multiple lines of text (e.g. quick classification tasks).
It was a very novel experience writing the API for the simple "tools" in plain English in the system prompt (e.g. to search the web, read a website), though I never managed to make GPT4 successfully use the "execute Javascript" one.
It's really nice to have an always-open ChatGPT equivalent in one of my terminal tabs that I can switch to at any time.
I took a brief look at your code and it just looks like your run of the mill python and bash code, with an integration locked to tmux.
Have you ran benchmarks comparing the time it takes to show the full response of a prompt with a daemon and without?
I'm a bit skeptical that loading the amount of code that you have into memory takes that long, but I'm coming from a nodejs background.
[0] https://github.com/keybittech/wizapp
[1] https://github.com/jcmccormick/wc/blob/main/api/src/modules/...
[2] https://gist.githubusercontent.com/jcmccormick/38b5527c16479...
I would like to get API access to more models. I am getting RSI filling out the application emails.
It is fun tho. Also being able to build what I want to use. Get what I need.