NLU

A JSON endpoint is exposed to allow running realtime predictions using the model trained within Studio. The input is a single utterance, and the output is a distribution over intents.

curl -s -H 'Authorization: Bearer '$(hf auth print-access-token) \
-d '{"input_utterance": "I seem to have forgotten my login credentials" }' \
https://api.humanfirst.ai/v1alpha1/nlu/predict/namespace/workspace_id
info

This uses our hf command line tool to generate an access token. Refer to the authentication section for instructions on how to obtain them programmatically.

Here is example response:

{
"matches": [
{
"id": "intent-DA5UQKLCB5CMBF77EMS4WOFL",
"name": "password_reset",
"score": 0.49628958
},
{
"id": "intent-TPHLKFITQRCN5FKCBOEDBE5Y",
"name": "repeat",
"score": 0.3678111
},
{
"id": "intent-4NZCKGCCORAWVKWTJMVZAES7",
"name": "what_song",
"score": 0.025530491
}
]
}
info

For brievity, intents that have a probability lower than 0.01 are not returned in the response.

note

Your workspace must have a trained model available, you can trigger this by clicking on Labeled data > Test within Studio. The model is available via the API as soon as the training process has completed