Abstract topics (Labs)
Abstract Topics help you quickly determine recurrent themes in a conversation.
For example:
-
Conversation about high-level topics, such as pricing, negotiation, and sales representative, can be abstracted to Sales.
-
Conversation about coughing, cold, fever, chills, chest pain, and so on, can be abstracted to Covid-19 Symptoms.
Note that Abstract Topics are not supported in real-time.
Authentication
Before using this API, you must generate your authentication token (AUTH_TOKEN
) as described in Authenticate.
To get abstract topics, you must first process your conversation using the Async API. After you process the conversation, pass the Conversation ID as a request parameter to the Get abstract topics request.
GET Abstract Topics request
GET https://api-labs.symbl.ai/v1/conversations/{conversationId}/abstract-topics
Example Abstract Topics request
curl "https://api-labs.symbl.ai/v1/conversations/{conversationId}/abstract-topics" \
-H "Authorization: Bearer $AUTH_TOKEN"
const request = require('request');
const authToken = AUTH_TOKEN;
const conversationId = CONVERSATION_ID;
request.get({
url: `https://api-labs.symbl.ai/v1/conversations/{conversationId}/abstract-topics`,
headers: { 'Authorization': `Bearer ${authToken}` },
json: true
}, (err, response, body) => {
console.log(body);
});
import requests
baseUrl = "https://api-labs.symbl.ai/v1/conversations/{conversationId}/abstract-topics"
conversationId = 'your_conversation_id' # Generated using Submit text end point
url = baseUrl.format(conversationId=conversationId)
# set your access token here. See https://docs.symbl.ai/docs/developer-tools/authentication
access_token = 'your_access_token'
headers = {
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/json'
}
responses = {
401: 'Unauthorized. Please generate a new access token.',
404: 'The conversation and/or it\'s metadata you asked could not be found, please check the input provided',
500: 'Something went wrong! Please contact [email protected]'
}
response = requests.request("GET", url, headers=headers)
if response.status_code == 200:
# Successful API execution
print("abstractTopics => " + str(response.json()['abstractTopics']))
elif response.status_code in responses.keys():
print(responses[response.status_code]) # Expected error occurred
else:
print("Unexpected error occurred. Please contact [email protected]" + ", Debug Message => " + str(response.text))
exit()
Example response
{
"abstractTopics": [
{
"id": "5631989198618624",
"text": "engineering research",
"type": "abstract_topic",
"score": 0.2639832934784889,
"messageIds": [],
},
{
"id": "5264144644177920",
"text": "deformation expansion",
"type": "abstract_topic",
"score": 0.2692850312948227,
"messageIds": [],
},
{
"id": "4734540816842752",
"text": "low thermal expansion",
"type": "abstract_topic",
"score": 0.7286796541154384,
"messageIds": [],
},
{
"id": "5911449097469952",
"text": "bipropellant rocket engine",
"type": "abstract_topic",
"score": 0.44802574345469476,
"messageIds": [],
},
{
"id": "5363486969298944",
"text": "isentropic expansion factor",
"type": "abstract_topic",
"score": 0.2692850312948227,
"messageIds": [],
},
{
"id": "6538251268521984",
"text": "expansion ratio",
"type": "abstract_topic",
"score": 0.4461310263156891,
"messageIds": [
"6151847678050304"
],
}
]
}
Response Parameters
Field | Description |
---|---|
id | Unique conversation identifier. |
text | The text of the Abstract Topic. |
type | Response type. Default is abstract_topic . |
score | Shows the abstraction % or coverage of the theme in the conversation. |
messageIds | Unique message identifiers of the corresponding messages. |
Updated over 1 year ago