27 lines
802 B
Bash
27 lines
802 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROUTER_URL="http://127.0.0.1:9102"
|
|
|
|
curl -fsS "$ROUTER_URL/health" >/dev/null
|
|
|
|
echo "[INFO] Calling /v1/agents/devtools/infer for contract check"
|
|
resp=$(curl -fsS -X POST "$ROUTER_URL/v1/agents/devtools/infer" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"prompt":"Reply with: ok","max_tokens":32,"temperature":0.1}')
|
|
|
|
RESP="$resp" python3 - <<'PY'
|
|
import json, os
|
|
obj = json.loads(os.environ['RESP'])
|
|
required = [
|
|
'response', 'model', 'backend', 'tokens_used',
|
|
'image_base64', 'file_base64', 'file_name', 'file_mime'
|
|
]
|
|
missing = [k for k in required if k not in obj]
|
|
if missing:
|
|
raise SystemExit(f"Missing keys: {missing}; got keys={sorted(obj.keys())}")
|
|
print('[OK] Router infer contract keys present')
|
|
PY
|
|
|
|
echo "[OK] router contract canary passed"
|