AnalyzeAudioSync
Analyzes conversations in audio files in real time. Applications send HTTPS requests to retrieve responses.
Operation description
Before using this API, review the billing methods and pricing for the Tongyi Xiaomi CCAI-Conversation Analysis AIO product.
Prerequisites
-
- Activate the Tongyi Xiaomi CCAI-Conversation Analysis AIO service.
-
- Create an application: create a Tongyi Xiaomi CCAI-Conversation Analysis AIO application in the Application Center and obtain the APP-ID and WORKSPACE-ID: Obtain the APP-ID and WORKSPACE-ID.
Notes
-
- Use offline tasks to analyze audio files longer than 3 minutes.
-
- Dual-channel recordings are currently supported, and you must specify the role for each channel.
Debug
You can run this API directly in OpenAPI Explorer without having to calculate signatures. After a successful run, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
No authorization information is exposed for the current API.
Request syntax
POST /{workspaceId}/ccai/app/{appId}/analyzeAudioSync HTTP/1.1
Request parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| workspaceId | string | Yes | The workspace ID. | llm-ik******RVYCKzt |
| appId | string | Yes | The application ID. | a070a49c681f4a95a0f0*********35c |
| body | object | No | The request body. | |
| modelCode | string | No | The model code. | tyxmTurbo |
| fields | array<object> | No | The structure of the fields. | |
| object | No | The structure of the fields. | ||
| code | string | No | The field code. | phoneNumber |
| name | string | No | The field name. | Reason for call type |
| desc | string | No | The field description. | Reason classification for the user's incoming call inquiry, mainly complaints, consultations, policy suggestions, etc. |
| enumValues | array<object> | No | The list of enumeration values. | |
| object | No | The list of enumeration values. | ||
| desc | string | No | The description of the enumeration value. | The customer has new requirements/new scenarios, and the customer service follows up to communicate the requirement details |
| enumValue | string | No | The enumeration value. | New business expansion |
| resultTypes | array | No | The task types. | |
| string | Yes | summary: conversation summary. title: title generation. fields: field information extraction. keywords: keyword extraction. service_inspection: service quality inspection. question_solution: problems and solutions. questions_and_answer: question and answer (QA) extraction. custom_prompt: custom instruction. | summary | |
| serviceInspection | object | No | The structure for service quality inspection. | |
| inspectionContents | array<object> | No | The list of inspection items. | |
| object | No | The structure of an inspection item. | ||
| content | string | No | The description of the inspection item. | During the process of serving the customer, whether the customer service has over-promised based on existing service standards, e.g., the fastest delivery time is 12 hours, and a faster delivery time cannot be promised to the customer. |
| title | string | No | The inspection name. | Whether the customer service over-promises |
| inspectionIntroduction | string | No | A detailed introduction and description of the service quality inspection scenario. | Please check whether the customer service has any improper behavior, including: over-promising, intentionally extracting customer privacy information, etc. |
| sceneIntroduction | string | No | The service quality inspection scenario. | Insurance sales scenario |
| templateIds | array | No | The template IDs. | |
| string | No | The template ID. If both a template ID and an instruction task type are specified, the template ID takes precedence. | 34 | |
| categoryTags | array<object> | No | The list of tag categorizations. | |
| object | No | The list of tag categorizations. | ||
| tagName | string | No | The tag name. | Customer service over-promise |
| tagDesc | string | No | The tag description. | During the process of serving the customer, whether the customer service has over-promised based on existing service standards |
| customPrompt | string | No | The custom instruction. | Summarize the call content |
| transcription | object | No | The runtime parameters for audio. | |
| autoSplit | integer | No | This parameter is typically used for single-channel recordings. Valid values are 0 and 1. A value of 1 indicates that automatic channel splitting is enabled. A value of 0 indicates that automatic channel splitting is disabled. Default value: 1. Setting this parameter to 1 treats the uploaded audio as a single-channel recording. Automatic channel splitting requires additional processing time. For dual-channel recordings, set this parameter to 0. | 1 |
| clientChannel | integer | No | This parameter is used for dual-channel recordings. It specifies the channel number for the customer role. Valid values are 0 and 1. Default value: 1, which means channel 1 is the customer. Audio channels are typically numbered starting from 0, so two channels are 0 and 1. Confirm whether channel 0 is the agent or the customer. **If you use this parameter, make sure that the autoSplit parameter is set to 0.** This parameter is ignored for single-channel files. | 1 |
| serviceChannel | integer | No | This parameter is used for dual-channel recordings. It specifies the channel number for the agent role. Valid values are 0 and 1. Default value: 0, which means channel 0 is the agent. Audio channels are typically numbered starting from 0, so two channels are 0 and 1. Confirm whether channel 0 is the agent or the customer. **If you use this parameter, make sure that the autoSplit parameter is set to 0.** This parameter is ignored for single-channel files. | 1 |
| fileName | string | Yes | The file name. | sss.mp3 |
| voiceFileUrl | string | Yes | The URL of the file. | http://1111.com/sss.mp3 |
| serviceChannelKeywords | array | No | The list of keywords for the agent channel. | |
| string | No | This parameter is typically used for single-channel recordings. Set a list of keywords that the agent is likely to say. Make sure to choose highly distinctive keywords. The system analyzes the transcript sentence by sentence. When a sentence contains a specified keyword, the speaker of that sentence is identified as the agent, and the other speaker is identified as the customer. | Hello | |
| asrModelCode | string | No | The speech-to-text model. Valid values: nls (small model) and paraformer (large model). | nls |
| vocabularyId | string | No | The ID of the hotword vocabulary. | esnvknv*****skdnvjksd |
| level | string | No | The priority of the speech-to-text task. | low |
| variables | array<object> | No | The list of variables. | |
| object | No | The list of variables. | ||
| variableCode | string | No | The variable code. | name |
| variableValue | string | No | The variable value. | Zhang San |
| responseFormatType | string | No | The format of the output. Valid values: jsonObject (JSON structure) and text (raw string). | jsonObject |
| stream | boolean | Yes | Specifies whether to return the result in a stream. Set to true for streaming output, or false for a complete response. | false |
API request examples
import com.alibaba.fastjson.JSONObject;
import com.aliyun.contactcenterai20240603.Client;
import com.aliyun.contactcenterai20240603.models.AnalyzeAudioSyncRequest;
import com.aliyun.contactcenterai20240603.models.AnalyzeAudioSyncResponse;
import com.aliyun.teaopenapi.models.Config;
import java.util.ArrayList;
import java.util.List;
public class CCAiTask {
public static void main(String[] args) throws Exception {
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);
AnalyzeAudioSyncRequest request = new AnalyzeAudioSyncRequest();
request.setStream(false);
request.setModelCode("tyxmPlus");
List<String> typeList = new ArrayList<>();
typeList.add("summary");
request.setResultTypes(typeList);
AnalyzeAudioSyncRequest.AnalyzeAudioSyncRequestTranscription transcription = new AnalyzeAudioSyncRequest.AnalyzeAudioSyncRequestTranscription();
transcription.setFileName("out**.wav");
transcription.setVoiceFileUrl("https://age***.com/out**.wav");
transcription.setServiceChannel(1);
transcription.setClientChannel(0);
request.setTranscription(transcription);
AnalyzeAudioSyncResponse response = client.analyzeAudioSync(workspaceId, appId, request);
System.out.println(JSONObject.toJSONString(response));
}
}
Response parameters
| Name | Type | Description | Example |
|---|---|---|---|
| object | Schema of Response | ||
| requestId | string | The request ID. | 968A8634-FA2C-5381-9B3E-*******F |
| finishReason | string | For streamed output, the value is null during content generation. When generation finishes, the value is stop if a stop token ends the process. | stop |
| success | boolean | Indicates whether the request was successful. | True |
| text | string | The result returned by the application. | This conversation appears to be a discussion between the customer service and the customer about a service or product, but the specific content is difficult to understand clearly because the language in the conversation is fragmented and abstract. |
| inputTokens | string | The number of input tokens. | 1000 |
| outputTokens | string | The number of output tokens. | 2000 |
| totalTokens | string | The total number of tokens. | 3000 |
Examples
Success response
JSON format
{
"requestId": "968A8634-FA2C-5381-9B3E-*******F",
"finishReason": "stop",
"success": true,
"text": "这段对话似乎是客服与客户之间关于一个服务或产品的讨论,但具体内容难以明确理解,因为对话中的言语比较零散和抽象。",
"inputTokens": 1000,
"outputTokens": 2000,
"totalTokens": 3000
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | CCAI.InvalidParam.NotExist | The specified parameter %s is not valid. | The request parameter does not exist. |
| 400 | CCAI.ParamInvalid.IllegalParamValue | The parameter value of the request API is illegal %s. | The parameter value of the request API is illegal. |
| 400 | CCAI.Throttling.Qpm | Trigger QPM flow restriction. Please purchase higher QPM for paid API. If free API has special requirements, please contact us through DingTalk group (62730018475). | Trigger QPM flow restriction. For paid APIs, purchase a higher QPM. If free APIs have special requirements, contact us through the DingTalk group (62730018475). |
| 400 | CCAI.Throttling.Qps | Trigger current QPS limit, pay API please buy higher QPS, the free API if you have special requirements, please contact us through the DingTalk group (62730018475). | Trigger flow restriction. For paid APIs, purchase a higher QPS. If free APIs have special requirements, contact us through the DingTalk group (62730018475). |
| 403 | CCAI.IllegalPermission.NoAuth | User not authorized to operate on the specified resource. | The user is not authorized to operate the specified resource |
| 403 | CCAI.ParamNotfound.MissParam | Parameter verification failed, The specified parameter %s is missing. | Parameter validation failed. The specified parameter is missing. |
| 403 | CCAI.TenantPermission.NoAuth | The current account does not have the permission to specify the business space. Please authorize the business space permission. | The current account does not have the permission to specify the business space. Please authorize the business space permission. |
| 500 | CCAI.InternalError | The request processing has failed due to some unknown error, exception or failure. | Internal system error. Try again later. |
See the Error Center for more error codes.