curl --request POST \
--url https://api.vainona.ai/v1/namespaces/{ns}/outcomes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"outcomes": [
{
"document_id": "<string>",
"judgment": "<string>",
"value": true,
"observed_at": "2023-11-07T05:31:56Z"
}
]
}
'import requests
url = "https://api.vainona.ai/v1/namespaces/{ns}/outcomes"
payload = { "outcomes": [
{
"document_id": "<string>",
"judgment": "<string>",
"value": True,
"observed_at": "2023-11-07T05:31:56Z"
}
] }
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({
outcomes: [
{
document_id: '<string>',
judgment: '<string>',
value: true,
observed_at: '2023-11-07T05:31:56Z'
}
]
})
};
fetch('https://api.vainona.ai/v1/namespaces/{ns}/outcomes', 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.vainona.ai/v1/namespaces/{ns}/outcomes",
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([
'outcomes' => [
[
'document_id' => '<string>',
'judgment' => '<string>',
'value' => true,
'observed_at' => '2023-11-07T05:31:56Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.vainona.ai/v1/namespaces/{ns}/outcomes"
payload := strings.NewReader("{\n \"outcomes\": [\n {\n \"document_id\": \"<string>\",\n \"judgment\": \"<string>\",\n \"value\": true,\n \"observed_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.vainona.ai/v1/namespaces/{ns}/outcomes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"outcomes\": [\n {\n \"document_id\": \"<string>\",\n \"judgment\": \"<string>\",\n \"value\": true,\n \"observed_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vainona.ai/v1/namespaces/{ns}/outcomes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"outcomes\": [\n {\n \"document_id\": \"<string>\",\n \"judgment\": \"<string>\",\n \"value\": true,\n \"observed_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Append observed outcomes or labelled examples
Outcomes are append-only. Each is joined to its document’s evaluation
for the revision and incarnation that were current at observed_at
minus the judgment’s horizon (§6.10), so an evaluation that finishes
after the outcome arrives still joins. An outcome that joins no
successful evaluation is kept but counted nowhere. Outcomes feed the
calibration report, the calibrated answer fields and threshold
recommendations; see calibration. An outcome
whose value does not match the judgment’s type is invalid_request;
one for a judgment the namespace does not have is not_found.
- Labelled examples are outcomes with the default horizon of
0s: write the documents, post their labels, and each label is joined to the document’s current answer. This measures accuracy before going live. - Real-world results use a horizon, such as “churned within 30
days” with
horizon: "30d".
Outcomes belong to a namespace, not a template prefix: post them on each namespace’s own path.
curl --request POST \
--url https://api.vainona.ai/v1/namespaces/{ns}/outcomes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"outcomes": [
{
"document_id": "<string>",
"judgment": "<string>",
"value": true,
"observed_at": "2023-11-07T05:31:56Z"
}
]
}
'import requests
url = "https://api.vainona.ai/v1/namespaces/{ns}/outcomes"
payload = { "outcomes": [
{
"document_id": "<string>",
"judgment": "<string>",
"value": True,
"observed_at": "2023-11-07T05:31:56Z"
}
] }
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({
outcomes: [
{
document_id: '<string>',
judgment: '<string>',
value: true,
observed_at: '2023-11-07T05:31:56Z'
}
]
})
};
fetch('https://api.vainona.ai/v1/namespaces/{ns}/outcomes', 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.vainona.ai/v1/namespaces/{ns}/outcomes",
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([
'outcomes' => [
[
'document_id' => '<string>',
'judgment' => '<string>',
'value' => true,
'observed_at' => '2023-11-07T05:31:56Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.vainona.ai/v1/namespaces/{ns}/outcomes"
payload := strings.NewReader("{\n \"outcomes\": [\n {\n \"document_id\": \"<string>\",\n \"judgment\": \"<string>\",\n \"value\": true,\n \"observed_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.vainona.ai/v1/namespaces/{ns}/outcomes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"outcomes\": [\n {\n \"document_id\": \"<string>\",\n \"judgment\": \"<string>\",\n \"value\": true,\n \"observed_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vainona.ai/v1/namespaces/{ns}/outcomes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"outcomes\": [\n {\n \"document_id\": \"<string>\",\n \"judgment\": \"<string>\",\n \"value\": true,\n \"observed_at\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Authorizations
An organization API key. Keys carry a role (read_write or
read_only) and may be restricted to a namespace prefix such as
acme/*, or to one namespace such as acme/prod/tenant_1. A prefix
matches on a / boundary: acme/prod/tenant_1* covers
acme/prod/tenant_1 and everything under acme/prod/tenant_1/,
never acme/prod/tenant_12.
Headers
Returns the original response verbatim while the node still caches it. Correctness never depends on it.
1Path Parameters
The namespace name, with any / sent as %2F.
Up to 256 bytes. / separates levels of the hierarchy, as in acme/prod/tenant_123.
1 - 256^[A-Za-z0-9._:/-]+$Body
1Show child attributes
Show child attributes
Response
The outcomes were appended.