CreateVocab
Uploads a set of hotwords to the server and returns a vocabulary ID.
Operation description
Before using this API, make sure that you fully understand the billing methods and pricing of the Tongyi Xiaomi CCAI-Conversation Analysis AIO product.
Prerequisites
- You have activated the Tongyi Xiaomi CCAI-Conversation Analysis AIO service.
- You have created an application: create a Tongyi Xiaomi CCAI-Conversation Analysis AIO application in the Application Center and obtain the APP-ID and WORKSPACE-ID: Obtain an APP-ID and a WORKSPACE-ID.
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 available for this API operation.
Request syntax
POST /vocab/createVocab HTTP/1.1
Request parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| body | object | No | The request body. | |
| workspaceId | string | Yes | The workspace ID. | llm-9****me1 |
| name | string | Yes | The name. | Vocabulary 1 |
| description | string | No | The version description. | Sales vocabulary |
| audioModelCode | string | No | The speech-to-text model. | nls |
| wordWeightList | array<object> | Yes | The hot word group. | |
| object | Yes | |||
| weight | integer | Yes | The weight value. | 2 |
| word | string | Yes | The word. | Tree |
Request parameter limits
- You can create a maximum of 10 vocabularies by default.
- Each vocabulary can contain up to 500 words. Each word can be up to 10 characters long.
- Custom hot words must use UTF-8 encoding and cannot contain punctuation or special characters.
- The weight of a custom word must be an integer from -6 to 5.
- A value greater than 0 increases the probability that the word is recognized. A value less than 0 decreases the probability.
- A value of -6 indicates that the system should avoid recognizing the word.
- A value of 2 is a common value.
- If the effect is not significant, you can increase the weight. However, a large weight may cause negative effects and lead to inaccurate recognition of other words.
API request examples
import com.alibaba.fastjson.JSONObject;
import com.aliyun.contactcenterai20240603.Client;
import com.aliyun.contactcenterai20240603.models.CreateVocabRequest;
import com.aliyun.contactcenterai20240603.models.CreateVocabResponse;
import com.aliyun.teaopenapi.models.Config;
import java.util.ArrayList;
import java.util.List;
public class Vocab {
private static String accessKeyId = "YOUR_ACCESS_KEY_ID";
private static String accessKeySecret = "YOUR_ACCESS_KEY_SECRET";
private static String workspaceId = "YOUR_WORKSPACE_ID";
private static Config config = new Config();
static {
config.setAccessKeyId(accessKeyId).setAccessKeySecret(accessKeySecret).setEndpoint("contactcenterai.cn-shanghai.aliyuncs.com")
.setReadTimeout(30000).setConnectTimeout(300000).setRegionId("cn-shanghai").setProtocol("HTTPS");
}
public static void main(String[] args) throws Exception {
Client client = new Client(config);
CreateVocabRequest request = new CreateVocabRequest();
request.setName("Sales Vocabulary");
request.setDescription("For sales in Northeast China Region 1");
request.setWorkspaceId(workspaceId);
List<CreateVocabRequest.CreateVocabRequestWordWeightList> wordWeightList = new ArrayList<>();
CreateVocabRequest.CreateVocabRequestWordWeightList word1 = new CreateVocabRequest.CreateVocabRequestWordWeightList();
word1.setWord("Children");
word1.setWeight(3);
wordWeightList.add(word1);
CreateVocabRequest.CreateVocabRequestWordWeightList word2 = new CreateVocabRequest.CreateVocabRequestWordWeightList();
word2.setWord("Metal");
word2.setWeight(3);
wordWeightList.add(word2);
request.setWordWeightList(wordWeightList);
CreateVocabResponse response = client.createVocab(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 |
| success | string | Indicates whether the call was successful. | True |
| data | object | The returned data. | |
| vocabularyId | string | The vocabulary ID. | f3d82*******7 |
Examples
Success response
JSON format
{
"requestId": "968A8634-FA2C-5381-9B3E-*******F",
"success": "True",
"data": {
"vocabularyId": "f3d82*******7"
}
}
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.