Decisions
The page asks an AI model to judge text or pictures and gets a typed answer back: a choice or a score.
When to use it: The page needs a judgement it can't compute: pick the best match, score an answer, check a photo.
Status: Preview. Turned on: Invite-only preview: Cloudtifact turns it on for a space, then the space's admins can switch it off and on in Settings.
How
await cloudtifact.decide({ state, questions, assets? }) resolves to { answers, model, usage }. Each question is { type: "choice" | "score" | "noul", instructions, criteria? }; images go in assets as { format: "png" | "jpg", data_base64 } and are referenced by name.
<script>
async function judge(jpegBase64) {
const { answers } = await cloudtifact.decide({
state: { photo: "photo-1" },
assets: { "photo-1": { format: "jpg", data_base64: jpegBase64 } },
questions: {
sign: { type: "choice", instructions: "Which hand sign is in `photo`?",
criteria: { tiger: "Tiger", ram: "Ram" } },
},
});
return answers.sign.choice; // "tiger"
}
</script>Limits
- Turned on per space while it's a preview.
- 120 calls a minute per visitor and 1,200 per space.
- 4 MB a request, 32 questions and 16 images; images at least 280 px a side.
Errors
A failed call rejects with an Error whose code is one of:
| Code | When |
|---|---|
capability_off | Not turned on for this space. The message says who can turn it on. |
rate_limited | Too many calls this minute, from this browser or the whole space. |
bad_request | The request's shape is wrong, or the model refused it; the message says why. |
too_large | Over 4 MB. |
upstream_error | The model service failed; try again. |
invalid | decide() wasn't given an object. |
network | The request didn't reach Cloudtifact (offline, blocked). |
timeout | No answer in time; try again. |
Cost
Each call is an AI request we pay for, so it's invite-only while it's a preview. Plans will include an allowance later.