Best practices for customer service quality inspection
This topic describes a best practice for customer service quality inspection using Tongyi Xiaomi CCAI-AIO conversation analysis.
Scenarios
You can use the quality inspection feature of Tongyi Xiaomi CCAI-AIO to analyze conversation records, such as text and audio files, between customer service agents and users. This process helps you identify service quality issues, improve agent efficiency and service standards, and enhance the customer experience.
Solution overview
You can perform service quality inspection with Tongyi Xiaomi CCAI-AIO conversation analysis by following these steps:
- Activate Alibaba Cloud Model Studio. You must activate this service before you can test the Playground, call models, or use the application experience service.
- Activate and create a Tongyi Xiaomi CCAI-AIO conversation analysis application. You can create the application in Alibaba Cloud Model Studio and obtain the credentials to call its API.
- Implement conversation analysis using the API. You can install the software development kit (SDK), provide the application information, conversation content, and quality inspection items to the API, and then perform the conversation analysis.
Solution architecture
Activate Alibaba Cloud Model Studio
To activate Alibaba Cloud Model Studio, see Activate the service.
Activate and create a Tongyi Xiaomi CCAI-AIO conversation analysis application
To activate Tongyi Xiaomi CCAI-AIO conversation analysis and create an application, see User guide.
Obtain an AccessKey ID and AccessKey secret
If you have not created an AccessKey ID and AccessKey secret, see Obtain an AccessKey and AgentKey.
If you use a RAM user to call the API, see Use a RAM user for Tongyi Xiaomi CCAI conversation analysis and grant permissions.
Obtain a Workspace ID and App ID
To obtain a Workspace ID and App ID, see Obtain an App ID and Workspace ID.
Install the SDK
Java
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>contactcenterai20240603</artifactId>
<version>3.6.4</version>
</dependency>
Code example
NoteTo ensure that the code runs correctly, replace YOUR_WORKSPACEID, YOUR_ACCESS_KEY_ID, YOUR_ACCESS_KEY_SECRET, and YOUR_APPID with your actual workspace ID, AccessKey ID, AccessKey secret, and app ID. To prevent key leakage, we recommend that you set the AccessKey ID and AccessKey secret as environment variables.
Synchronous non-streaming call
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.contactcenterai20240603.Client;
import com.aliyun.contactcenterai20240603.models.*;
import com.aliyun.teaopenapi.models.Config;
import java.util.*;
public class CcaiPaasTest {
public static void main(String[] args) throws Exception {
// Configure environment variables to prevent AccessKey pair leaks.
String accessKeyId = "YOUR_ACCESS_KEY_ID";
String accessKeySecret = "YOUR_ACCESS_KEY_SECRET";
String workspaceId = "YOUR_WORKSPACEID";
String appId = "YOUR_APPID";
Config config = new Config();
config.setAccessKeyId(accessKeyId).setAccessKeySecret(accessKeySecret).setEndpoint("contactcenterai.cn-shanghai.aliyuncs.com")
.setRegionId("cn-shanghai").setProtocol("HTTPS");
Client client = new Client(config);
AnalyzeConversationRequest request = new AnalyzeConversationRequest();
AnalyzeConversationRequest.AnalyzeConversationRequestDialogue dialogue = new AnalyzeConversationRequest.AnalyzeConversationRequestDialogue();
// Conversation content
List<AnalyzeConversationRequest.AnalyzeConversationRequestDialogueSentences> sentenceList = new ArrayList<>();
AnalyzeConversationRequest.AnalyzeConversationRequestDialogueSentences sentences1 = new AnalyzeConversationRequest.AnalyzeConversationRequestDialogueSentences();
sentences1.setRole("agent");
sentences1.setText("Hello, this is XXX Insurance Company. How can I help you?");
sentenceList.add(sentences1);
AnalyzeConversationRequest.AnalyzeConversationRequestDialogueSentences sentences2 = new AnalyzeConversationRequest.AnalyzeConversationRequestDialogueSentences();
sentences2.setRole("user");
sentences2.setText("Yes, I'd like to get a health insurance plan. Can you tell me what you have?");
sentenceList.add(sentences2);
dialogue.setSentences(sentenceList);
dialogue.setSessionId("session-adslsddxxxx");
request.setDialogue(dialogue);
AnalyzeConversationRequest.AnalyzeConversationRequestServiceInspection serviceInspection = new AnalyzeConversationRequest.AnalyzeConversationRequestServiceInspection();
List<AnalyzeConversationRequest.AnalyzeConversationRequestServiceInspectionInspectionContents> inspectionContents = new ArrayList<>();
// Define quality inspection items
AnalyzeConversationRequest.AnalyzeConversationRequestServiceInspectionInspectionContents content1 = new AnalyzeConversationRequest.AnalyzeConversationRequestServiceInspectionInspectionContents();
content1.setTitle("Did the agent overpromise?");
content1.setContent("Check whether the agent made excessive promises based on existing service standards during the customer service process. For example, if the fastest delivery time is 12 hours, the agent cannot promise a faster delivery time to the customer.");
inspectionContents.add(content1);
AnalyzeConversationRequest.AnalyzeConversationRequestServiceInspectionInspectionContents content2 = new AnalyzeConversationRequest.AnalyzeConversationRequestServiceInspectionInspectionContents();
content2.setTitle("Is the customer's sentiment positive?");
content2.setContent("Analyze the conversation content and output the user's sentiment. Requirements: a. If the customer shows negative emotions, the sentiment is negative. b. If the customer shows positive emotions, the sentiment is positive. c. If the customer's text has no obvious negative or positive emotional tone, the sentiment is neutral.");
inspectionContents.add(content2);
serviceInspection.setInspectionContents(inspectionContents);
serviceInspection.setInspectionIntroduction("Check for inappropriate agent behavior, such as overpromising or intentionally trying to obtain private customer information.");
serviceInspection.setSceneIntroduction("Insurance sales scenario");
request.setServiceInspection(serviceInspection);
// service_inspection indicates a service quality inspection task
request.setResultTypes(Arrays.asList("service_inspection"));
request.setStream(false);
com.aliyun.contactcenterai20240603.models.AnalyzeConversationResponse response = client.analyzeConversation(workspaceId, appId, request);
System.out.println(JSONObject.toJSONString(response));
}
}