Caller and callee intent recognition for telesales
The caller and callee intent recognition service identifies intents in outbound telesales calls. It analyzes conversations to detect the caller's intent, such as marketing or debt collection, and the callee's intent, such as unavailability, sentiment, or willingness to communicate. You can use this service for voice quality inspection.
This service is provided by the NLP Self-Learning Platform. Call the API directly to use the service.
Service activation and resource plan purchase
Before you start, ensure that the service is activated. After activation, you must purchase a resource plan.
Service activation: Activation page
Resource plan purchase: Purchase page
Service invocation and testing
For more information about how to invoke the model, see Model invocation.
For software development kit (SDK) examples, see SDK examples.
Debug
Configure access credentials (AKSK) using environment variables
Notes:
An AccessKey pair for an Alibaba Cloud account has permissions to access all APIs. This poses a high security threat. For better security, we recommend that you create and use a Resource Access Management (RAM) user to make API calls or perform routine O&M. To create a RAM user, log on to the RAM console.
Do not hard-code your AccessKey ID and AccessKey secret in your code. This practice poses a security risk if the keys are leaked. Instead, store your AccessKey pair in environment variables.
Configuration for Linux and macOS
export NLP_AK_ENV=<access_key_id> export NLP_SK_ENV=<access_key_secret>Replace <access_key_id> with your AccessKey ID and <access_key_secret> with your AccessKey secret. For more information about how to obtain an AccessKey ID and an AccessKey secret, see Step 2: Obtain an AccessKey pair.
Configuration method for Windows
Create a file for the environment variables. In the file, add the
NLP_AK_ENVenvironment variable for your AccessKey ID and theNLP_SK_ENVenvironment variable for your AccessKey secret.Restart your Windows system.
Java code example
class MsgDO{
private String role;
private String words;
public MsgDO(String role,String words) {
this.role = role;
this.words = words;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getWords() {
return words;
}
public void setWords(String words) {
this.words = words;
}
}
/**
* An AccessKey pair of an Alibaba Cloud account has permissions to access all APIs. This poses a high security threat. We strongly recommend that you create and use a RAM user to make API calls or perform routine O&M. To create a RAM user, log on to the RAM console.
* This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
* To prevent security risks, do not hard-code your AccessKey ID and AccessKey secret in your code.
*/
String accessKeyId = System.getenv("NLP_AK_ENV");
String accessKeySecret = System.getenv("NLP_SK_ENV");
DefaultProfile defaultProfile = DefaultProfile.getProfile("cn-hangzhou",accessKeyId,accessKeySecret);
IAcsClient client = new DefaultAcsClient(defaultProfile);
Map<String, Object> obj = new HashMap<String, Object>();
List<MsgDO> msgs = new ArrayList<MsgDO>();
msgs.add(new MsgDO("callee","Hello."));
msgs.add(new MsgDO("caller","Hey, hello, ma'am. Sorry to bother you. I have factory buildings available. Are you looking to buy a property?"));
obj.put("msgs",msgs);
obj.put("session_id",123);
RunPreTrainServiceRequest request = new RunPreTrainServiceRequest();
request.setServiceName("dialog_intent");
request.setPredictContent(JSON.toJSONString(obj));
RunPreTrainServiceResponse response = client.getAcsResponse(request);
System.out.println(response.getPredictResult());Python code example
# Install dependencies
pip install aliyun-python-sdk-core
pip install aliyun-python-sdk-nlp-automl
* An AccessKey for an Alibaba Cloud account provides full access to all APIs and poses a high security risk. We strongly recommend that you log on to the RAM console to create and use a RAM user for API access or daily operations and maintenance (O&M).
* This example stores the AccessKey and AccessKey secret in an environment variable. Alternatively, you can store them in a configuration file to suit your business needs.
* We strongly recommend that you do not embed your AccessKey and AccessKey secret in your code to avoid the security risk of key leakage.
# An AccessKey pair of an Alibaba Cloud account has permissions to access all APIs. This poses a high security threat. We strongly recommend that you create and use a RAM user to make API calls or perform routine O&M. To create a RAM user, log on to the RAM console.
# This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
# To prevent security risks, do not hard-code your AccessKey ID and AccessKey secret in your code.
# -*- coding: utf-8 -*-
import json
import os
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdknlp_automl.request.v20191111 import RunPreTrainServiceRequest
# An AccessKey pair of an Alibaba Cloud account has permissions to access all APIs. This poses a high security threat. We strongly recommend that you create and use a RAM user to make API calls or perform routine O&M. To create a RAM user, log on to the RAM console.
# This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
# To prevent security risks, do not hard-code your AccessKey ID and AccessKey secret in your code.
access_key_id = os.environ['NLP_AK_ENV']
access_key_secret = os.environ['NLP_SK_ENV']
# Initialize the AcsClient instance
client = AcsClient(
access_key_id,
access_key_secret,
"cn-hangzhou"
);
content = {
"session_id": 123,
"msgs":[
{
"role": "callee",
"words": "Hello."
},
{
"role": "caller",
"words": "Hey, hello, ma'am. Sorry to bother you. I have factory buildings available. Are you looking to buy a property?"
}
]
}
# Initialize a request and set its parameters
request = RunPreTrainServiceRequest.RunPreTrainServiceRequest()
request.set_ServiceName("dialog_intent")
request.set_PredictContent(json.dumps(content))
# Print the response
response = client.do_action_with_exception(request)
resp_obj = json.loads(response)
predict_result = json.loads(resp_obj['PredictResult'])
print(predict_result)PredictContent example
{
"session_id": 123,
"msgs": [
{
"role": "callee",
"words": "Hello."
},
{
"role": "caller",
"words": "Hey, hello, ma'am. Sorry to bother you. I have factory buildings available. Are you looking to buy a property?"
}
]
}PredictResult example
{
"result": [
{
"callee_intent": [{
"label": "callee-incomplete_dialog", "prob": 0.928
}],
"caller_intent": [{
"label": "caller-marketing", "prob": 0.9939
}]
}
],
"cost": "77.88ms",
"code": "SUCCESS"
}Request parameters
Parameter | Description |
msgs | The conversation content. This parameter is required. |
role | The role of the speaker. Valid values are caller (or agent) and callee (or customer). |
words | The content spoken by the speaker. |
Response parameters
Parameter | Description |
result | The intent recognition result. The result includes the caller intent and the callee intent. It is returned as a list of tuples that contain a label and a probability (prob). For more information, see the following table. |
code | The query status. SUCCESS indicates a successful query. INVALID_INPUT_FORMAT indicates an invalid input format. FIELD_MISSING indicates that a required field is missing. INVALID_TEXT_VALUE indicates that the msgs field has no valid value. |
cost | The time taken for the query. |
Intent types
Role type | Intent | Description |
Caller | caller-marketing | |
caller-production_service-captcha | ||
caller-production_service-notification | ||
caller-production_service-collection | ||
Caller - Production Service - Other Production Services | Other production services that are not Captcha, notification, or collection. | |
caller-customer_service-follow_up | ||
caller-customer_service-survey | ||
caller-customer_service-medical_consultation | ||
Caller > Customer Service > Other Customer Service | Other customer services that are not follow-up, survey, or medical consultation. | |
caller-no_speech | ||
caller-unknown_intent | Does not belong to any of the preceding caller intents. | |
Callee | callee-incomplete_dialog | The call was interrupted and the conversation is incomplete. |
callee-on_another_call | ||
callee-not_interested | ||
callee-do_not_call_again | ||
callee-wrong_number | ||
callee-no_speech | ||
callee-voicemail | ||
callee-unreachable | ||
callee-low_willingness_to_communicate | ||
callee-high_willingness_to_communicate | ||
callee-no_willingness_to_communicate | ||
callee-negative_sentiment | ||
callee-positive_sentiment | ||
callee-neutral_sentiment | ||
callee-unknown_intent | Does not belong to any of the preceding callee intents. |