CreateTask - Analyze conversations with Tongyi Xiaomi CCAI by uploading offline task data

Updated at:

Creates an offline asynchronous task for conversation analysis. Applications are called over HTTP.

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. Task data is retained on the server for 90 days.
    1. Conversation text is limited to 20,000 characters. Content beyond this limit is automatically truncated.
    1. An 8 kHz sample rate is recommended for audio files. Other sample rates affect the final results.

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.

Try it out

Authorization information

No authorization information is available for this API operation.

Request syntax

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

Request parameters

NameTypeRequiredDescriptionExample
workspaceIdstringNo

The workspace ID.

llm-ik******RVYCKzt
appIdstringNo

The application ID.

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

The request body.

dialogueobjectNo

The conversation content items.

sentencesarray<object>Yes

The conversation content.

objectNo

The conversation content.

rolestringYes

The speaker role.

  • user: customer
  • agent: customer service agent
  • system: system message
user
textstringYes

The conversation text.

How can I apply for a new card?
sessionIdstringNo

The customer service session ID (sessionId).

session-01
examplesobjectNo

An example instruction.

outputstringNo

An example output.

Issue: asked when version 2.2 will be released. Resolution: informed the customer.
sentencesarray<object>Yes

An example conversation.

objectYes

An example conversation.

rolestringYes

The speaker role.

  • user: customer
  • agent: customer service agent
  • system: system message
user
textstringYes

The conversation text.

When will it be updated?
fieldsarray<object>No

The field structure.

objectYes

The field structure.

codestringNo

The field code.

phoneNumber
descstringYes

The field description.

The reason for the customer call, such as a complaint, a question, or a policy suggestion.
enumValuesarray<object>No

The enumerated values.

objectYes

The enumerated values.

descstringYes

The description of the enumerated value.

The customer has a new requirement/new scenario, and the customer service agent follows up to discuss the details.
enumValuestringYes

The enumerated value.

New business expansion
namestringYes

The field name.

The call reason category.
modelCodestringYes

The model code.

tyxmTurbo
resultTypesarrayNo

The model processing type.

stringYes

summary: conversation summary; title: title generation; fields: field extraction; keywords: keyword extraction; service_inspection: service quality inspection; question_solution: issues and solutions; questions_and_answer: Q&A extraction; custom_prompt: custom instructions.

summary
serviceInspectionobjectNo

The service quality inspection structure.

inspectionContentsarray<object>Yes

The service quality inspection dimension structure.

objectYes

The service quality inspection dimension structure.

contentstringYes

The description of the service quality inspection dimension.

Whether the customer service agent makes promises beyond the established service standards. For example, if the earliest delivery time is 12 hours, the agent must not promise an earlier delivery.
titlestringYes

The name of the service quality inspection dimension.

Whether the customer service agent overpromises
inspectionIntroductionstringYes

The detailed description of the service quality inspection scenario.

Check whether the customer service agent behaves inappropriately, such as overpromising or deliberately eliciting customers' private information.
sceneIntroductionstringYes

The service quality inspection scenario.

Insurance sales
taskTypestringYes

The task type. audio: audio file. text: text.

text
templateIdsarrayNo

The template IDs.

stringYes

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

34
transcriptionobjectNo

The execution parameters for audio tasks.

autoSplitintegerNo

Specifies whether to automatically distinguish speakers in single-channel audio. 0: enable automatic recognition. 1: disable automatic recognition. Default: 1. Applies only to audio files with an 8 kHz sample rate.

1
clientChannelintegerNo

For dual-channel recordings, the channel number for the customer. Valid values: 0 and 1. Default: 1, which means channel 1 is the customer. Channels are typically numbered from 0, so a two-channel recording has channels 0 and 1. Confirm which channel contains the agent and which contains the customer. **When using this parameter, you must set autoSplit to 0.** This parameter is ignored for single-channel files.

1
fileNamestringYes

The file name.

sss.mp3
serviceChannelintegerNo

For dual-channel recordings, the channel number for the customer service agent. Valid values: 0 and 1. Default: 0, which means channel 0 is the agent. Channels are typically numbered from 0, so a two-channel recording has channels 0 and 1. Confirm which channel contains the agent and which contains the customer. **When using this parameter, you must set autoSplit to 0.** This parameter is ignored for single-channel files.

1
serviceChannelKeywordsarrayNo

Primarily for single-channel recordings, a list of distinctive keywords that the customer service agent may say. The transcription is analyzed sentence by sentence from beginning to end. If a sentence matches a keyword, that speaker is identified as the agent and the other speaker as the customer.

stringNo

Primarily for single-channel recordings, a list of distinctive keywords that the customer service agent may say. The transcription is analyzed sentence by sentence from beginning to end. If a sentence matches a keyword, that speaker is identified as the agent and the other speaker as the customer.

Hello
voiceFileUrlstringYes

The file URL.

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

The speech transcription model. Valid values: asr (small model) and paraformer (large model).

asr
levelstringNo

The speech transcription priority.

low
vocabularyIdstringNo

The speech hotword vocabulary ID.

esnvknv*****skdnvjksd
roleIdentificationbooleanNo

Specifies whether to automatically identify speaker roles. true: enable automatic identification. false: disable automatic identification. Default: false.

true
languageHintsstringNo

The recognition language. Default: Mandarin Chinese. For other supported languages and dialects, contact customer service.

zh
customPromptstringNo

The custom instruction.

Summarize the call.
variablesarray<object>No

The variables.

objectNo

The variables.

variableCodestringNo

The variable code.

name
variableValuestringNo

The variable value.

Zhang San
categoryTagsarray<object>No

The label categories.

objectNo

The label categories.

tagNamestringNo

The label name.

Agent overpromising
tagDescstringNo

The label description.

Whether the customer service agent makes promises beyond the established service standards.
responseFormatTypestringNo

The output format. jsonObject: JSON structure. text: raw string.

jsonObject
callBackUrlstringNo

The callback parameters used when the task is complete.

123.456.com/callback

Speech recognition parameters

When uploading an audio file, you must use serviceChannel or clientChannel to specify the channels for different roles. The backend service identifies roles by channel. Alternatively, use serviceChannelKeywords to set keywords from the agent's speech, and the backend service identifies roles by those keywords.

Callback parameters

If the callback URL passed in by the caller is http://aliyun.com/callback, the complete URL for the callback is http://aliyun.com/callback?taskId=xxx&amp;timestamp=xxx&amp;taskType=xxx&amp;signature=YOUR_SIGNATURE&amp;&amp;success=xxx, where:

  • taskId: the task ID.
  • timestamp: the timestamp of the call, in milliseconds.
  • taskType: the task type.
  • success: whether the task succeeded.
  • signature: the signature. The caller can use it to determine whether the request comes from Alibaba Cloud. Calculation: apply MD5 and then Base64 encoding to taskId=xxx&timestamp=xxx&aliUid=xxx in this exact order. When the callback arrives, taskId and timestamp can be obtained from the callback URL, and aliUid is the Alibaba Cloud primary account ID. Compare the signature you calculate with the signature in the URL to check whether they match. For details, see the following Java code example.
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.codec.binary.Base64;

public class Sample {

    public static void signature() {
        long timestamp = System.currentTimeMillis();
        String taskId = "xxx";
        String aliUid = "xxx";
        // 将 taskId=xxx&timestamp=xxx&aliUid=xxx 进行 md5 + base64 加密,放在 signature 字段
        String signature;
        try {
            signature = URLEncoder.encode(md5Base64("taskId=" + taskId + "&timestamp=" + timestamp + "&aliUid=" + aliUid), "utf-8");
            System.out.println(signature);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static String md5Base64(String str) throws NoSuchAlgorithmException {
        //string 编码必须为 utf-8
        byte[] utfBytes = str.getBytes(StandardCharsets.UTF_8);
        MessageDigest mdTemp = MessageDigest.getInstance("MD5");
        mdTemp.update(utfBytes);
        byte[] md5Bytes = mdTemp.digest();
        return Base64.encodeBase64String(md5Bytes);
    }
}

Response parameters

NameTypeDescriptionExample
object

Schema of Response

dataobject

The data.

taskIdstring

The task ID.

20240905-********-93E9-5D45-B4EF-045743A34071
requestIdstring

The request ID.

9F1DB065-AE0D-5EE3-B1AF-48632CB0831C
successstring

Indicates whether the request succeeded.

True

Examples

Sample success response

JSON format

{
  "data": {
    "taskId": "20240905-********-93E9-5D45-B4EF-045743A34071"
  },
  "requestId": "9F1DB065-AE0D-5EE3-B1AF-48632CB0831C",
  "success": "True"
}

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.
429Ccai.Throttling.QpsTrigger current QPS limit, pay API please buy higher QPS, free API if you have special requirements, please contact us through the DingTalk group (62730018475).Invalid error code; scheduled for removal.
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.