Understand

This endpoint can used to understand user statement. The endpoint will return matched intent and identified entities along with the confidence.

Request

Url: http://api.morph.ai/v1/nlUnderstander/understand

Method: POST

Header

If you don't have access token you can get from here.

Authorization: ACCESS TOKEN  
Content-Type: application/json

Body

{
    "query":"find golf shoes between 10 and 100"
}

Response

{
  "Status": {
    "code": 200,
    "errorCode": "SUCCESS"
  },
  "result": {
    "intentId": "587ca8d640362d221fb0bbd0",    //id of the matched intent
    "intentName": "service_productSearch",    //name of the matched intent
    "confidence": 1,    //confidence score for this matching
    "params": {    //contain all the entities
      "fromPrice": "10.0",    //Entity Name: Entity Value
      "toPrice": "100.0",
      "title": "golf shoes"
    }
  },
  "matchStat": "Intent matched."    //Matching status
}

Here is the matched intent on app:

Here is the matched intent on app:

Training

You can train understander from Morph Platform.

We also have apis for training, if you have requirement where you need to train understander via API , please contact us.

Example

Here is a example call you can make to test the api. To make a sample call use following access token: DUMMY_AI_UNDERSTANDER_ACCESS_TOKEN.

Note: Sample Access Token have strict rate limits 0.2QPS

curl -H "Authorization:ACCESS_TOKEN" -H "Content-Type:application/json" http://api.morph.ai/v1/nlUnderstander/understand -d '{"query":"find leather journal between 10 and 100 from creativeus2"}'

# Response

{"Status":{"code":200,"errorCode":"SUCCESS"},"result":{"intentId":"5870999840362d6192d5856a","intentName":"service_productSearch","confidence":1.0,"params":{"fromPrice":"10.0","vendor":"creativeus2","toPrice":"100.0","title":"leather journal"}},"matchStat":"Intent matched."}
POST /v1/nlUnderstander/understand HTTP/1.1
Host: api.morph.ai
User-Agent: curl/7.49.1
Accept: */*
Authorization:DUMMY_AI_UNDERSTANDER_ACCESS_TOKEN
Content-Type:application/json
Content-Length: 68

* Response

HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache, no-transform, max-age=0
Content-Length: 275
Server: Jetty(9.3.1.v20150714)

{"Status":{"code":200,"errorCode":"SUCCESS"},"result":{"intentId":"5870999840362d6192d5856a","intentName":"service_productSearch","confidence":1.0,"params":{"fromPrice":"10.0","vendor":"creativeus2","toPrice":"100.0","title":"leather journal"}},"matchStat":"Intent matched."}
import json
import requests

url = 'http://api.morph.ai/v1/nlUnderstander/understand'
payload = {
    "query": "find leather journal between 10 and 100 from creativeus2"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "DUMMY_AI_UNDERSTANDER_ACCESS_TOKEN"
}

r = requests.post(url, data=json.dumps(payload), headers=headers)

print(r.content)
# {"Status":{"code":200,"errorCode":"SUCCESS"},"result":{"intentId":"5870999840362d6192d5856a","intentName":"service_productSearch","confidence":1.0,"params":{"fromPrice":"10.0","vendor":"creativeus2","toPrice":"100.0","title":"leather journal"}},"matchStat":"Intent matched."}

results matching ""

    No results matching ""