curl --request GET \
--url https://api.vainona.ai/v1/namespaces/{ns}/documents/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}', 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}/documents/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}"
req, _ := http.NewRequest("GET", url, nil)
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.get("https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"revision": 1,
"incarnation": 1,
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"answers": {},
"usage": {
"bytes_written": 1,
"bytes_scanned": 1,
"judgment_units": 1,
"tokens_evaluated": 1
},
"history": [
{
"id": "<string>",
"document_id": "<string>",
"revision": 1,
"incarnation": 1,
"judgment": "<string>",
"judgment_version": 2,
"engine": "<string>",
"engine_version": "<string>",
"context_hash": "<string>",
"context_tokens": 1,
"context_truncated": true,
"output": {
"p": 0.5,
"value": "<string>",
"dist": {},
"escape_p": 0.5,
"score": 123,
"parts": {},
"features": {}
},
"status": "success",
"error": {
"class": "retryable",
"message": "<string>"
},
"shadow": true,
"created_at": "2023-11-07T05:31:56Z",
"latency_ms": 1,
"watermark": 1,
"related_documents": [
{
"relation": "<string>",
"document_id": "<string>",
"revision": 1
}
],
"context": {},
"raw": "<unknown>"
}
]
}{
"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": {}
}
}Get a document, its answers and optional history
Reading a document with on_read judgments triggers their evaluation;
the first read returns them pending unless wait_ms is passed (§6.7,
§7.5.7).
curl --request GET \
--url https://api.vainona.ai/v1/namespaces/{ns}/documents/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}', 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}/documents/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}"
req, _ := http.NewRequest("GET", url, nil)
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.get("https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vainona.ai/v1/namespaces/{ns}/documents/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"revision": 1,
"incarnation": 1,
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"answers": {},
"usage": {
"bytes_written": 1,
"bytes_scanned": 1,
"judgment_units": 1,
"tokens_evaluated": 1
},
"history": [
{
"id": "<string>",
"document_id": "<string>",
"revision": 1,
"incarnation": 1,
"judgment": "<string>",
"judgment_version": 2,
"engine": "<string>",
"engine_version": "<string>",
"context_hash": "<string>",
"context_tokens": 1,
"context_truncated": true,
"output": {
"p": 0.5,
"value": "<string>",
"dist": {},
"escape_p": 0.5,
"score": 123,
"parts": {},
"features": {}
},
"status": "success",
"error": {
"class": "retryable",
"message": "<string>"
},
"shadow": true,
"created_at": "2023-11-07T05:31:56Z",
"latency_ms": 1,
"watermark": 1,
"related_documents": [
{
"relation": "<string>",
"document_id": "<string>",
"revision": 1
}
],
"context": {},
"raw": "<unknown>"
}
]
}{
"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.
Path 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._:/-]+$The document id, with any / sent as %2F.
Up to 128 bytes.
1 - 128^[A-Za-z0-9._:/-]+$Query Parameters
history adds the evaluation records of the current incarnation,
newest first. context adds each evaluation's compiled context and
raw the engine's raw response; both are large and only apply with
history.
history, context, raw Maximum evaluation records returned with include=history.
x >= 1Include history from earlier lives of the same id.
Judgment names whose answers to return.
A judgment, attribute or threshold name. Names are path segments in field references, so they never contain ..
1 - 128^[A-Za-z0-9_-]+$How long to wait for on_read answers before returning them pending.
0 <= x <= 10000Response
The document.
Up to 128 bytes.
1 - 128^[A-Za-z0-9._:/-]+$The namespace sequence at which the document last changed. Monotonic, not contiguous.
x >= 0The sequence at which this document was created or re-created after a delete.
x >= 0Flat, filterable and sortable. At most 64 keys. Not sent to engines unless a context recipe names them.
Show child attributes
Show child attributes
The JSON content judgments are made about. At most 1 MB. Never filterable.
When this incarnation was created, the time of the write that created it unless that write gave its own created_at. Relations order by it, and window and freshness.fanout.scope count from it.
RFC 3339, UTC.
Answers keyed by judgment name.
Show child attributes
Show child attributes
What this response billed (§6.1).
Show child attributes
Show child attributes
With include=history, evaluation records newest first.
Show child attributes
Show child attributes