Skip to content

Prisms, fields and questions

A prism is a named set of fields, optional context and questions. You build and test it in the Prismlet app, and the API runs it on one text per call. Saving a prism creates its next version.

The {prism} in /v1/prisms/{prism}/results is the prism's slug or its id.

  • The slug, shown as Name in API addresses in Prism settings and on the prism's Connect tab, is set from the name when the prism is created, such as support-routing for Support routing. Renaming the prism does not change it, so your URLs keep working.
  • The id is a UUID, shown with Copy on the Connect tab. A value shaped like a UUID is always read as an id, which is why no slug can look like one.
  • An archived prism answers 404 for new calls and retries. Its results stay readable.

A field is a named piece of text you send with each call. It is text by default. Mark it as an image ("kind": "image") to send a photo or screenshot instead. A prism has at most four image fields. The model judges the images and the text together. Only a model that reads images can answer a prism with image fields. The account's model is set in Settings.

A field has a key, such as subject, and a label, such as Subject, which the app shows.

  • A prism has one to eight fields.
  • A key is snake_case: a lowercase letter, then up to 63 lowercase letters, digits or underscores.
  • context is reserved, and so are the row names result_id, ref, version, status, error and created_at.
  • Once the prism is saved, a field's key is fixed, because your code sends it. To send a different key, add a new field and remove the old one.

Every call sends exactly the field keys of the prism version it runs against. A missing key and an extra key are both a 400. Sending a text has the details.

Context is optional background that every question sees, such as "We sell scheduling software to clinics." It is part of the prism, holds up to 8,000 characters, and counts toward the size of every call. A call can add background of its own with context, which the model reads after the prism's.

A question is one judgment about the fields. It has a key, a type, the question text the app shows, and optional instructions. The model reads text first, then instructions when present, so instructions add detail to the question and need not repeat it. A prism has one to 64 questions, and question keys share one namespace with field keys. Once saved, a question keeps its key and its type, so your code always reads the same shape of answer under a key. For another key or type, add a new question. Saving a version that gives a question key from any earlier version a different type is refused with a 400. A question can also have a short label of up to 40 characters, such as Routing team, which names it in the app's Results, Test and Home and in the browser extension once its version is live. The model never reads it, and calls and answers do not change.

There are three types.

Type In the app Asks for Options Stored answer
choice Choice One option from a list 2 to 253 value, probabilities per option, confidence
yes_no Yes / No The probability that it is yes None probability of yes, from 0 to 1
scale Scale One level of an ordered list 2 to 10, lowest first level, probabilities per level

Options and levels have a key, a label and an optional description. The description is what the model reads to tell options apart, so write one whenever two options could be confused. The app derives an option key from its label. Once the option is saved, the key stays when you edit the label.

A Choice answers with one option key. Its stored answer has a probability for every option and a confidence. The confidence is the top probability rescaled by the number of options n, the two outcomes below included: (p - 1/n) / (1 - 1/n). It is 0 when every option is equally likely and 1 when the model is certain. It is computed from the probabilities, so it tells you nothing they don't.

Two more outcomes are always possible, and every Choice has them without you adding them:

Key Label Means
other Other None of the options fit the text.
insufficient_information Not enough information The text does not say enough to choose.

You can't use these keys, or unsure, for your own options or levels: unsure is the Yes / No label for an answer between its cutoffs. Handle other and insufficient_information in your code. A router that only knows billing and technical needs a path for a ticket that is neither.

A Choice value is null when the model named an option the prism does not have. The app shows it as "No valid answer". It is not an error, and the result's status is still ok.

A Yes / No answer is only a probability. It has no stored label. Two cutoffs on the question turn the probability into yes, no or unsure.

  • No below (noBelow in the content): below it, the answer is No.
  • Yes from (yesFrom): at it or above, the answer is Yes.

Between the two, the answer is Unsure. Both are 50% when left blank, so there is no Unsure band. Yes from can't be lower than No below. Set them on the question's track in the Questions tab; library prisms start at 40% and 60%.

With No below 40% and Yes from 60%:

Probability of yes json csv
0.35 "no" No
0.4 "unsure" Unsure
0.59 "unsure" Unsure
0.6 "yes" Yes
0.83 "yes" Yes

An Unsure band is how you send the doubtful cases to a person instead of guessing.

The cutoffs are part of the version, so changing them saves a new version, and it reaches calls when you publish it. The model is not asked again: each result keeps the cutoffs of the version that answered it, so new cutoffs apply to results from then on. When your code needs its own cutoffs, request format=raw, which returns the probability. See Formats.

A Scale has ordered levels, written lowest first, such as Calm, Annoyed, Angry. Its stored answer is the most probable level and a probability for every level. On a tie the lower level wins.

Saving a prism creates the next version, numbered from 1. A saved version never changes.

  • Every save creates a new version, whether it changed the fields, the context, the questions, their options or cutoffs, the name or nothing at all.
  • Calls use the live version, the one last published, unless the body names another with version.
  • Every result records the version that answered it.

Pin version when your code depends on a version's field keys. An unknown version answers 404 with Prism version not found.

Saving a version does not change what your calls run. A new prism is live at version 1, and a later version reaches calls without version only when someone publishes it in the app, with Publish in the prism's header or in its History. The published version is the live one.

  • The answers and the field columns of CSV, TSV and JSON Lines rows follow the live version, so a saved version changes none of them until it is published.
  • Publishing an older version makes it live again. It changes the calls that come after it and leaves saved results alone, each with the version that answered it.
  • Try and file runs in the app use the latest saved version, so you can check a version before you publish it.
  • Extension checks run the live version too, so publishing moves them onto it. The publish dialog names the outcomes a check loses.
  • When a test set has a run of the version you publish and a run of the live version on the same texts, the publish dialog says what Test found for that pair, in verdict words such as "Better on Team. No worse on the other 7 questions.", and its details count the answers fixed and newly wrong. It offers to keep the live version first when any question got or leans worse. Without such a pair it says the version is not tested against your answers yet.
  • When the version changes what a caller sees, the publish dialog has an API line that says so in plain words, such as "Calls must now send Order id. Calls without it are refused." Under For developers it names the same changes by key: each field added or dropped, since a call must send exactly the version's fields or it gets a 400; each question added or removed; each option added or removed; and changed Yes / No cutoffs, such as "urgent cutoffs were Yes from 60% · No below 40%, now Yes from 70% · No below 35%". A change that breaks calls or readers of results shows in red.