Intent
The Intent Analysis model will help you capture semantics behind users' messages and assign it to the right label. It is designed to understand human conversation in the form or free text or spoken text.
Keys | Value |
modelType | intent_analysis |
modelConfig | Model Configuration object for intent_analysis - the intent ids to be used for intent recognition |
Curl
Python
curl --location --request POST 'https://api.marsview.ai/cb/v1/conversation/compute' \
--header 'Content-Type: application/json' \
--header "Authorization: {{Insert Auth Token}}" \
--data-raw '{
"txnId": "{{Insert txn ID}}",
"enableModels":[
{
"modelType":"speech_to_text",
"modelConfig":{
"automatic_punctuation" : true,
"custom_vocabulary":["Marsview", "Communication"],
"speaker_seperation":{
"num_speakers":2
},
"enableKeywords":true,
"enableTopics":false
}
},
{
"modelType": "intent_analysis",
"modelConfig": {
"config": {
"intents": [
"intent-1c6q62hzkxim6ect-1640242740269",
"intent-1c6q62hzkxim9q8o-1640242895640"
]
}
}
}
]
}'
import requests
auth_token = "replace this with your auth token"
txn_id = "Replace this with your txn id"
request_url = "https://api.marsview.ai/cb/v1/conversation/compute"
def get_intents():
payload={
"txnId": txn_id,
"enableModels":[
{
"modelType":"speech_to_text",
"modelConfig":{
"automatic_punctuation" : True,
"custom_vocabulary":["Marsview", "Communication"],
"speaker_seperation":{
"num_speakers":2
},
"enableKeywords":True,
"enableTopics":False
}
},
{
"modelType": "intent_analysis",
"modelConfig": {
"config": {
"intents": [
"intent-1c6q62hzkxim6ect-1640242740269",
"intent-1c6q62hzkxim9q8o-1640242895640"
]
}
}
}
]
}
headers = {'authorization': '{}'.format(auth_token)}
response = requests.request("POST", headers=headers, json=payload)
print(response.text)
if response.status_code == 200 and response.json()["status"] == "true":
return response.json()["data"]["enableModels"]["state"]["status"]
else:
raise Exception("Custom exception")
if __name__ == "__main__":
get_intents()
"data": {
"sentiment": [
{
"startTime": 1390,
"endTime": 2690,
"speakers": [
"1"
],
"similarityMatch": [
{
"matchedTextList": [
{
"score": 0.6180883955955505,
"text": "Marsview is a great place to work",
"value": "Marsview"
}
],
"intentId": "intent-bxllq2f7hpkrvtyzi3-1627981197627",
"intentName": "Marsview"
},
],
"phraseMatch": [
{
"matchedTextList": [
{
"score": 0.6180883955955505,
"text": "Marsview is a great place to work",
"value": "Marsview"
}
],
"intentId": "intent-bxllq2f7hpkrvtyzi3-1627981197627",
"intentName": "Marsview"
},
],
"sentence": "Marsview is a great place to work"
},
]
}
Field | Description |
---|---|
startTime | Start time of the sentence in the input Video/Audio in milliseconds. |
endTime | End time of the sentence in the input Video/Audio in milliseconds. |
speakers | A list of speaker id's whose voices are identified for a given time frame. Normally this list would only have a single speaker Id. |
similarityMatch | The intent similarity output from the models |
phraseMatch | The phrase match output from the models |
intentId | The intent Id against which the sentences are matched |
intentName | The name of the matching intent |
score | The similarity matching score ranges from 0 to 1 |
text | The sentence which is used to predict intent for |
value | The predicted intent |
sentence | A sentence identified by the model in the given time frame. |
Last modified 1yr ago