AnalyzeAudioSync

Updated at:

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

    1. Activate the Tongyi Xiaomi CCAI-Conversation Analysis AIO service.
    1. 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

    1. Use offline tasks to analyze audio files longer than 3 minutes.
    1. 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.

Debug

Authorization information

No authorization information is exposed for the current API.

Request syntax

POST /{workspaceId}/ccai/app/{appId}/analyzeAudioSync HTTP/1.1

Request parameters

NameTypeRequiredDescriptionExample
workspaceIdstringYes

The workspace ID.

llm-ik******RVYCKzt
appIdstringYes

The application ID.

a070a49c681f4a95a0f0*********35c
bodyobjectNo

The request body.

modelCodestringNo

The model code.

tyxmTurbo
fieldsarray<object>No

The structure of the fields.

objectNo

The structure of the fields.

codestringNo

The field code.

phoneNumber
namestringNo

The field name.

Reason for call type
descstringNo

The field description.

Reason classification for the user's incoming call inquiry, mainly complaints, consultations, policy suggestions, etc.
enumValuesarray<object>No

The list of enumeration values.

objectNo

The list of enumeration values.

descstringNo

The description of the enumeration value.

The customer has new requirements/new scenarios, and the customer service follows up to communicate the requirement details
enumValuestringNo

The enumeration value.

New business expansion
resultTypesarrayNo

The task types.

stringYes

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
serviceInspectionobjectNo

The structure for service quality inspection.

inspectionContentsarray<object>No

The list of inspection items.

objectNo

The structure of an inspection item.

contentstringNo

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.
titlestringNo

The inspection name.

Whether the customer service over-promises
inspectionIntroductionstringNo

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.
sceneIntroductionstringNo

The service quality inspection scenario.

Insurance sales scenario
templateIdsarrayNo

The template IDs.

stringNo

The template ID. If both a template ID and an instruction task type are specified, the template ID takes precedence.

34
categoryTagsarray<object>No

The list of tag categorizations.

objectNo

The list of tag categorizations.

tagNamestringNo

The tag name.

Customer service over-promise
tagDescstringNo

The tag description.

During the process of serving the customer, whether the customer service has over-promised based on existing service standards
customPromptstringNo

The custom instruction.

Summarize the call content
transcriptionobjectNo

The runtime parameters for audio.

autoSplitintegerNo

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
clientChannelintegerNo

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
serviceChannelintegerNo

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
fileNamestringYes

The file name.

sss.mp3
voiceFileUrlstringYes

The URL of the file.

http://1111.com/sss.mp3
serviceChannelKeywordsarrayNo

The list of keywords for the agent channel.

stringNo

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
asrModelCodestringNo

The speech-to-text model. Valid values: nls (small model) and paraformer (large model).

nls
vocabularyIdstringNo

The ID of the hotword vocabulary.

esnvknv*****skdnvjksd
levelstringNo

The priority of the speech-to-text task.

low
variablesarray<object>No

The list of variables.

objectNo

The list of variables.

variableCodestringNo

The variable code.

name
variableValuestringNo

The variable value.

Zhang San
responseFormatTypestringNo

The format of the output. Valid values: jsonObject (JSON structure) and text (raw string).

jsonObject
streambooleanYes

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

NameTypeDescriptionExample
object

Schema of Response

requestIdstring

The request ID.

968A8634-FA2C-5381-9B3E-*******F
finishReasonstring

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
successboolean

Indicates whether the request was successful.

True
textstring

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.
inputTokensstring

The number of input tokens.

1000
outputTokensstring

The number of output tokens.

2000
totalTokensstring

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 codeError codeError messageDescription
400CCAI.InvalidParam.NotExistThe specified parameter %s is not valid.The request parameter does not exist.
400CCAI.ParamInvalid.IllegalParamValueThe parameter value of the request API is illegal %s.The parameter value of the request API is illegal.
400CCAI.Throttling.QpmTrigger 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).
400CCAI.Throttling.QpsTrigger 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).
403CCAI.IllegalPermission.NoAuthUser not authorized to operate on the specified resource.The user is not authorized to operate the specified resource
403CCAI.ParamNotfound.MissParamParameter verification failed, The specified parameter %s is missing.Parameter validation failed. The specified parameter is missing.
403CCAI.TenantPermission.NoAuthThe 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.
500CCAI.InternalErrorThe 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.