OpenAI Decisions
curl --request POST \
--url https://api.omniall.ai/v1/decisions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "jev-1.14.0",
"input": "I was charged twice for my order.",
"questions": [
{
"type": "choice",
"name": "department",
"instructions": "Which department should handle this complaint?",
"choices": [
{
"value": "billing",
"description": "Payments, invoices, and refunds."
},
{
"value": "technical",
"description": "Problems using the product."
},
{
"value": "other",
"description": "Requests outside these categories."
}
]
},
{
"type": "predicate",
"name": "refund_requested",
"instructions": "Is the customer asking for money back?"
},
{
"type": "score",
"name": "severity",
"instructions": "How severe is this issue?",
"levels": [
{
"label": "Cosmetic",
"description": "Appearance only; no lost functionality."
},
{
"label": "Workaround available",
"description": "A task fails, but another way works."
},
{
"label": "Fully blocked",
"description": "A task fails with no workaround."
}
]
}
]
}
'import requests
url = "https://api.omniall.ai/v1/decisions"
payload = {
"model": "jev-1.14.0",
"input": "I was charged twice for my order.",
"questions": [
{
"type": "choice",
"name": "department",
"instructions": "Which department should handle this complaint?",
"choices": [
{
"value": "billing",
"description": "Payments, invoices, and refunds."
},
{
"value": "technical",
"description": "Problems using the product."
},
{
"value": "other",
"description": "Requests outside these categories."
}
]
},
{
"type": "predicate",
"name": "refund_requested",
"instructions": "Is the customer asking for money back?"
},
{
"type": "score",
"name": "severity",
"instructions": "How severe is this issue?",
"levels": [
{
"label": "Cosmetic",
"description": "Appearance only; no lost functionality."
},
{
"label": "Workaround available",
"description": "A task fails, but another way works."
},
{
"label": "Fully blocked",
"description": "A task fails with no workaround."
}
]
}
]
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'jev-1.14.0',
input: 'I was charged twice for my order.',
questions: [
{
type: 'choice',
name: 'department',
instructions: 'Which department should handle this complaint?',
choices: [
{value: 'billing', description: 'Payments, invoices, and refunds.'},
{value: 'technical', description: 'Problems using the product.'},
{value: 'other', description: 'Requests outside these categories.'}
]
},
{
type: 'predicate',
name: 'refund_requested',
instructions: 'Is the customer asking for money back?'
},
{
type: 'score',
name: 'severity',
instructions: 'How severe is this issue?',
levels: [
{label: 'Cosmetic', description: 'Appearance only; no lost functionality.'},
{
label: 'Workaround available',
description: 'A task fails, but another way works.'
},
{label: 'Fully blocked', description: 'A task fails with no workaround.'}
]
}
]
})
};
fetch('https://api.omniall.ai/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.omniall.ai/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 => json_encode([
'model' => 'jev-1.14.0',
'input' => 'I was charged twice for my order.',
'questions' => [
[
'type' => 'choice',
'name' => 'department',
'instructions' => 'Which department should handle this complaint?',
'choices' => [
[
'value' => 'billing',
'description' => 'Payments, invoices, and refunds.'
],
[
'value' => 'technical',
'description' => 'Problems using the product.'
],
[
'value' => 'other',
'description' => 'Requests outside these categories.'
]
]
],
[
'type' => 'predicate',
'name' => 'refund_requested',
'instructions' => 'Is the customer asking for money back?'
],
[
'type' => 'score',
'name' => 'severity',
'instructions' => 'How severe is this issue?',
'levels' => [
[
'label' => 'Cosmetic',
'description' => 'Appearance only; no lost functionality.'
],
[
'label' => 'Workaround available',
'description' => 'A task fails, but another way works.'
],
[
'label' => 'Fully blocked',
'description' => 'A task fails with no workaround.'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$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.omniall.ai/v1/decisions"
payload := strings.NewReader("{\n \"model\": \"jev-1.14.0\",\n \"input\": \"I was charged twice for my order.\",\n \"questions\": [\n {\n \"type\": \"choice\",\n \"name\": \"department\",\n \"instructions\": \"Which department should handle this complaint?\",\n \"choices\": [\n {\n \"value\": \"billing\",\n \"description\": \"Payments, invoices, and refunds.\"\n },\n {\n \"value\": \"technical\",\n \"description\": \"Problems using the product.\"\n },\n {\n \"value\": \"other\",\n \"description\": \"Requests outside these categories.\"\n }\n ]\n },\n {\n \"type\": \"predicate\",\n \"name\": \"refund_requested\",\n \"instructions\": \"Is the customer asking for money back?\"\n },\n {\n \"type\": \"score\",\n \"name\": \"severity\",\n \"instructions\": \"How severe is this issue?\",\n \"levels\": [\n {\n \"label\": \"Cosmetic\",\n \"description\": \"Appearance only; no lost functionality.\"\n },\n {\n \"label\": \"Workaround available\",\n \"description\": \"A task fails, but another way works.\"\n },\n {\n \"label\": \"Fully blocked\",\n \"description\": \"A task fails with no workaround.\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
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.omniall.ai/v1/decisions")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"jev-1.14.0\",\n \"input\": \"I was charged twice for my order.\",\n \"questions\": [\n {\n \"type\": \"choice\",\n \"name\": \"department\",\n \"instructions\": \"Which department should handle this complaint?\",\n \"choices\": [\n {\n \"value\": \"billing\",\n \"description\": \"Payments, invoices, and refunds.\"\n },\n {\n \"value\": \"technical\",\n \"description\": \"Problems using the product.\"\n },\n {\n \"value\": \"other\",\n \"description\": \"Requests outside these categories.\"\n }\n ]\n },\n {\n \"type\": \"predicate\",\n \"name\": \"refund_requested\",\n \"instructions\": \"Is the customer asking for money back?\"\n },\n {\n \"type\": \"score\",\n \"name\": \"severity\",\n \"instructions\": \"How severe is this issue?\",\n \"levels\": [\n {\n \"label\": \"Cosmetic\",\n \"description\": \"Appearance only; no lost functionality.\"\n },\n {\n \"label\": \"Workaround available\",\n \"description\": \"A task fails, but another way works.\"\n },\n {\n \"label\": \"Fully blocked\",\n \"description\": \"A task fails with no workaround.\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.omniall.ai/v1/decisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"jev-1.14.0\",\n \"input\": \"I was charged twice for my order.\",\n \"questions\": [\n {\n \"type\": \"choice\",\n \"name\": \"department\",\n \"instructions\": \"Which department should handle this complaint?\",\n \"choices\": [\n {\n \"value\": \"billing\",\n \"description\": \"Payments, invoices, and refunds.\"\n },\n {\n \"value\": \"technical\",\n \"description\": \"Problems using the product.\"\n },\n {\n \"value\": \"other\",\n \"description\": \"Requests outside these categories.\"\n }\n ]\n },\n {\n \"type\": \"predicate\",\n \"name\": \"refund_requested\",\n \"instructions\": \"Is the customer asking for money back?\"\n },\n {\n \"type\": \"score\",\n \"name\": \"severity\",\n \"instructions\": \"How severe is this issue?\",\n \"levels\": [\n {\n \"label\": \"Cosmetic\",\n \"description\": \"Appearance only; no lost functionality.\"\n },\n {\n \"label\": \"Workaround available\",\n \"description\": \"A task fails, but another way works.\"\n },\n {\n \"label\": \"Fully blocked\",\n \"description\": \"A task fails with no workaround.\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"model": "jev-1.14.0",
"answers": [
{
"type": "choice",
"name": "department",
"choice": "billing",
"probabilities": [
{
"value": "billing",
"probability": 0.95
},
{
"value": "technical",
"probability": 0.03
},
{
"value": "other",
"probability": 0.02
}
],
"confidence": 0.93
},
{
"type": "predicate",
"name": "refund_requested",
"probability": 0.91
},
{
"type": "score",
"name": "severity",
"score": 1.1,
"probabilities": [
{
"value": 0,
"label": "Cosmetic",
"probability": 0.1
},
{
"value": 1,
"label": "Workaround available",
"probability": 0.7
},
{
"value": 2,
"label": "Fully blocked",
"probability": 0.2
}
],
"confidence": 0.55
}
],
"usage": {
"input_tokens": 142,
"output_tokens": 0,
"total_tokens": 142
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}TypeSafe / Jev
OpenAI Decisions
OpenAI Decisions 兼容接口。题型与 TypeSafe 对应关系:
predicate↔noulchoice↔choicescore↔score
可用 OpenAI SDK client.decisions.create,base_url=https://api.omniall.ai/v1
(需 openai Python ≥ 3.26.0 或 JS ≥ 7.30.0)。
POST
/
v1
/
decisions
OpenAI Decisions
curl --request POST \
--url https://api.omniall.ai/v1/decisions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "jev-1.14.0",
"input": "I was charged twice for my order.",
"questions": [
{
"type": "choice",
"name": "department",
"instructions": "Which department should handle this complaint?",
"choices": [
{
"value": "billing",
"description": "Payments, invoices, and refunds."
},
{
"value": "technical",
"description": "Problems using the product."
},
{
"value": "other",
"description": "Requests outside these categories."
}
]
},
{
"type": "predicate",
"name": "refund_requested",
"instructions": "Is the customer asking for money back?"
},
{
"type": "score",
"name": "severity",
"instructions": "How severe is this issue?",
"levels": [
{
"label": "Cosmetic",
"description": "Appearance only; no lost functionality."
},
{
"label": "Workaround available",
"description": "A task fails, but another way works."
},
{
"label": "Fully blocked",
"description": "A task fails with no workaround."
}
]
}
]
}
'import requests
url = "https://api.omniall.ai/v1/decisions"
payload = {
"model": "jev-1.14.0",
"input": "I was charged twice for my order.",
"questions": [
{
"type": "choice",
"name": "department",
"instructions": "Which department should handle this complaint?",
"choices": [
{
"value": "billing",
"description": "Payments, invoices, and refunds."
},
{
"value": "technical",
"description": "Problems using the product."
},
{
"value": "other",
"description": "Requests outside these categories."
}
]
},
{
"type": "predicate",
"name": "refund_requested",
"instructions": "Is the customer asking for money back?"
},
{
"type": "score",
"name": "severity",
"instructions": "How severe is this issue?",
"levels": [
{
"label": "Cosmetic",
"description": "Appearance only; no lost functionality."
},
{
"label": "Workaround available",
"description": "A task fails, but another way works."
},
{
"label": "Fully blocked",
"description": "A task fails with no workaround."
}
]
}
]
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'jev-1.14.0',
input: 'I was charged twice for my order.',
questions: [
{
type: 'choice',
name: 'department',
instructions: 'Which department should handle this complaint?',
choices: [
{value: 'billing', description: 'Payments, invoices, and refunds.'},
{value: 'technical', description: 'Problems using the product.'},
{value: 'other', description: 'Requests outside these categories.'}
]
},
{
type: 'predicate',
name: 'refund_requested',
instructions: 'Is the customer asking for money back?'
},
{
type: 'score',
name: 'severity',
instructions: 'How severe is this issue?',
levels: [
{label: 'Cosmetic', description: 'Appearance only; no lost functionality.'},
{
label: 'Workaround available',
description: 'A task fails, but another way works.'
},
{label: 'Fully blocked', description: 'A task fails with no workaround.'}
]
}
]
})
};
fetch('https://api.omniall.ai/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.omniall.ai/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 => json_encode([
'model' => 'jev-1.14.0',
'input' => 'I was charged twice for my order.',
'questions' => [
[
'type' => 'choice',
'name' => 'department',
'instructions' => 'Which department should handle this complaint?',
'choices' => [
[
'value' => 'billing',
'description' => 'Payments, invoices, and refunds.'
],
[
'value' => 'technical',
'description' => 'Problems using the product.'
],
[
'value' => 'other',
'description' => 'Requests outside these categories.'
]
]
],
[
'type' => 'predicate',
'name' => 'refund_requested',
'instructions' => 'Is the customer asking for money back?'
],
[
'type' => 'score',
'name' => 'severity',
'instructions' => 'How severe is this issue?',
'levels' => [
[
'label' => 'Cosmetic',
'description' => 'Appearance only; no lost functionality.'
],
[
'label' => 'Workaround available',
'description' => 'A task fails, but another way works.'
],
[
'label' => 'Fully blocked',
'description' => 'A task fails with no workaround.'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$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.omniall.ai/v1/decisions"
payload := strings.NewReader("{\n \"model\": \"jev-1.14.0\",\n \"input\": \"I was charged twice for my order.\",\n \"questions\": [\n {\n \"type\": \"choice\",\n \"name\": \"department\",\n \"instructions\": \"Which department should handle this complaint?\",\n \"choices\": [\n {\n \"value\": \"billing\",\n \"description\": \"Payments, invoices, and refunds.\"\n },\n {\n \"value\": \"technical\",\n \"description\": \"Problems using the product.\"\n },\n {\n \"value\": \"other\",\n \"description\": \"Requests outside these categories.\"\n }\n ]\n },\n {\n \"type\": \"predicate\",\n \"name\": \"refund_requested\",\n \"instructions\": \"Is the customer asking for money back?\"\n },\n {\n \"type\": \"score\",\n \"name\": \"severity\",\n \"instructions\": \"How severe is this issue?\",\n \"levels\": [\n {\n \"label\": \"Cosmetic\",\n \"description\": \"Appearance only; no lost functionality.\"\n },\n {\n \"label\": \"Workaround available\",\n \"description\": \"A task fails, but another way works.\"\n },\n {\n \"label\": \"Fully blocked\",\n \"description\": \"A task fails with no workaround.\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
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.omniall.ai/v1/decisions")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"jev-1.14.0\",\n \"input\": \"I was charged twice for my order.\",\n \"questions\": [\n {\n \"type\": \"choice\",\n \"name\": \"department\",\n \"instructions\": \"Which department should handle this complaint?\",\n \"choices\": [\n {\n \"value\": \"billing\",\n \"description\": \"Payments, invoices, and refunds.\"\n },\n {\n \"value\": \"technical\",\n \"description\": \"Problems using the product.\"\n },\n {\n \"value\": \"other\",\n \"description\": \"Requests outside these categories.\"\n }\n ]\n },\n {\n \"type\": \"predicate\",\n \"name\": \"refund_requested\",\n \"instructions\": \"Is the customer asking for money back?\"\n },\n {\n \"type\": \"score\",\n \"name\": \"severity\",\n \"instructions\": \"How severe is this issue?\",\n \"levels\": [\n {\n \"label\": \"Cosmetic\",\n \"description\": \"Appearance only; no lost functionality.\"\n },\n {\n \"label\": \"Workaround available\",\n \"description\": \"A task fails, but another way works.\"\n },\n {\n \"label\": \"Fully blocked\",\n \"description\": \"A task fails with no workaround.\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.omniall.ai/v1/decisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"jev-1.14.0\",\n \"input\": \"I was charged twice for my order.\",\n \"questions\": [\n {\n \"type\": \"choice\",\n \"name\": \"department\",\n \"instructions\": \"Which department should handle this complaint?\",\n \"choices\": [\n {\n \"value\": \"billing\",\n \"description\": \"Payments, invoices, and refunds.\"\n },\n {\n \"value\": \"technical\",\n \"description\": \"Problems using the product.\"\n },\n {\n \"value\": \"other\",\n \"description\": \"Requests outside these categories.\"\n }\n ]\n },\n {\n \"type\": \"predicate\",\n \"name\": \"refund_requested\",\n \"instructions\": \"Is the customer asking for money back?\"\n },\n {\n \"type\": \"score\",\n \"name\": \"severity\",\n \"instructions\": \"How severe is this issue?\",\n \"levels\": [\n {\n \"label\": \"Cosmetic\",\n \"description\": \"Appearance only; no lost functionality.\"\n },\n {\n \"label\": \"Workaround available\",\n \"description\": \"A task fails, but another way works.\"\n },\n {\n \"label\": \"Fully blocked\",\n \"description\": \"A task fails with no workaround.\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"model": "jev-1.14.0",
"answers": [
{
"type": "choice",
"name": "department",
"choice": "billing",
"probabilities": [
{
"value": "billing",
"probability": 0.95
},
{
"value": "technical",
"probability": 0.03
},
{
"value": "other",
"probability": 0.02
}
],
"confidence": 0.93
},
{
"type": "predicate",
"name": "refund_requested",
"probability": 0.91
},
{
"type": "score",
"name": "severity",
"score": 1.1,
"probabilities": [
{
"value": 0,
"label": "Cosmetic",
"probability": 0.1
},
{
"value": 1,
"label": "Workaround available",
"probability": 0.7
},
{
"value": 2,
"label": "Fully blocked",
"probability": 0.2
}
],
"confidence": 0.55
}
],
"usage": {
"input_tokens": 142,
"output_tokens": 0,
"total_tokens": 142
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}题型说明
type | 额外字段 | 答案字段 |
|---|---|---|
predicate | — | probability |
choice | choices(2–255) | choice、probabilities[]、confidence |
score | levels(2–10) | score、probabilities[]、confidence |
model、input、questions(带其它字段会被拒绝)。任一题可能单独返回 type: refusal,其它题仍正常作答。
接入指南:TypeSafe Jev API。请求头
请求体
application/json