Portrait of Michael Limberger

Michael Limberger

Need me? Email mike@limberger.ca

AI

Quick Reference

Keep this nearby

Commands and patterns to copy. Same facts as the rest of the session, in one place.

Ollama

Show me.

ollama serve
curl http://localhost:11434/api/tags
ollama list
ollama pull ministral
ollama pull llava
ollama pull minicpm-v

Base64

Show me.

base64 -i image.png
base64 -i image.png | perl -pe's~\s~~g'
IMAGE_B64=$(base64 -i image.png | perl -pe's~\s~~g')
echo ${#IMAGE_B64}
getconf ARG_MAX
sips --resampleHeightWidthMax 768 image.png --out resized.png

Symbol map: s~\s~~g strips whitespace. ${#IMAGE_B64} is the string length. ARG_MAX is the terminal's command-length ceiling. sips resizes on macOS.

Raw curl

Show me.

IMAGE_B64=$(base64 -i image.png | perl -pe's~\s~~g')

curl -s http://localhost:11434/api/generate \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ministral",
    "prompt": "Describe this image",
    "images": ["'"$IMAGE_B64"'"],
    "stream": false
  }' | jq -r '.response'

Description prompt

Describe this image. Use plain text only. DO NOT use asterisks,
bold, or any markdown formatting.
List these aspects with a dash prefix:
- SUBJECT:
- SETTING:
- COLORS:
- CLOTHING:
- OBJECTS:
- MOOD:
Keep each line brief. No sub-bullets.

Moderation prompt

Answer YES or NO only for each question.
1. NUDE_CHEST: Is bare chest, breasts, or nipples visible?
2. NUDE_LOWER: Is bare buttocks or genitals visible?
3. WEAPON: Is the person holding a weapon (gun, knife, etc)?
NUDE_CHEST: YES or NO
NUDE_LOWER: YES or NO
WEAPON: YES or NO

Regex

Show me. Quiet, case-insensitive check, then flexible whitespace.

echo "$RESPONSE" | grep -qi "NUDE_CHEST: YES"
echo "$RESPONSE" | grep -Ei "NUDE_CHEST:\s*YES"

-q is quiet. -i is case-insensitive. -E is extended regex. \s* is zero or more whitespace.

JSON in, JSON out

Request:

{
  "model": "ministral",
  "prompt": "Your question here",
  "images": ["base64_data_here"],
  "stream": false,
  "options": {
    "temperature": 0.1
  }
}

Response:

{
  "model": "ministral",
  "response": "The model's answer...",
  "done": true
}

How the notes were laid out

2026-01-08-ai-watchman/
  01-overview.txt
  02-technology-stack.txt
  03-base64-encoding.txt
  04-first-vision-request.txt
  05-structured-prompting.txt
  06-pattern-matching.txt
  08-building-your-own.txt
  09-troubleshooting.txt
  10-glossary.txt
  11-quick-reference.txt    <- You are here

There is no 07. The original notes jumped.

Links

Ollama: ollama.com. API docs: github.com/ollama/ollama docs/api.md. Regex tester: regex101.com. These sessions: AI.