Create a decision
curl --request POST \
--url https://api.tazolabs.com/v1/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'request={
"state": {
"context": "Choose the tool matching the spoken request."
},
"questions": {
"action": {
"type": "choice",
"instructions": "Which action should be taken?",
"criteria": {
"NO_TOOL": "Respond directly without calling a tool.",
"get_weather": "Get weather for a city."
}
}
},
"model": "tazo-large"
};type=application/json' \
--form audio=@example-fileimport requests
url = "https://api.tazolabs.com/v1/decisions"
files = { "audio": ("example-file", open("example-file", "rb")) }
files["request"] = (None, "{\n \"state\": {\n \"context\": \"Choose the tool matching the spoken request.\"\n },\n \"questions\": {\n \"action\": {\n \"type\": \"choice\",\n \"instructions\": \"Which action should be taken?\",\n \"criteria\": {\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\n \"get_weather\": \"Get weather for a city.\"\n }\n }\n },\n \"model\": \"tazo-large\"\n}", "application/json")
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('request', '{
"state": {
"context": "Choose the tool matching the spoken request."
},
"questions": {
"action": {
"type": "choice",
"instructions": "Which action should be taken?",
"criteria": {
"NO_TOOL": "Respond directly without calling a tool.",
"get_weather": "Get weather for a city."
}
}
},
"model": "tazo-large"
}');
form.append('audio', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.tazolabs.com/v1/decisions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tazolabs.com/v1/decisions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"request\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"state\": {\r\n \"context\": \"Choose the tool matching the spoken request.\"\r\n },\r\n \"questions\": {\r\n \"action\": {\r\n \"type\": \"choice\",\r\n \"instructions\": \"Which action should be taken?\",\r\n \"criteria\": {\r\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\r\n \"get_weather\": \"Get weather for a city.\"\r\n }\r\n }\r\n },\r\n \"model\": \"tazo-large\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tazolabs.com/v1/decisions"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"request\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"state\": {\r\n \"context\": \"Choose the tool matching the spoken request.\"\r\n },\r\n \"questions\": {\r\n \"action\": {\r\n \"type\": \"choice\",\r\n \"instructions\": \"Which action should be taken?\",\r\n \"criteria\": {\r\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\r\n \"get_weather\": \"Get weather for a city.\"\r\n }\r\n }\r\n },\r\n \"model\": \"tazo-large\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tazolabs.com/v1/decisions")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"request\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"state\": {\r\n \"context\": \"Choose the tool matching the spoken request.\"\r\n },\r\n \"questions\": {\r\n \"action\": {\r\n \"type\": \"choice\",\r\n \"instructions\": \"Which action should be taken?\",\r\n \"criteria\": {\r\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\r\n \"get_weather\": \"Get weather for a city.\"\r\n }\r\n }\r\n },\r\n \"model\": \"tazo-large\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tazolabs.com/v1/decisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"request\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"state\": {\r\n \"context\": \"Choose the tool matching the spoken request.\"\r\n },\r\n \"questions\": {\r\n \"action\": {\r\n \"type\": \"choice\",\r\n \"instructions\": \"Which action should be taken?\",\r\n \"criteria\": {\r\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\r\n \"get_weather\": \"Get weather for a city.\"\r\n }\r\n }\r\n },\r\n \"model\": \"tazo-large\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "dec_example",
"model": "tazo-large",
"answers": {
"action": {
"type": "choice",
"choice": "get_weather",
"probabilities": {
"NO_TOOL": 0.08,
"get_weather": 0.92
},
"confidence": 0.92
}
},
"usage": {
"audio_seconds": 2.4
},
"elapsed_ms": 52
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}Decisions
Create a decision
Sends audio and a set of questions, and waits for the typed answers. The request is persisted before processing. If the caller disconnects or the wait times out, processing continues. Send an Idempotency-Key to make retries safe.
POST
/
v1
/
decisions
Create a decision
curl --request POST \
--url https://api.tazolabs.com/v1/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'request={
"state": {
"context": "Choose the tool matching the spoken request."
},
"questions": {
"action": {
"type": "choice",
"instructions": "Which action should be taken?",
"criteria": {
"NO_TOOL": "Respond directly without calling a tool.",
"get_weather": "Get weather for a city."
}
}
},
"model": "tazo-large"
};type=application/json' \
--form audio=@example-fileimport requests
url = "https://api.tazolabs.com/v1/decisions"
files = { "audio": ("example-file", open("example-file", "rb")) }
files["request"] = (None, "{\n \"state\": {\n \"context\": \"Choose the tool matching the spoken request.\"\n },\n \"questions\": {\n \"action\": {\n \"type\": \"choice\",\n \"instructions\": \"Which action should be taken?\",\n \"criteria\": {\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\n \"get_weather\": \"Get weather for a city.\"\n }\n }\n },\n \"model\": \"tazo-large\"\n}", "application/json")
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('request', '{
"state": {
"context": "Choose the tool matching the spoken request."
},
"questions": {
"action": {
"type": "choice",
"instructions": "Which action should be taken?",
"criteria": {
"NO_TOOL": "Respond directly without calling a tool.",
"get_weather": "Get weather for a city."
}
}
},
"model": "tazo-large"
}');
form.append('audio', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.tazolabs.com/v1/decisions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tazolabs.com/v1/decisions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"request\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"state\": {\r\n \"context\": \"Choose the tool matching the spoken request.\"\r\n },\r\n \"questions\": {\r\n \"action\": {\r\n \"type\": \"choice\",\r\n \"instructions\": \"Which action should be taken?\",\r\n \"criteria\": {\r\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\r\n \"get_weather\": \"Get weather for a city.\"\r\n }\r\n }\r\n },\r\n \"model\": \"tazo-large\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tazolabs.com/v1/decisions"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"request\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"state\": {\r\n \"context\": \"Choose the tool matching the spoken request.\"\r\n },\r\n \"questions\": {\r\n \"action\": {\r\n \"type\": \"choice\",\r\n \"instructions\": \"Which action should be taken?\",\r\n \"criteria\": {\r\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\r\n \"get_weather\": \"Get weather for a city.\"\r\n }\r\n }\r\n },\r\n \"model\": \"tazo-large\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tazolabs.com/v1/decisions")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"request\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"state\": {\r\n \"context\": \"Choose the tool matching the spoken request.\"\r\n },\r\n \"questions\": {\r\n \"action\": {\r\n \"type\": \"choice\",\r\n \"instructions\": \"Which action should be taken?\",\r\n \"criteria\": {\r\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\r\n \"get_weather\": \"Get weather for a city.\"\r\n }\r\n }\r\n },\r\n \"model\": \"tazo-large\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tazolabs.com/v1/decisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"request\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"state\": {\r\n \"context\": \"Choose the tool matching the spoken request.\"\r\n },\r\n \"questions\": {\r\n \"action\": {\r\n \"type\": \"choice\",\r\n \"instructions\": \"Which action should be taken?\",\r\n \"criteria\": {\r\n \"NO_TOOL\": \"Respond directly without calling a tool.\",\r\n \"get_weather\": \"Get weather for a city.\"\r\n }\r\n }\r\n },\r\n \"model\": \"tazo-large\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "dec_example",
"model": "tazo-large",
"answers": {
"action": {
"type": "choice",
"choice": "get_weather",
"probabilities": {
"NO_TOOL": 0.08,
"get_weather": 0.92
},
"confidence": 0.92
}
},
"usage": {
"audio_seconds": 2.4
},
"elapsed_ms": 52
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}{
"error": {
"code": "model_not_found",
"message": "Unknown model. Choose 'tazo-large' or 'tazo-small'.",
"retryable": true
},
"request_id": "<string>"
}Authorizations
bearerAuthaccessToken
An API key (tazo_sk_...). Also accepts a sign-in access token.
Headers
Optional key, 1 to 256 characters, that deduplicates retries of the same request for the same account. Reusing a key with different input returns 409.
Required string length:
1 - 256Body
multipart/form-data
Response
The decision completed.
Pattern:
^dec_[A-Za-z0-9_-]+$Example:
"dec_example"
The public model name.
Example:
"tazo-large"
Answers keyed by the question IDs you supplied.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Required range:
x >= 0Example:
52