#!/usr/bin/env bash
set -euo pipefail
: "${OLLAMA_MODEL:?Set OLLAMA_MODEL to a model installed on your Ollama server}"

python3 - "$OLLAMA_MODEL" <<'PY' | curl \
  --fail-with-body --silent --show-error --max-time 120 \
  http://localhost:11434/api/chat \
  --header 'Content-Type: application/json' --data-binary @-
import json
import sys
json.dump({"model": sys.argv[1], "stream": False,
           "messages": [{"role": "user", "content": "Reply with OK."}],
           "options": {"num_predict": 32}}, sys.stdout)
PY
