Decide API Beta
Beta: in use, and details can still change.
Typed questions about a text, answered with probabilities. Beta. Needs a personal key with decide:process; an organisation integration key gets 403 integration_not_permitted.
- Base URL
https://api.komplai.dk
Evaluate one text Beta
POST /v1/decide
Decide (beta) answers typed questions about one text with probabilities instead of prose: choice picks one option, score places the text on a scale, and noul says how likely a statement is true. Every answer has the full posterior and a confidence. A decision model writes no text, so there is nothing to parse; it runs on komplai's local infrastructure in Denmark, with no AI charge, and has 30 seconds to answer. The text is not stored. Needs a personal key with decide:process.
- Scopes
decide:process- Keys
- Personal key
Try it
Calls are real: komplai processes what you send, each call counts towards your key's limits, and processing in EU cloud counts towards your organisation's monthly AI spending cap. Use test data.
A key that starts with kp_live_. It stays on this page until you leave it and is sent only to api.komplai.dk.
Response
Request-Id
Request body
The decision model: komplai-decide (Laya) or komplai-decide-claes (Claes). Leave it out for the default: the model you chose in the hub, else your organisation's default, else komplai-decide (Laya). A model Decide does not offer your organisation answers 409 model_not_enabled; the API never picks another one. Both run on komplai's local infrastructure in Denmark, with no AI charge.
- One of
komplai-decidekomplai-decide-claes
Question id to question, from 1 to 64. An id may not be empty (400 invalid_input); it comes back unchanged in answers. The questions share one reading of each text, so several questions cost little more than one.
- Fields
- 1 to 64
Child fields (16)
One typed question. type says which answer comes back.
One of
choiceobject
Responses
200 OK
One answer for every question, with the probabilities behind it. The text is not stored.
Headers
Body
Question id to answer, one for every question.
Child fields (26)
One of
choiceobject
scoreobject
noulobject
400 Bad Request
The request was refused before processing.
Error codes
invalid_inputThe request is not what the operation documents, for example invalid JSON, a field that is not listed or a value out of range.
Headers
401 Unauthorized
The key is missing or not valid.
Error codes
api_key_requiredNo Authorization: Bearer header with a komplai key.invalid_api_keyThe key is unknown, expired, revoked or retired, the person behind a personal key is no longer a member or no longer assigned any app the key covers, or your organisation's API access for it is not set up or no longer active.invalid_tokenThe key was revoked or expired, or its access ended, while the request was admitted or processed.
Headers
403 Forbidden
The key may not do this, or the organisation's access does not cover it.
Error codes
integration_not_permittedAn organisation integration key cannot use this operation or this option.insufficient_scopeThe key lacks a scope the operation needs (x-komplai-scopes): it was not issued or created with it, its person is no longer assigned the app, or the organisation's processing approval no longer covers it.identity_retiredThe person behind a personal key has been removed from komplai.app_not_assignedThe key's person lost the app or their membership while the request was admitted.processing_not_enabledThe processing is not enabled for the app in the organisation: EU processing is not approved and enabled, or the agreement keeps processing on local infrastructure.processing_not_approvedThe organisation's processing approval for the app is missing or was withdrawn.processing_choice_not_allowedThe organisation does not allow this processing (local infrastructure or EU cloud) through the API, or the connection is not made available through the API.
Headers
404 Not Found
Not found.
Error codes
model_not_enabledThe model is not one you may use at this processing, or it is not offered there right now.
Headers
409 Conflict
Conflict with the current state.
Error codes
model_not_enabledThe model is not one you may use at this processing, or it is not offered there right now.
Headers
413 Content Too Large
Too large.
Error codes
Payload Too LargeFastify's reason phrase: the body is over the operation's byte limit.
Headers
415 Unsupported Media Type
The body has no Content-Type, or one the API does not read, such as XML or form data. Send application/json.
Error codes
Unsupported Media TypeFastify's reason phrase: the body has no Content-Type, or one the API does not read, such as XML or form data.
Headers
429 Too Many Requests
Refused for now. Wait the seconds in Retry-After before you try again.
Error codes
rate_limitedToo many requests: the per-minute limit of the person behind a personal key (shared with that person's other keys and use of the hub) or of the integration behind an organisation integration key (shared by its keys), the organisation's (120), the API's (300) or the per-IP network limit. Wait Retry-After seconds.
Headers
502 Bad Gateway
A processing service failed. No partial result is returned.
Error codes
service_unavailableThe model failed or could not be reached, or local infrastructure is not set up for this call right now.invalid_responseThe model's answer failed validation, so nothing was returned.
Headers
503 Service Unavailable
Processing is not available right now.
Error codes
service_unavailableThe model failed or could not be reached, or local infrastructure is not set up for this call right now.access_service_unavailableKeys and access could not be checked.
Headers
/v1/decidecurl https://api.komplai.dk/v1/decide \
-H "Authorization: Bearer $KOMPLAI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"state": "Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm",
"questions": {
"category": {
"type": "choice",
"instructions": "Hvad handler henvendelsen om?",
"criteria": {
"aktindsigt": "Borgeren beder om kopi af dokumenter eller aktindsigt",
"klage": "Borgeren klager over en afgørelse",
"andet": "Noget andet"
}
},
"urgency": {
"type": "score",
"instructions": "Hvor hurtigt skal henvendelsen besvares?",
"criteria": [
"Inden for den normale frist",
"Inden for en uge",
"Samme dag"
]
},
"personal_data": {
"type": "noul",
"instructions": "Indeholder teksten personoplysninger?",
"criteria": {
"true": "Ja, for eksempel et navn eller et CPR-nummer",
"false": "Nej"
}
}
}
}'$headers = @{
Authorization = "Bearer $env:KOMPLAI_TOKEN"
}
$body = [ordered]@{
state = 'Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm'
questions = [ordered]@{
category = [ordered]@{
type = 'choice'
instructions = 'Hvad handler henvendelsen om?'
criteria = [ordered]@{
aktindsigt = 'Borgeren beder om kopi af dokumenter eller aktindsigt'
klage = 'Borgeren klager over en afgørelse'
andet = 'Noget andet'
}
}
urgency = [ordered]@{
type = 'score'
instructions = 'Hvor hurtigt skal henvendelsen besvares?'
criteria = @(
'Inden for den normale frist',
'Inden for en uge',
'Samme dag'
)
}
personal_data = [ordered]@{
type = 'noul'
instructions = 'Indeholder teksten personoplysninger?'
criteria = [ordered]@{
true = 'Ja, for eksempel et navn eller et CPR-nummer'
false = 'Nej'
}
}
}
} | ConvertTo-Json -Depth 100
$request = @{
Method = 'Post'
Uri = 'https://api.komplai.dk/v1/decide'
Headers = $headers
ContentType = 'application/json; charset=utf-8'
Body = $body
}
$response = Invoke-RestMethod @request
$response | ConvertTo-Json -Depth 100import os
import requests
response = requests.post(
"https://api.komplai.dk/v1/decide",
headers={
"Authorization": f"Bearer {os.environ['KOMPLAI_TOKEN']}",
},
json={
"state": "Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm",
"questions": {
"category": {
"type": "choice",
"instructions": "Hvad handler henvendelsen om?",
"criteria": {
"aktindsigt": "Borgeren beder om kopi af dokumenter eller aktindsigt",
"klage": "Borgeren klager over en afgørelse",
"andet": "Noget andet",
},
},
"urgency": {
"type": "score",
"instructions": "Hvor hurtigt skal henvendelsen besvares?",
"criteria": [
"Inden for den normale frist",
"Inden for en uge",
"Samme dag",
],
},
"personal_data": {
"type": "noul",
"instructions": "Indeholder teksten personoplysninger?",
"criteria": {
"true": "Ja, for eksempel et navn eller et CPR-nummer",
"false": "Nej",
},
},
},
},
timeout=330,
)
print(response.status_code, response.headers.get("Request-Id"))
print(response.json())const response = await fetch("https://api.komplai.dk/v1/decide", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KOMPLAI_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
state: "Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm",
questions: {
category: {
type: "choice",
instructions: "Hvad handler henvendelsen om?",
criteria: {
aktindsigt: "Borgeren beder om kopi af dokumenter eller aktindsigt",
klage: "Borgeren klager over en afgørelse",
andet: "Noget andet",
},
},
urgency: {
type: "score",
instructions: "Hvor hurtigt skal henvendelsen besvares?",
criteria: [
"Inden for den normale frist",
"Inden for en uge",
"Samme dag",
],
},
personal_data: {
type: "noul",
instructions: "Indeholder teksten personoplysninger?",
criteria: {
true: "Ja, for eksempel et navn eller et CPR-nummer",
false: "Nej",
},
},
},
}),
});
console.log(response.status, response.headers.get("Request-Id"));
console.log(await response.json());using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(330) };
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.komplai.dk/v1/decide");
request.Headers.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("KOMPLAI_TOKEN"));
request.Content = new StringContent(@"{
""state"": ""Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm"",
""questions"": {
""category"": {
""type"": ""choice"",
""instructions"": ""Hvad handler henvendelsen om?"",
""criteria"": {
""aktindsigt"": ""Borgeren beder om kopi af dokumenter eller aktindsigt"",
""klage"": ""Borgeren klager over en afgørelse"",
""andet"": ""Noget andet""
}
},
""urgency"": {
""type"": ""score"",
""instructions"": ""Hvor hurtigt skal henvendelsen besvares?"",
""criteria"": [
""Inden for den normale frist"",
""Inden for en uge"",
""Samme dag""
]
},
""personal_data"": {
""type"": ""noul"",
""instructions"": ""Indeholder teksten personoplysninger?"",
""criteria"": {
""true"": ""Ja, for eksempel et navn eller et CPR-nummer"",
""false"": ""Nej""
}
}
}
}", Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
if (response.Headers.TryGetValues("Request-Id", out var requestId))
{
Console.WriteLine(string.Join(", ", requestId));
}
Console.WriteLine(await response.Content.ReadAsStringAsync());Set the environment variable KOMPLAI_TOKEN to your key first.
{
"model": "convaiinnovations/laya/multilingual",
"answers": {
"category": {
"type": "choice",
"choice": "aktindsigt",
"probabilities": {
"aktindsigt": 0.91,
"klage": 0.03,
"andet": 0.06
},
"confidence": 0.672,
"action": {
"act_probability": 0.88
}
},
"urgency": {
"type": "score",
"score": 0.32,
"max": 2,
"probabilities": [0.72, 0.24, 0.04],
"confidence": 0.356
},
"personal_data": {
"type": "noul",
"noul": 0.97,
"probabilities": {
"true": 0.97,
"false": 0.03
},
"confidence": 0.806
}
},
"usage": {
"input_tokens": 118,
"output_tokens": 0
},
"latency_ms": 38
}{
"error": "invalid_input",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/invalid_input"
}{
"error": "api_key_required",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/api_key_required"
}{
"error": "integration_not_permitted",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/integration_not_permitted"
}{
"error": "model_not_enabled",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/model_not_enabled"
}{
"error": "model_not_enabled",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/model_not_enabled"
}{
"error": "Payload Too Large",
"statusCode": 413,
"code": "FST_ERR_CTP_BODY_TOO_LARGE",
"message": "Request body is too large",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/payload-too-large"
}{
"error": "Unsupported Media Type",
"statusCode": 415,
"code": "FST_ERR_CTP_INVALID_MEDIA_TYPE",
"message": "Unsupported Media Type",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/unsupported-media-type"
}{
"error": "rate_limited",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/rate_limited"
}{
"error": "service_unavailable",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/service_unavailable"
}{
"error": "service_unavailable",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/service_unavailable"
}Evaluate several texts Beta
POST /v1/decide/batch
Decide (beta): the same questions for up to 100 texts in one call, answered in one pass of the model. The answers come back in the order of states, and the batch is answered whole or refused whole. It counts as one request. Needs a personal key with decide:process.
- Scopes
decide:process- Keys
- Personal key
Try it
Calls are real: komplai processes what you send, each call counts towards your key's limits, and processing in EU cloud counts towards your organisation's monthly AI spending cap. Use test data.
A key that starts with kp_live_. It stays on this page until you leave it and is sent only to api.komplai.dk.
Response
Request-Id
Request body
The decision model: komplai-decide (Laya) or komplai-decide-claes (Claes). Leave it out for the default: the model you chose in the hub, else your organisation's default, else komplai-decide (Laya). A model Decide does not offer your organisation answers 409 model_not_enabled; the API never picks another one. Both run on komplai's local infrastructure in Denmark, with no AI charge.
- One of
komplai-decidekomplai-decide-claes
Question id to question, from 1 to 64. An id may not be empty (400 invalid_input); it comes back unchanged in answers. The questions share one reading of each text, so several questions cost little more than one.
- Fields
- 1 to 64
Child fields (16)
One typed question. type says which answer comes back.
One of
choiceobject
Responses
200 OK
The answers for every text, in the order of states. The texts are not stored.
Headers
Body
One per text, in the order of states. A batch is answered whole or refused whole.
Child fields (30)
Question id to answer, one for every question.
Child fields (26)
One of
choiceobject
scoreobject
noulobject
400 Bad Request
The request was refused before processing.
Error codes
invalid_inputThe request is not what the operation documents, for example invalid JSON, a field that is not listed or a value out of range.
Headers
401 Unauthorized
The key is missing or not valid.
Error codes
api_key_requiredNo Authorization: Bearer header with a komplai key.invalid_api_keyThe key is unknown, expired, revoked or retired, the person behind a personal key is no longer a member or no longer assigned any app the key covers, or your organisation's API access for it is not set up or no longer active.invalid_tokenThe key was revoked or expired, or its access ended, while the request was admitted or processed.
Headers
403 Forbidden
The key may not do this, or the organisation's access does not cover it.
Error codes
integration_not_permittedAn organisation integration key cannot use this operation or this option.insufficient_scopeThe key lacks a scope the operation needs (x-komplai-scopes): it was not issued or created with it, its person is no longer assigned the app, or the organisation's processing approval no longer covers it.identity_retiredThe person behind a personal key has been removed from komplai.app_not_assignedThe key's person lost the app or their membership while the request was admitted.processing_not_enabledThe processing is not enabled for the app in the organisation: EU processing is not approved and enabled, or the agreement keeps processing on local infrastructure.processing_not_approvedThe organisation's processing approval for the app is missing or was withdrawn.processing_choice_not_allowedThe organisation does not allow this processing (local infrastructure or EU cloud) through the API, or the connection is not made available through the API.
Headers
404 Not Found
Not found.
Error codes
model_not_enabledThe model is not one you may use at this processing, or it is not offered there right now.
Headers
409 Conflict
Conflict with the current state.
Error codes
model_not_enabledThe model is not one you may use at this processing, or it is not offered there right now.
Headers
413 Content Too Large
Too large.
Error codes
Payload Too LargeFastify's reason phrase: the body is over the operation's byte limit.
Headers
415 Unsupported Media Type
The body has no Content-Type, or one the API does not read, such as XML or form data. Send application/json.
Error codes
Unsupported Media TypeFastify's reason phrase: the body has no Content-Type, or one the API does not read, such as XML or form data.
Headers
429 Too Many Requests
Refused for now. Wait the seconds in Retry-After before you try again.
Error codes
rate_limitedToo many requests: the per-minute limit of the person behind a personal key (shared with that person's other keys and use of the hub) or of the integration behind an organisation integration key (shared by its keys), the organisation's (120), the API's (300) or the per-IP network limit. Wait Retry-After seconds.
Headers
502 Bad Gateway
A processing service failed. No partial result is returned.
Error codes
service_unavailableThe model failed or could not be reached, or local infrastructure is not set up for this call right now.invalid_responseThe model's answer failed validation, so nothing was returned.
Headers
503 Service Unavailable
Processing is not available right now.
Error codes
service_unavailableThe model failed or could not be reached, or local infrastructure is not set up for this call right now.access_service_unavailableKeys and access could not be checked.
Headers
/v1/decide/batchcurl https://api.komplai.dk/v1/decide/batch \
-H "Authorization: Bearer $KOMPLAI_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"states": [
"Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm",
"Jeg klager over afslaget på min ansøgning om boligstøtte. Afgørelsen er forkert, og jeg har brug for svar hurtigt."
],
"questions": {
"category": {
"type": "choice",
"instructions": "Hvad handler henvendelsen om?",
"criteria": {
"aktindsigt": "Borgeren beder om kopi af dokumenter eller aktindsigt",
"klage": "Borgeren klager over en afgørelse",
"andet": "Noget andet"
}
},
"urgency": {
"type": "score",
"instructions": "Hvor hurtigt skal henvendelsen besvares?",
"criteria": [
"Inden for den normale frist",
"Inden for en uge",
"Samme dag"
]
},
"personal_data": {
"type": "noul",
"instructions": "Indeholder teksten personoplysninger?",
"criteria": {
"true": "Ja, for eksempel et navn eller et CPR-nummer",
"false": "Nej"
}
}
}
}'$headers = @{
Authorization = "Bearer $env:KOMPLAI_TOKEN"
}
$body = [ordered]@{
states = @(
'Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm',
'Jeg klager over afslaget på min ansøgning om boligstøtte. Afgørelsen er forkert, og jeg har brug for svar hurtigt.'
)
questions = [ordered]@{
category = [ordered]@{
type = 'choice'
instructions = 'Hvad handler henvendelsen om?'
criteria = [ordered]@{
aktindsigt = 'Borgeren beder om kopi af dokumenter eller aktindsigt'
klage = 'Borgeren klager over en afgørelse'
andet = 'Noget andet'
}
}
urgency = [ordered]@{
type = 'score'
instructions = 'Hvor hurtigt skal henvendelsen besvares?'
criteria = @(
'Inden for den normale frist',
'Inden for en uge',
'Samme dag'
)
}
personal_data = [ordered]@{
type = 'noul'
instructions = 'Indeholder teksten personoplysninger?'
criteria = [ordered]@{
true = 'Ja, for eksempel et navn eller et CPR-nummer'
false = 'Nej'
}
}
}
} | ConvertTo-Json -Depth 100
$request = @{
Method = 'Post'
Uri = 'https://api.komplai.dk/v1/decide/batch'
Headers = $headers
ContentType = 'application/json; charset=utf-8'
Body = $body
}
$response = Invoke-RestMethod @request
$response | ConvertTo-Json -Depth 100import os
import requests
response = requests.post(
"https://api.komplai.dk/v1/decide/batch",
headers={
"Authorization": f"Bearer {os.environ['KOMPLAI_TOKEN']}",
},
json={
"states": [
"Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm",
"Jeg klager over afslaget på min ansøgning om boligstøtte. Afgørelsen er forkert, og jeg har brug for svar hurtigt.",
],
"questions": {
"category": {
"type": "choice",
"instructions": "Hvad handler henvendelsen om?",
"criteria": {
"aktindsigt": "Borgeren beder om kopi af dokumenter eller aktindsigt",
"klage": "Borgeren klager over en afgørelse",
"andet": "Noget andet",
},
},
"urgency": {
"type": "score",
"instructions": "Hvor hurtigt skal henvendelsen besvares?",
"criteria": [
"Inden for den normale frist",
"Inden for en uge",
"Samme dag",
],
},
"personal_data": {
"type": "noul",
"instructions": "Indeholder teksten personoplysninger?",
"criteria": {
"true": "Ja, for eksempel et navn eller et CPR-nummer",
"false": "Nej",
},
},
},
},
timeout=330,
)
print(response.status_code, response.headers.get("Request-Id"))
print(response.json())const response = await fetch("https://api.komplai.dk/v1/decide/batch", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KOMPLAI_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
states: [
"Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm",
"Jeg klager over afslaget på min ansøgning om boligstøtte. Afgørelsen er forkert, og jeg har brug for svar hurtigt.",
],
questions: {
category: {
type: "choice",
instructions: "Hvad handler henvendelsen om?",
criteria: {
aktindsigt: "Borgeren beder om kopi af dokumenter eller aktindsigt",
klage: "Borgeren klager over en afgørelse",
andet: "Noget andet",
},
},
urgency: {
type: "score",
instructions: "Hvor hurtigt skal henvendelsen besvares?",
criteria: [
"Inden for den normale frist",
"Inden for en uge",
"Samme dag",
],
},
personal_data: {
type: "noul",
instructions: "Indeholder teksten personoplysninger?",
criteria: {
true: "Ja, for eksempel et navn eller et CPR-nummer",
false: "Nej",
},
},
},
}),
});
console.log(response.status, response.headers.get("Request-Id"));
console.log(await response.json());using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(330) };
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.komplai.dk/v1/decide/batch");
request.Headers.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("KOMPLAI_TOKEN"));
request.Content = new StringContent(@"{
""states"": [
""Hej. Jeg vil gerne have en kopi af min ansøgning om byggetilladelse fra marts. Venlig hilsen Mette Kjærgaard Holm"",
""Jeg klager over afslaget på min ansøgning om boligstøtte. Afgørelsen er forkert, og jeg har brug for svar hurtigt.""
],
""questions"": {
""category"": {
""type"": ""choice"",
""instructions"": ""Hvad handler henvendelsen om?"",
""criteria"": {
""aktindsigt"": ""Borgeren beder om kopi af dokumenter eller aktindsigt"",
""klage"": ""Borgeren klager over en afgørelse"",
""andet"": ""Noget andet""
}
},
""urgency"": {
""type"": ""score"",
""instructions"": ""Hvor hurtigt skal henvendelsen besvares?"",
""criteria"": [
""Inden for den normale frist"",
""Inden for en uge"",
""Samme dag""
]
},
""personal_data"": {
""type"": ""noul"",
""instructions"": ""Indeholder teksten personoplysninger?"",
""criteria"": {
""true"": ""Ja, for eksempel et navn eller et CPR-nummer"",
""false"": ""Nej""
}
}
}
}", Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
if (response.Headers.TryGetValues("Request-Id", out var requestId))
{
Console.WriteLine(string.Join(", ", requestId));
}
Console.WriteLine(await response.Content.ReadAsStringAsync());Set the environment variable KOMPLAI_TOKEN to your key first.
{
"model": "convaiinnovations/laya/multilingual",
"results": [
{
"answers": {
"category": {
"type": "choice",
"choice": "aktindsigt",
"probabilities": {
"aktindsigt": 0.91,
"klage": 0.03,
"andet": 0.06
},
"confidence": 0.672,
"action": {
"act_probability": 0.88
}
},
"urgency": {
"type": "score",
"score": 0.32,
"max": 2,
"probabilities": [0.72, 0.24, 0.04],
"confidence": 0.356
},
"personal_data": {
"type": "noul",
"noul": 0.97,
"probabilities": {
"true": 0.97,
"false": 0.03
},
"confidence": 0.806
}
},
"usage": {
"input_tokens": 118,
"output_tokens": 0
}
},
{
"answers": {
"category": {
"type": "choice",
"choice": "klage",
"probabilities": {
"aktindsigt": 0.08,
"klage": 0.86,
"andet": 0.06
},
"confidence": 0.544,
"action": {
"act_probability": 0.79
}
},
"urgency": {
"type": "score",
"score": 1.15,
"max": 2,
"probabilities": [0.15, 0.55, 0.3],
"confidence": 0.113
},
"personal_data": {
"type": "noul",
"noul": 0.12,
"probabilities": {
"true": 0.12,
"false": 0.88
},
"confidence": 0.471
}
},
"usage": {
"input_tokens": 112,
"output_tokens": 0
}
}
],
"usage": {
"input_tokens": 230,
"output_tokens": 0
},
"latency_ms": 52
}{
"error": "invalid_input",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/invalid_input"
}{
"error": "api_key_required",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/api_key_required"
}{
"error": "integration_not_permitted",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/integration_not_permitted"
}{
"error": "model_not_enabled",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/model_not_enabled"
}{
"error": "model_not_enabled",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/model_not_enabled"
}{
"error": "Payload Too Large",
"statusCode": 413,
"code": "FST_ERR_CTP_BODY_TOO_LARGE",
"message": "Request body is too large",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/payload-too-large"
}{
"error": "Unsupported Media Type",
"statusCode": 415,
"code": "FST_ERR_CTP_INVALID_MEDIA_TYPE",
"message": "Unsupported Media Type",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/unsupported-media-type"
}{
"error": "rate_limited",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/rate_limited"
}{
"error": "service_unavailable",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/service_unavailable"
}{
"error": "service_unavailable",
"request_id": "0f8e2c4a-6b1d-4e3f-9a7c-5d2b8e1f4a60",
"doc_url": "https://developers.komplai.dk/errors/service_unavailable"
}