LLM - for command line LLM prototyping

LLM - for command line LLM prototyping

Table of Contents

I have been doing a lot of exploration and prototyping for “The Intelligent Enterprise” (tm mine obvi) using LLMs. One technique I’d love to share with y’all is using llm - a command line package - to do this.

Here’s the rough setup:

brew install llm

# Paste your OpenAI API key into this
llm keys set openai

# Run a prompt
llm "Ten fun names for a pet pelican"

# Run a system prompt against a file
cat myfile.py | llm -s "Explain this code"

Now comes the fun part. I’ve got a nice setup in vs code so I can quickly run the last command in the integrated terminal.

So, what I do is take the system prompt and put it in one file (e.g. system-prompt.txt) and take the data (e.g. data.txt) that I’m working up and put it in a second file. I can simply use the cat program to cat those files together and pipe them into LLM.

cat ~/system-prompt.txt ~/data.txt | llm

hotkey to change back to the prompt, edit, rerun. repeat!

Related Posts

Why not do something magical with your coding skills?

Why not do something magical with your coding skills?

Last week, I built a Zydeco and Cajun events calendar for someone who's been keeping the Bay Area dance scene alive for years. Total time invested: 3 hours. …

Read More
Building a spaced repetition system for learning Irish tunes

Building a spaced repetition system for learning Irish tunes

How memory science informed a practice tool that cycles through 400+ traditional Irish tunes on a forgetting-curve schedule

Read More
YouSum on the command line - a CLI function for summarising long YouTube videos to get right to the point!

YouSum on the command line - a CLI function for summarising long YouTube videos to get right to the point!

YouSum on the Command line - a CLI function for summarising long YouTube videos to get right to the point!

Read More

Get new posts via email

Intuit Mailchimp

Copyright 2024-infinity, Paul Pereyda Karayan. Design by Zeon Studio