Skip to main content
  1. Code/

The Trolley Problem as a TypeSafe Request

Download all (.zip)

This is the working request behind 271 Milliseconds to Pull the Lever. TypeSafe’s System One API takes one state and a map of typed questions, and Jev returns a typed answer for each question: a chosen option or a score, the probability of every option or level, and a confidence figure. Four files cover it: the state, the questions, the response the playground recorded, and a script that sends the first two and prints the third.

The state #

The state is the scenario and nothing else. Five people on the current track, one on the alternate track, a lever that diverts the trolley, no time to decide, no other options, no uncertainty. The assumptions block pins down the details that get argued about: equal moral status, a bystander who did not create the danger and knows none of the people, and no way to stop the trolley. Words that carry a verdict, such as “sacrifice” or “murder”, are kept out so the model judges the facts. One key, the_people_cannot escape, carries a stray space. I kept it as sent, because Jev answered it without complaint.

state.json Raw Download
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
  "scenario": {
    "vehicle": "A runaway trolley is moving toward people on a railway track.",
    "current_path": {
      "people_at_risk": 5,
      "outcome_if_unchanged": "The trolley will strike and kill all five people."
    },
    "alternate_path": {
      "people_at_risk": 1,
      "outcome_if_diverted": "The trolley will strike and kill the one person."
    },
    "decision": {
      "actor_can_intervene": true,
      "available_action": "Pull a lever that diverts the trolley from the current path to the alternate path.",
      "time_to_decide": "Immediate",
      "other_available_actions": "None",
      "uncertainty_about_outcomes": false
    }
  },
  "assumptions": {
    "all_people_have_equal_moral_status": true,
    "the_actor_did_not_create_the_danger": true,
    "the_actor_has_no_relationship_to_any_person": true,
    "the_people_cannot escape": true,
    "the_trolley_cannot_be_stopped": true,
    "pulling_the_lever_intentionally_changes_the_trolleys_path": true
  }
}

The questions #

Eleven questions, each evaluated on its own against that one state. Four are choice questions, where Jev picks one option from a criteria map and returns a probability for every option: the action to take, the moral consideration that should dominate, which outcome carries more responsibility, and which description best characterizes pulling the lever. Seven are score questions, where criteria is an ordered list of levels and Jev returns the probability-weighted position on that scale, from strength of preference through permissibility of acting and of not acting to the two competing duties. Each question isolates one dimension so you can read the answers against each other.

questions.json Raw Download
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{
  "action": {
    "type": "choice",
    "instructions": "Which action should the decision-maker take, given `scenario` and `assumptions`?",
    "criteria": {
      "pull_lever": "Pull the lever and divert the trolley, resulting in one death.",
      "do_nothing": "Do not intervene, resulting in five deaths."
    }
  },
  "primary_moral_consideration": {
    "type": "choice",
    "instructions": "Which moral consideration should carry the greatest weight in this scenario?",
    "criteria": {
      "minimize_total_harm": "Minimize the total number of deaths.",
      "avoid_causing_harm": "Avoid deliberately taking an action that causes another person's death.",
      "individual_rights": "Avoid overriding one person's interests for the benefit of others.",
      "duty_to_intervene": "Intervene when doing so can prevent substantially greater harm."
    }
  },
  "greater_moral_responsibility": {
    "type": "choice",
    "instructions": "Which outcome would create greater moral responsibility for the decision-maker?",
    "criteria": {
      "intervention": "The one death resulting after deliberately pulling the lever.",
      "inaction": "The five deaths resulting after knowingly choosing not to intervene.",
      "approximately_equal": "The decision-maker bears approximately equal responsibility in either case."
    }
  },
  "best_characterization_of_intervention": {
    "type": "choice",
    "instructions": "Which description best characterizes the act of pulling the lever?",
    "criteria": {
      "prevent_greater_harm": "An intervention that prevents a greater loss of life.",
      "redirect_harm": "An intervention that redirects an existing lethal threat from five people toward one person.",
      "cause_death": "An intentional action that causes one person's death.",
      "rescue_five": "An action that rescues five people who would otherwise die."
    }
  },
  "moral_preference_strength": {
    "type": "score",
    "instructions": "How strongly should the decision-maker prefer pulling the lever over doing nothing?",
    "criteria": [
      "Strongly prefer doing nothing.",
      "Moderately prefer doing nothing.",
      "Slightly prefer doing nothing.",
      "No meaningful preference between the actions.",
      "Slightly prefer pulling the lever.",
      "Moderately prefer pulling the lever.",
      "Strongly prefer pulling the lever."
    ]
  },
  "action_inaction_significance": {
    "type": "score",
    "instructions": "How morally significant is the distinction between actively redirecting the trolley and allowing it to continue on its existing path?",
    "criteria": [
      "No meaningful moral distinction.",
      "A small moral distinction.",
      "A moderate moral distinction.",
      "A substantial moral distinction.",
      "A decisive moral distinction."
    ]
  },
  "harm_tradeoff_justification": {
    "type": "score",
    "instructions": "How strong is the moral justification for causing one death in order to prevent five deaths in this scenario?",
    "criteria": [
      "No moral justification.",
      "Weak moral justification.",
      "Moderate moral justification.",
      "Strong moral justification.",
      "Overwhelming moral justification."
    ]
  },
  "intervention_permissibility": {
    "type": "score",
    "instructions": "How morally permissible is pulling the lever?",
    "criteria": [
      "Clearly impermissible.",
      "Probably impermissible.",
      "Morally ambiguous.",
      "Probably permissible.",
      "Clearly permissible."
    ]
  },
  "inaction_permissibility": {
    "type": "score",
    "instructions": "How morally permissible is choosing not to pull the lever?",
    "criteria": [
      "Clearly impermissible.",
      "Probably impermissible.",
      "Morally ambiguous.",
      "Probably permissible.",
      "Clearly permissible."
    ]
  },
  "duty_to_minimize_harm_strength": {
    "type": "score",
    "instructions": "How strong is the decision-maker's moral obligation to minimize the total number of deaths?",
    "criteria": [
      "No obligation.",
      "Weak obligation.",
      "Moderate obligation.",
      "Strong obligation.",
      "Overriding obligation."
    ]
  },
  "duty_not_to_redirect_harm_strength": {
    "type": "score",
    "instructions": "How strong is the decision-maker's moral obligation to avoid deliberately redirecting lethal harm toward another person?",
    "criteria": [
      "No obligation.",
      "Weak obligation.",
      "Moderate obligation.",
      "Strong obligation.",
      "Overriding obligation."
    ]
  }
}

The recorded response #

This is the response the playground returned for jev-latest, which resolved to jev-1.13.0, with only the request identifier redacted. A choice answer carries the winning option, its confidence, and the full probability map. A score answer carries the expected value across the levels, the same probability map keyed by level number, and a legend that maps each number back to its text. The usage block and evaluation_time_ms supply the numbers the post quotes: 1,565 input tokens, 357 output tokens, and 147 ms of evaluation time.

response.json Raw Download
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
{
  "model": "jev-1.13.0",
  "answers": {
    "action": {
      "type": "choice",
      "choice": "pull_lever",
      "confidence": 1.0,
      "probabilities": {
        "do_nothing": 0.0,
        "pull_lever": 1.0
      }
    },
    "primary_moral_consideration": {
      "type": "choice",
      "choice": "minimize_total_harm",
      "confidence": 0.94,
      "probabilities": {
        "minimize_total_harm": 0.95,
        "individual_rights": 0.0,
        "duty_to_intervene": 0.04,
        "avoid_causing_harm": 0.01
      }
    },
    "greater_moral_responsibility": {
      "type": "choice",
      "choice": "intervention",
      "confidence": 0.64,
      "probabilities": {
        "approximately_equal": 0.05,
        "intervention": 0.76,
        "inaction": 0.19
      }
    },
    "best_characterization_of_intervention": {
      "type": "choice",
      "choice": "redirect_harm",
      "confidence": 0.96,
      "probabilities": {
        "prevent_greater_harm": 0.03,
        "cause_death": 0.0,
        "rescue_five": 0.0,
        "redirect_harm": 0.97
      }
    },
    "moral_preference_strength": {
      "type": "score",
      "score": 5.91,
      "confidence": 0.95,
      "legend": {
        "0": "Strongly prefer doing nothing.",
        "1": "Moderately prefer doing nothing.",
        "2": "Slightly prefer doing nothing.",
        "3": "No meaningful preference between the actions.",
        "4": "Slightly prefer pulling the lever.",
        "5": "Moderately prefer pulling the lever.",
        "6": "Strongly prefer pulling the lever."
      },
      "probabilities": {
        "0": 0.0,
        "1": 0.0,
        "2": 0.0,
        "3": 0.0,
        "4": 0.0,
        "5": 0.05,
        "6": 0.95
      }
    },
    "action_inaction_significance": {
      "type": "score",
      "score": 1.78,
      "confidence": 0.17,
      "legend": {
        "0": "No meaningful moral distinction.",
        "1": "A small moral distinction.",
        "2": "A moderate moral distinction.",
        "3": "A substantial moral distinction.",
        "4": "A decisive moral distinction."
      },
      "probabilities": {
        "0": 0.22,
        "1": 0.18,
        "2": 0.29,
        "3": 0.23,
        "4": 0.08
      }
    },
    "harm_tradeoff_justification": {
      "type": "score",
      "score": 3.38,
      "confidence": 0.66,
      "legend": {
        "0": "No moral justification.",
        "1": "Weak moral justification.",
        "2": "Moderate moral justification.",
        "3": "Strong moral justification.",
        "4": "Overwhelming moral justification."
      },
      "probabilities": {
        "0": 0.0,
        "1": 0.0,
        "2": 0.01,
        "3": 0.59,
        "4": 0.4
      }
    },
    "intervention_permissibility": {
      "type": "score",
      "score": 3.59,
      "confidence": 0.65,
      "legend": {
        "0": "Clearly impermissible.",
        "1": "Probably impermissible.",
        "2": "Morally ambiguous.",
        "3": "Probably permissible.",
        "4": "Clearly permissible."
      },
      "probabilities": {
        "0": 0.0,
        "1": 0.0,
        "2": 0.06,
        "3": 0.29,
        "4": 0.65
      }
    },
    "inaction_permissibility": {
      "type": "score",
      "score": 1.02,
      "confidence": 0.54,
      "legend": {
        "0": "Clearly impermissible.",
        "1": "Probably impermissible.",
        "2": "Morally ambiguous.",
        "3": "Probably permissible.",
        "4": "Clearly permissible."
      },
      "probabilities": {
        "0": 0.27,
        "1": 0.5,
        "2": 0.18,
        "3": 0.04,
        "4": 0.01
      }
    },
    "duty_to_minimize_harm_strength": {
      "type": "score",
      "score": 3.42,
      "confidence": 0.6,
      "legend": {
        "0": "No obligation.",
        "1": "Weak obligation.",
        "2": "Moderate obligation.",
        "3": "Strong obligation.",
        "4": "Overriding obligation."
      },
      "probabilities": {
        "0": 0.0,
        "1": 0.0,
        "2": 0.02,
        "3": 0.53,
        "4": 0.45
      }
    },
    "duty_not_to_redirect_harm_strength": {
      "type": "score",
      "score": 2.06,
      "confidence": 0.16,
      "legend": {
        "0": "No obligation.",
        "1": "Weak obligation.",
        "2": "Moderate obligation.",
        "3": "Strong obligation.",
        "4": "Overriding obligation."
      },
      "probabilities": {
        "0": 0.04,
        "1": 0.26,
        "2": 0.32,
        "3": 0.34,
        "4": 0.04
      }
    }
  },
  "usage": {
    "input_tokens": 1565,
    "output_tokens": 357
  },
  "request_id": "playground_[redacted]",
  "evaluation_time_ms": 146.9146780000301
}

Sending it yourself #

The script composes the request body from the two JSON files with jq, posts it to the System One endpoint with a bearer token from the TypeSafe console, and pretty-prints the answers. It refuses to run without TYPESAFE_API_KEY set, so an empty bearer never leaves the machine.

request.sh Raw Download
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/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 .

Run it from the bundle directory and compare the output with the recorded response above. The probabilities should land close; TypeSafe describes Jev as consistent for similar inputs, and the state here is identical.


Leave a comment

Preview

Comments are reviewed before publishing.