57 lines
3.2 KiB
Bash
Executable File
57 lines
3.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# fleet-probes-swift15.sh — RUNS ON DANKSERVER. The cutover contract probes.
|
|
set -uo pipefail
|
|
B=http://localhost:7770/v1
|
|
|
|
echo "== vision (solid red 512px, expect 'Red')"
|
|
python3 - <<'PY'
|
|
import base64, json, urllib.request, struct, zlib
|
|
def png(color):
|
|
w = h = 512
|
|
raw = b"".join(b"\x00" + bytes(color) * w for _ in range(h))
|
|
def chunk(t, d):
|
|
c = t + d
|
|
return struct.pack(">I", len(d)) + c + struct.pack(">I", zlib.crc32(c))
|
|
return (b"\x89PNG\r\n\x1a\n"
|
|
+ chunk(b"IHDR", struct.pack(">IIBBBBB", w, h, 8, 2, 0, 0, 0))
|
|
+ chunk(b"IDAT", zlib.compress(raw)) + chunk(b"IEND", b""))
|
|
b64 = base64.b64encode(png((255, 0, 0))).decode()
|
|
body = json.dumps({"model": "frank-primary", "max_tokens": 256, "temperature": 0,
|
|
"messages": [{"role": "user", "content": [
|
|
{"type": "image_url", "image_url": {"url": "data:image/png;base64," + b64}},
|
|
{"type": "text", "text": "What color is this image? Answer with one word."}]}]}).encode()
|
|
r = urllib.request.Request("http://localhost:7770/v1" + "/chat/completions",
|
|
data=body, headers={"Content-Type": "application/json"})
|
|
d = json.load(urllib.request.urlopen(r, timeout=300))
|
|
m = d["choices"][0]["message"]
|
|
ans = (m.get("content") or m.get("reasoning_content") or "")
|
|
print("VISION ANSWER:", ans[:80].replace("\n", " "))
|
|
PY
|
|
|
|
echo "== tools (expect tool_calls)"
|
|
curl -s -m 120 $B/chat/completions -H 'Content-Type: application/json' -d '{
|
|
"model":"frank-primary","temperature":0,"max_tokens":128,
|
|
"messages":[{"role":"user","content":"What is 23 times 47? Use the calculator tool."}],
|
|
"tools":[{"type":"function","function":{"name":"calculator","description":"evaluate arithmetic",
|
|
"parameters":{"type":"object","properties":{"expr":{"type":"string"}},"required":["expr"]}}}]}' \
|
|
| python3 -c 'import json,sys; d=json.load(sys.stdin); m=d["choices"][0]["message"]; print("TOOL_CALLS:", m.get("tool_calls"))'
|
|
|
|
echo "== reasoning_effort fold (xhigh/medium/low/high all 200 on froggeric v22.5)"
|
|
for lvl in xhigh medium low high; do
|
|
code=$(curl -s -o /dev/null -w "%{http_code}" -m 120 $B/chat/completions \
|
|
-H 'Content-Type: application/json' \
|
|
-d "{\"model\":\"frank-primary\",\"max_tokens\":8,\"reasoning_effort\":\"$lvl\",\"messages\":[{\"role\":\"user\",\"content\":\"hi\"}]}")
|
|
echo " reasoning_effort=$lvl -> HTTP $code"
|
|
done
|
|
|
|
echo "== reasoning_content channel"
|
|
curl -s -m 120 $B/chat/completions -H 'Content-Type: application/json' \
|
|
-d '{"model":"frank-primary","max_tokens":64,"messages":[{"role":"user","content":"Is 97 prime? Think briefly."}]}' \
|
|
| python3 -c 'import json,sys; m=json.load(sys.stdin)["choices"][0]["message"]; print("has reasoning_content:", bool(m.get("reasoning_content")), "| content:", (m.get("content") or "")[:60].replace(chr(10)," "))'
|
|
|
|
echo "== response_format json_object"
|
|
curl -s -m 120 $B/chat/completions -H 'Content-Type: application/json' \
|
|
-d '{"model":"frank-primary","max_tokens":64,"response_format":{"type":"json_object"},"messages":[{"role":"user","content":"Return JSON {\"ok\": true}"}]}' \
|
|
| python3 -c 'import json,sys; d=json.load(sys.stdin); print("JSON MODE:", (d["choices"][0]["message"].get("content") or "")[:60])'
|
|
echo "PROBES_DONE"
|