Python
# The block comes with the pack, in the same round trip
context = conversation.context(include=["constraints"])
block = context.constraints # hard, soft, attributes, exclude, ask// The block comes with the pack, in the same round trip
const ctx = await convo.context({ include: ["constraints"] });
const block = ctx.constraints; // hard, soft, attributes, exclude, askcurl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/constraints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": {
"value": "<string>",
"scope": "<string>"
},
"conversation_id": "<string>",
"for": "self",
"tool": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subject: {value: '<string>', scope: '<string>'},
conversation_id: '<string>',
for: 'self',
tool: '<string>'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/constraints', 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://{space}.{region}.api.niadra.com/v1/constraints",
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([
'subject' => [
'value' => '<string>',
'scope' => '<string>'
],
'conversation_id' => '<string>',
'for' => 'self',
'tool' => '<string>'
]),
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://{space}.{region}.api.niadra.com/v1/constraints"
payload := strings.NewReader("{\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"for\": \"self\",\n \"tool\": \"<string>\"\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://{space}.{region}.api.niadra.com/v1/constraints")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"for\": \"self\",\n \"tool\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/constraints")
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 \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"for\": \"self\",\n \"tool\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"version": "<string>",
"already_presented": [
{
"ref": "<string>",
"times": 2,
"last_at": "2023-11-07T05:31:56Z",
"values": {}
}
],
"ask": [
"<string>"
],
"attributes": [
{
"apply": "always",
"confidence": 0.5,
"id": "<string>",
"name": "<string>",
"source": "stated",
"value": true,
"category": "<string>",
"system": "<string>"
}
],
"conflicts": [
{
"by": "current_utterance",
"ids": [
"<string>"
],
"kept": "<string>"
}
],
"contact_windows": [
{
"said_at": "2023-11-07T05:31:56Z",
"window": {
"from": "<string>",
"to": "<string>",
"tz": "<string>",
"days": [
4
]
},
"channel": "<string>"
}
],
"exclude": [
"<string>"
],
"hard": [
{
"attr": "<string>",
"id": "<string>",
"op": "in",
"origin": {
"kind": "stated",
"event_key": "<string>",
"turn_id": "<string>"
},
"scope": "turn",
"source": "stated",
"values": [
true
],
"category": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"object": "<string>",
"relax": "never"
}
],
"instructions": [
{
"id": "<string>",
"said_at": "2023-11-07T05:31:56Z",
"strength": "must",
"text": "<string>",
"about": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attr": "<string>",
"contact": false,
"expires_at": "2023-11-07T05:31:56Z",
"hard": "<string>",
"object": "<string>",
"only_with": "<string>",
"role": "<string>"
}
],
"omitted": {},
"precedence": [
"current_utterance"
],
"relaxation_order": [
"<string>"
],
"rendered": {
"args": {},
"mode": "advisory",
"tool": "<string>",
"post_filter": [
"<string>"
],
"residual": [
"<string>"
]
},
"rules": [
{
"id": "<string>",
"origin": "<string>",
"rank": 50,
"attr": "<string>",
"op": "in",
"values": [
true
]
}
],
"soft": [
{
"attr": "<string>",
"confidence": 0.5,
"id": "<string>",
"source": "inferred",
"value": true,
"weight": 0.5,
"category": "<string>",
"polarity": "prefer"
}
],
"subject": {
"for": "self"
}
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Signals and constraints
Constraints block
What a customer wants, refuses and is, for this turn’s tools; the same block include: ["constraints"] adds to a context read, here renderable for one tool. The signals feature.
POST
/
v1
/
constraints
Python
# The block comes with the pack, in the same round trip
context = conversation.context(include=["constraints"])
block = context.constraints # hard, soft, attributes, exclude, ask// The block comes with the pack, in the same round trip
const ctx = await convo.context({ include: ["constraints"] });
const block = ctx.constraints; // hard, soft, attributes, exclude, askcurl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/constraints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subject": {
"value": "<string>",
"scope": "<string>"
},
"conversation_id": "<string>",
"for": "self",
"tool": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subject: {value: '<string>', scope: '<string>'},
conversation_id: '<string>',
for: 'self',
tool: '<string>'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/constraints', 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://{space}.{region}.api.niadra.com/v1/constraints",
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([
'subject' => [
'value' => '<string>',
'scope' => '<string>'
],
'conversation_id' => '<string>',
'for' => 'self',
'tool' => '<string>'
]),
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://{space}.{region}.api.niadra.com/v1/constraints"
payload := strings.NewReader("{\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"for\": \"self\",\n \"tool\": \"<string>\"\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://{space}.{region}.api.niadra.com/v1/constraints")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"for\": \"self\",\n \"tool\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/constraints")
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 \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"for\": \"self\",\n \"tool\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"version": "<string>",
"already_presented": [
{
"ref": "<string>",
"times": 2,
"last_at": "2023-11-07T05:31:56Z",
"values": {}
}
],
"ask": [
"<string>"
],
"attributes": [
{
"apply": "always",
"confidence": 0.5,
"id": "<string>",
"name": "<string>",
"source": "stated",
"value": true,
"category": "<string>",
"system": "<string>"
}
],
"conflicts": [
{
"by": "current_utterance",
"ids": [
"<string>"
],
"kept": "<string>"
}
],
"contact_windows": [
{
"said_at": "2023-11-07T05:31:56Z",
"window": {
"from": "<string>",
"to": "<string>",
"tz": "<string>",
"days": [
4
]
},
"channel": "<string>"
}
],
"exclude": [
"<string>"
],
"hard": [
{
"attr": "<string>",
"id": "<string>",
"op": "in",
"origin": {
"kind": "stated",
"event_key": "<string>",
"turn_id": "<string>"
},
"scope": "turn",
"source": "stated",
"values": [
true
],
"category": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"object": "<string>",
"relax": "never"
}
],
"instructions": [
{
"id": "<string>",
"said_at": "2023-11-07T05:31:56Z",
"strength": "must",
"text": "<string>",
"about": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"attr": "<string>",
"contact": false,
"expires_at": "2023-11-07T05:31:56Z",
"hard": "<string>",
"object": "<string>",
"only_with": "<string>",
"role": "<string>"
}
],
"omitted": {},
"precedence": [
"current_utterance"
],
"relaxation_order": [
"<string>"
],
"rendered": {
"args": {},
"mode": "advisory",
"tool": "<string>",
"post_filter": [
"<string>"
],
"residual": [
"<string>"
]
},
"rules": [
{
"id": "<string>",
"origin": "<string>",
"rank": 50,
"attr": "<string>",
"op": "in",
"values": [
true
]
}
],
"soft": [
{
"attr": "<string>",
"confidence": 0.5,
"id": "<string>",
"source": "inferred",
"value": true,
"weight": 0.5,
"category": "<string>",
"polarity": "prefer"
}
],
"subject": {
"for": "self"
}
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Body
application/json
Response
Successful Response
What one subject wants, refuses and is, for the tools of this turn (constraints.v0).

