Model
Perform an intent evaluation
Evaluates NLU model against a model or using cross-validation.
POST
/
model
/
test
/
intents
Perform an intent evaluation
curl --request POST \
--url 'http://localhost:5005/model/test/intents?token=' \
--header 'Content-Type: application/x-yaml' \
--data 'nlu: - intent: greet
examples: |
- hey
- hello
- hi
- intent: bye
examples: |
- goodbye
- bye
- cheers
pipeline: - name: KeywordIntentClassifier'import requests
url = "http://localhost:5005/model/test/intents?token="
payload = "nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier"
headers = {"Content-Type": "application/x-yaml"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-yaml'},
body: 'nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier'
};
fetch('http://localhost:5005/model/test/intents?token=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "5005",
CURLOPT_URL => "http://localhost:5005/model/test/intents?token=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-yaml"
],
]);
$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 := "http://localhost:5005/model/test/intents?token="
payload := strings.NewReader("nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-yaml")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:5005/model/test/intents?token=")
.header("Content-Type", "application/x-yaml")
.body("nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5005/model/test/intents?token=")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-yaml'
request.body = "nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier"
response = http.request(request)
puts response.read_body{
"intent_evaluation": {
"report": {
"greet": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100,
"confused_with": {
"chitchat": 3,
"nlu_fallback": 5
}
},
"micro avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
},
"macro avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
},
"weightedq avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
}
},
"accuracy": 0.19047619047619047,
"f1_score": 0.06095238095238095,
"precision": 0.036281179138321996,
"predictions": [
{
"intent": "greet",
"predicted": "greet",
"text": "hey",
"confidence": 0.9973567
}
],
"errors": [
{
"text": "are you alright?",
"intent_response_key_target": "<string>",
"intent_response_key_prediction": {
"confidence": 0.6323,
"name": "greet"
}
}
]
},
"response_selection_evaluation": {
"report": {
"greet": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100,
"confused_with": {
"chitchat": 3,
"nlu_fallback": 5
}
},
"micro avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
},
"macro avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
},
"weightedq avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
}
},
"accuracy": 0.19047619047619047,
"f1_score": 0.06095238095238095,
"precision": 0.036281179138321996,
"predictions": [
{
"intent": "greet",
"predicted": "greet",
"text": "hey",
"confidence": 0.9973567
}
],
"errors": [
{
"text": "are you alright?",
"intent_response_key_target": "<string>",
"intent_response_key_prediction": {
"confidence": 0.6323,
"name": "greet"
}
}
]
},
"entity_evaluation": {}
}{
"version": "1.0.0",
"status": "failure",
"reason": "BadRequest",
"code": 400
}{
"version": "1.0.0",
"status": "failure",
"reason": "NotAuthenticated",
"message": "User is not authenticated to access resource.",
"code": 401
}{
"version": "1.0.0",
"status": "failure",
"reason": "NotAuthorized",
"message": "User has insufficient permission to access resource.",
"code": 403
}{
"version": "1.0.0",
"status": "failure",
"reason": "Conflict",
"message": "The request conflicts with the currently loaded model.",
"code": 409
}{
"version": "1.0.0",
"status": "ServerError",
"message": "An unexpected error occurred.",
"code": 500
}Authorizations
TokenAuthJWT
Query Parameters
Model that should be used for evaluation. If the parameter is set, the model will be fetched with the currently loaded configuration setup. However, the currently loaded model will not be updated. The state of the server will not change. If the parameter is not set, the currently loaded model will be used for the evaluation.
Body
application/x-yamlapplication/json
NLU training data and model configuration. The model configuration is only required if cross-validation is used.
Example:
"nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier"
⌘I
Perform an intent evaluation
curl --request POST \
--url 'http://localhost:5005/model/test/intents?token=' \
--header 'Content-Type: application/x-yaml' \
--data 'nlu: - intent: greet
examples: |
- hey
- hello
- hi
- intent: bye
examples: |
- goodbye
- bye
- cheers
pipeline: - name: KeywordIntentClassifier'import requests
url = "http://localhost:5005/model/test/intents?token="
payload = "nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier"
headers = {"Content-Type": "application/x-yaml"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-yaml'},
body: 'nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier'
};
fetch('http://localhost:5005/model/test/intents?token=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "5005",
CURLOPT_URL => "http://localhost:5005/model/test/intents?token=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-yaml"
],
]);
$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 := "http://localhost:5005/model/test/intents?token="
payload := strings.NewReader("nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-yaml")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:5005/model/test/intents?token=")
.header("Content-Type", "application/x-yaml")
.body("nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5005/model/test/intents?token=")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-yaml'
request.body = "nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier"
response = http.request(request)
puts response.read_body{
"intent_evaluation": {
"report": {
"greet": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100,
"confused_with": {
"chitchat": 3,
"nlu_fallback": 5
}
},
"micro avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
},
"macro avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
},
"weightedq avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
}
},
"accuracy": 0.19047619047619047,
"f1_score": 0.06095238095238095,
"precision": 0.036281179138321996,
"predictions": [
{
"intent": "greet",
"predicted": "greet",
"text": "hey",
"confidence": 0.9973567
}
],
"errors": [
{
"text": "are you alright?",
"intent_response_key_target": "<string>",
"intent_response_key_prediction": {
"confidence": 0.6323,
"name": "greet"
}
}
]
},
"response_selection_evaluation": {
"report": {
"greet": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100,
"confused_with": {
"chitchat": 3,
"nlu_fallback": 5
}
},
"micro avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
},
"macro avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
},
"weightedq avg": {
"precision": 0.123,
"recall": 0.456,
"f1-score": 0.12,
"support": 100
}
},
"accuracy": 0.19047619047619047,
"f1_score": 0.06095238095238095,
"precision": 0.036281179138321996,
"predictions": [
{
"intent": "greet",
"predicted": "greet",
"text": "hey",
"confidence": 0.9973567
}
],
"errors": [
{
"text": "are you alright?",
"intent_response_key_target": "<string>",
"intent_response_key_prediction": {
"confidence": 0.6323,
"name": "greet"
}
}
]
},
"entity_evaluation": {}
}{
"version": "1.0.0",
"status": "failure",
"reason": "BadRequest",
"code": 400
}{
"version": "1.0.0",
"status": "failure",
"reason": "NotAuthenticated",
"message": "User is not authenticated to access resource.",
"code": 401
}{
"version": "1.0.0",
"status": "failure",
"reason": "NotAuthorized",
"message": "User has insufficient permission to access resource.",
"code": 403
}{
"version": "1.0.0",
"status": "failure",
"reason": "Conflict",
"message": "The request conflicts with the currently loaded model.",
"code": 409
}{
"version": "1.0.0",
"status": "ServerError",
"message": "An unexpected error occurred.",
"code": 500
}