Create a decision
curl --request POST \
--url https://api.torchcast.ai/v1/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"model": "torchcast-decider-latest",
"state": "The app crashes every time I open the settings page. Very frustrating.",
"questions": {
"defect": {
"type": "noul",
"instructions": "Is this a product defect?",
"criteria": {
"true": "The customer describes a bug in the product.",
"false": "Anything else, such as a question or a feature request."
}
},
"sentiment": {
"type": "choice",
"instructions": "What is the customer's sentiment?",
"criteria": {
"positive": "Happy with the product.",
"mixed": "Both happy and unhappy.",
"negative": "Unhappy with the product."
}
},
"severity": {
"type": "score",
"instructions": "How severe is the issue?",
"criteria": [
"Cosmetic",
"Inconvenient",
"Product unusable"
]
}
}
}
EOFimport requests
url = "https://api.torchcast.ai/v1/decisions"
payload = {
"model": "torchcast-decider-latest",
"state": "The app crashes every time I open the settings page. Very frustrating.",
"questions": {
"defect": {
"type": "noul",
"instructions": "Is this a product defect?",
"criteria": {
"true": "The customer describes a bug in the product.",
"false": "Anything else, such as a question or a feature request."
}
},
"sentiment": {
"type": "choice",
"instructions": "What is the customer's sentiment?",
"criteria": {
"positive": "Happy with the product.",
"mixed": "Both happy and unhappy.",
"negative": "Unhappy with the product."
}
},
"severity": {
"type": "score",
"instructions": "How severe is the issue?",
"criteria": ["Cosmetic", "Inconvenient", "Product unusable"]
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'torchcast-decider-latest',
state: 'The app crashes every time I open the settings page. Very frustrating.',
questions: {
defect: {
type: 'noul',
instructions: 'Is this a product defect?',
criteria: {
true: 'The customer describes a bug in the product.',
false: 'Anything else, such as a question or a feature request.'
}
},
sentiment: {
type: 'choice',
instructions: 'What is the customer\'s sentiment?',
criteria: {
positive: 'Happy with the product.',
mixed: 'Both happy and unhappy.',
negative: 'Unhappy with the product.'
}
},
severity: {
type: 'score',
instructions: 'How severe is the issue?',
criteria: ['Cosmetic', 'Inconvenient', 'Product unusable']
}
}
})
};
fetch('https://api.torchcast.ai/v1/decisions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"model": "torchcast-decider-4b-v1-1-api-1",
"answers": {
"defect": {
"type": "noul",
"noul": 0.94
},
"sentiment": {
"type": "choice",
"choice": "mixed",
"confidence": 0.93,
"probabilities": {
"positive": 0.02,
"mixed": 0.95,
"negative": 0.03
}
},
"severity": {
"type": "score",
"score": 1.78,
"confidence": 0.78,
"legend": {
"0": "Cosmetic",
"1": "Inconvenient",
"2": "Product unusable"
},
"probabilities": {
"0": 0.008,
"1": 0.199,
"2": 0.792
}
}
},
"usage": {
"input_tokens": 367,
"output_tokens": 3
}
}API Reference
Create a decision
Answers every question about state with probabilities. Each successful call is charged by its billable input tokens; a retried request is a new request and is charged again.
POST
/
v1
/
decisions
Create a decision
curl --request POST \
--url https://api.torchcast.ai/v1/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"model": "torchcast-decider-latest",
"state": "The app crashes every time I open the settings page. Very frustrating.",
"questions": {
"defect": {
"type": "noul",
"instructions": "Is this a product defect?",
"criteria": {
"true": "The customer describes a bug in the product.",
"false": "Anything else, such as a question or a feature request."
}
},
"sentiment": {
"type": "choice",
"instructions": "What is the customer's sentiment?",
"criteria": {
"positive": "Happy with the product.",
"mixed": "Both happy and unhappy.",
"negative": "Unhappy with the product."
}
},
"severity": {
"type": "score",
"instructions": "How severe is the issue?",
"criteria": [
"Cosmetic",
"Inconvenient",
"Product unusable"
]
}
}
}
EOFimport requests
url = "https://api.torchcast.ai/v1/decisions"
payload = {
"model": "torchcast-decider-latest",
"state": "The app crashes every time I open the settings page. Very frustrating.",
"questions": {
"defect": {
"type": "noul",
"instructions": "Is this a product defect?",
"criteria": {
"true": "The customer describes a bug in the product.",
"false": "Anything else, such as a question or a feature request."
}
},
"sentiment": {
"type": "choice",
"instructions": "What is the customer's sentiment?",
"criteria": {
"positive": "Happy with the product.",
"mixed": "Both happy and unhappy.",
"negative": "Unhappy with the product."
}
},
"severity": {
"type": "score",
"instructions": "How severe is the issue?",
"criteria": ["Cosmetic", "Inconvenient", "Product unusable"]
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'torchcast-decider-latest',
state: 'The app crashes every time I open the settings page. Very frustrating.',
questions: {
defect: {
type: 'noul',
instructions: 'Is this a product defect?',
criteria: {
true: 'The customer describes a bug in the product.',
false: 'Anything else, such as a question or a feature request.'
}
},
sentiment: {
type: 'choice',
instructions: 'What is the customer\'s sentiment?',
criteria: {
positive: 'Happy with the product.',
mixed: 'Both happy and unhappy.',
negative: 'Unhappy with the product.'
}
},
severity: {
type: 'score',
instructions: 'How severe is the issue?',
criteria: ['Cosmetic', 'Inconvenient', 'Product unusable']
}
}
})
};
fetch('https://api.torchcast.ai/v1/decisions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"model": "torchcast-decider-4b-v1-1-api-1",
"answers": {
"defect": {
"type": "noul",
"noul": 0.94
},
"sentiment": {
"type": "choice",
"choice": "mixed",
"confidence": 0.93,
"probabilities": {
"positive": 0.02,
"mixed": 0.95,
"negative": 0.03
}
},
"severity": {
"type": "score",
"score": 1.78,
"confidence": 0.78,
"legend": {
"0": "Cosmetic",
"1": "Inconvenient",
"2": "Product unusable"
},
"probabilities": {
"0": 0.008,
"1": 0.199,
"2": 0.792
}
}
},
"usage": {
"input_tokens": 367,
"output_tokens": 3
}
}Authorizations
A Decision API key from the console (starts with tcd_).
Body
application/json