Explore question types by calling the Sense Model API in a request
Go from zero to typed decisions about audio input
This page walks through some basic request/response calls to Sense, uRun's System One model, as a lightweight way for you to learn more about question types.
Use the SDK for realtime work
This page introduces Sense using the the request connection type for async work as a lightweight way to learn more about question types. Production use cases typically connect through a Session to use Sense for realtime work.
In this walkthrough, you will do the following:
- Get a uRun API key.
- Ask a question about text.
- Ask a question about audio.
- Batch all thre question types into one request.
Sense is a decision model: you send a state plus typed questions, and it returns typed answers with probabilities and confidence. If you are new to the model, read the Sense overview first.
This page demonstrates the systemone API that is compatible with TypeSafe Jev request bodies. See the Sense reference for requests for details.
Prerequisites
curl- A uRun account so you can make an API key.
Get an API key
Create an API key:
- In the console, go to Settings → API Keys and click + Create API key.
- Enter a Label for the key that will help you identify where it is used later.
- Select Create key.
- Copy the generated secret and store it somewhere safe. It is not retrievable later.
Ask a question about text
-
Send text as
stateand one question to the Sense Model API.terminal curl https://inference.urun.sh/v1/systemone \ -H "Authorization: Bearer urun_sk_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "state": "The export button crashes the settings page in Safari. It works in Chrome.", "questions": { "severity": { "type": "score", "instructions": "How severe is this bug report?", "criteria": [ "Cosmetic - no impact on functionality", "Broken - a workaround exists", "Blocking - no workaround for affected users" ] } } }' -
Read the answer.
JSON { "answers": { "severity": { "type": "score", "score": 1.15, "legend": { "0": "Cosmetic - no impact on functionality", "1": "Broken - a workaround exists", "2": "Blocking - no workaround for affected users" }, "probabilities": { "0": 0.0, "1": 0.85, "2": 0.15 }, "confidence": 0.775 } } }The returned
scoreis a probability-weighted level. In this example,1.15lands just pastBroken— most of the probability sits there, with a little onBlocking. Values come from your criteria, so your code can act on them directly: round to the nearest level, or branch at your own threshold.
Ask a question about audio
Send audio as base64 media, and Sense answers from the sound itself. No transcript is produced or consulted.
-
Record a few seconds yourself speaking and save it as a WAV, MP3, FLAC, or OGG file. The example below assumes a WAV file named
clip.wav. -
Encode the file and define your question.
terminal AUDIO_B64=$(base64 < clip.wav | tr -d '\n') cat > request.json <<EOF { "state": "Audio of a person speaking.", "media": [ { "type": "audio", "data": "$AUDIO_B64", "mime": "audio/wav" } ], "questions": { "tone": { "type": "score", "instructions": "How does the person speaking sound right now?", "criteria": [ "steady, even pacing", "pausing a lot", "repeating themselves", "using strong language" ] } } } EOF -
Send the audio and question to the Sense Model API.
terminal curl https://inference.urun.sh/v1/systemone \ -H "Authorization: Bearer urun_sk_YOUR_KEY" \ -H "Content-Type: application/json" \ --data-binary @request.json -
Read the answer.
JSON { "answers": { "tone": { "type": "score", "score": 2.9, "legend": { "0": "steady, even pacing", "1": "pausing a lot", "2": "repeating themselves", "3": "using strong language" }, "probabilities": { "0": 0.0, "1": 0.0, "2": 0.1, "3": 0.9 }, "confidence": 0.9 } } }
Ask several questions at once
Batch every question that shares a state into one request. They'll be assessed in parallel to optimize the response time.
-
Define multiple questions for a single state. This example batches a
choice, anoul, and ascorequestion about a textstate.terminal curl https://inference.urun.sh/v1/systemone \ -H "Authorization: Bearer urun_sk_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "state": "I was charged twice for order A-104. Please refund the duplicate.", "questions": { "route": { "type": "choice", "instructions": "Which team should handle this message?", "criteria": { "billing": "Payment or refund issues", "technical": "Bugs or integration problems" } }, "wants_refund": { "type": "noul", "instructions": "Is the person asking for a refund?", "criteria": { "true": "the person is asking for their money back", "false": "the person is not asking for a refund" } }, "urgency": { "type": "score", "instructions": "How urgent is this message?", "criteria": [ "Low — routine, no deadline", "Medium — needs attention today", "High — blocking, act now" ] } } }' -
Read the answers.
JSON { "answers": { "route": { "type": "choice", "choice": "billing", "probabilities": { "billing": 0.9, "technical": 0.1 }, "confidence": 0.8 }, "wants_refund": { "type": "noul", "noul": 0.97 }, "urgency": { "type": "score", "score": 0.85, "legend": { "0": "Low — routine, no deadline", "1": "Medium — needs attention today", "2": "High — blocking, act now" }, "probabilities": { "0": 0.35, "1": 0.45, "2": 0.2 }, "confidence": 0.175 } } }Answers come back keyed by the names you chose, so your code can read
answers["route"].choice,answers["wants_refund"].noul, andanswers["urgency"].scorewithout parsing anything.In this example, the
urgencyanswer is uncertain: theprobabilitiesare spread across the levels and theconfidenceis low. This is a signal, not a failure. Your code can act on this signal to gather more information instead of acting on a guess.
Next steps
Was this page helpful?