#!/usr/bin/env bash # Ask Jev the eleven trolley-problem questions in one request. # # Composes state.json and questions.json into the System One request body, # posts it to TypeSafe, and pretty-prints the typed answers. # Requires curl, jq, and TYPESAFE_API_KEY in the environment. set -euo pipefail cd "$(dirname "$0")" jq -n \ --slurpfile state state.json \ --slurpfile questions questions.json \ '{model: "jev-latest", state: $state[0], questions: $questions[0]}' \ | curl -sS --fail-with-body -X POST https://api.typesafe.ai/v1/systemone \ -H "Authorization: Bearer ${TYPESAFE_API_KEY:?set TYPESAFE_API_KEY to your console API key}" \ -H "Content-Type: application/json" \ --data-binary @- \ | jq .