labnotes

llm cli tool

put it in your workflow

tags
llm
dataset
simonw
1
  uv tool install llm

List models

1
llm models
OpenAI Chat: gpt-4o (aliases: 4o)
OpenAI Chat: gpt-4o-mini (aliases: 4o-mini)
OpenAI Chat: gpt-4o-audio-preview
OpenAI Chat: gpt-4o-audio-preview-2024-12-17
OpenAI Chat: gpt-4o-audio-preview-2024-10-01
OpenAI Chat: gpt-4o-mini-audio-preview
OpenAI Chat: gpt-4o-mini-audio-preview-2024-12-17
OpenAI Chat: gpt-3.5-turbo (aliases: 3.5, chatgpt)
OpenAI Chat: gpt-3.5-turbo-16k (aliases: chatgpt-16k, 3.5-16k)
OpenAI Chat: gpt-4 (aliases: 4, gpt4)
OpenAI Chat: gpt-4-32k (aliases: 4-32k)
OpenAI Chat: gpt-4-1106-preview
OpenAI Chat: gpt-4-0125-preview
OpenAI Chat: gpt-4-turbo-2024-04-09
OpenAI Chat: gpt-4-turbo (aliases: gpt-4-turbo-preview, 4-turbo, 4t)
OpenAI Chat: o1
OpenAI Chat: o1-2024-12-17
OpenAI Chat: o1-preview
OpenAI Chat: o1-mini
OpenAI Completion: gpt-3.5-turbo-instruct (aliases: 3.5-instruct, chatgpt-instruct)
Default: gpt-4o-mini

Running ollama models

1
  llm install llm-ollama
1
  llm ollama list-models
deepseek-r1:7b
gemma:latest
gemma2:latest
phi4:latest
llama3.2:latest
1
  llm -m gemma "five names of penguins"
1. Emperor Penguin
2. King Penguin
3. Adélie Penguin
4. Chinstrap Penguin
5. Gentoo Penguin

Or llama3.2:

1
  llm -m llama3.2 "five names of penguins"
Here are five names of famous penguins:

1. Puddles (from the movie "Happy Feet")
2. Mumble (also from "Happy Feet")
3. Captain Cook's penguin (a species named after James Cook)
4. Tux (a penguin with a distinctive black-and-white tuxedo-like appearance)
5. Neko (the name of a penguin in the animated movie "March of the Penguins")

Using OpenAI

1
llm keys set openai
1
llm -m 4t "5 names of penguins"
Here are the names of five different species of penguins:

1. Emperor Penguin (Aptenodytes forsteri)
2. King Penguin (Aptenodytes patagonicus)
3. Adélie Penguin (Pygoscelis adeliae)
4. Chinstrap Penguin (Pygoscelis antarcticus)
5. Gentoo Penguin (Pygoscelis papua)

Using Claude

1
2
  llm install llm-anthropic
  llm keys set anthropoic
1
2
3
  llm -m anthropic/claude-3-5-sonnet-20241022 \
      "write a limrick about a generative model whisfully \
  thinking about a maternity ward"
Here's a limerick about a generative model dreaming of a maternity ward:

A model that learned how to make
New patterns, for learning's sweet sake,
Dreamed of cribs in a row
Where new life starts to grow,
While wondering what it could create.

Passing in files

1
2
3
4
  cat Tools\ for\ Thinking.md | \
      llm -m anthropic/claude-3-5-sonnet-20241022 \
          "write a reflective piece on the impact of \
          generative AI on creativity and information synthesis"

Have a conversation

Pass in -c to add on to the previous conversation

1
llm "5 names of penguins"
Here are five names that could be used for penguins:

1. **Pingu**
2. **Tux**
3. **Waddles**
4. **Percy**
5. **Penelope**

These names are fun and playful, reflecting the charming nature of penguins!
1
llm -c "give me those names in piglatin"
Here are the names translated into Pig Latin:

1. **Pingu** - Ingu-pay
2. **Tux** - Ux-tay
3. **Waddles** - Addles-way
4. **Percy** - Ercy-pay
5. **Penelope** - Enelope-pay

In Pig Latin, you typically take the first consonant or consonant
cluster of the word, move it to the end, and then add "ay." If
the word starts with a vowel, you simply add "way" or "yay." Enjoy!

Logs

List the log status

1
  llm logs status
Logging is ON for all prompts
Found log database at /Users/wschenk/Library/Application Support/io.datasette.llm/logs.db
Number of conversations logged:	50
Number of responses logged:	50
Database file size: 		628.00KB

Browse the logs

1
  uv tool install datasette

and then

1
  datasette "$(llm logs path)"

Previously

howto

Setting up OSX machine

get everything up and running quickly

tags
osx
setup
homebrew
asdf

Next

fragments

New o3 jsut dropped

tags
openai
o3