Live Chat Translation API Reference

GET/POST /ai/chat/translation/and/polishment

The Live Chat Translation is specifically developed for multi-language conversation scenarios in the e-commerce field, achieving accurate translation among 33 different languages. It leverages e-commerce-specific data training to enhance translation quality and is equipped with custom intervention features, providing efficient multi-language market expansion solutions for e-commerce platforms and developers.

Request Parameters

ParameterTypeRequiredDescription

sourceTextList

String[]

Yes

Text need to be translated;The list is recommend less than 50.

Sample:¿Cómo puedo obtener un reembolso?", "¿Qué puedo hacer por ti?

sourceLanguage

String/String[]

Yes

Source language code;Uses ISO 693-1 Language code.For example, th language code of "English"is "en","Chinese" is "zh". upported language pairs can be found in the following list of supported languages.

When there are multiple source languages, only one non-English source language plus English is supported. The product will automatically recognize between the input non-English and English.For example[en,es]

Sample:es

targetLanguage

String

Yes

Target language code;Uses ISO 693-1 Language code. Please select from the following supported language pairs for input parameters. Supported target languages can be found in the following list of supported language pairs.

Sample:de

formatType

String

Yes

The format of source text;Now text/html format are supported. Sample:text

glossary

String

No

Intervention glossary id; The intervention glossary needs to be created separately, and its ID should be provided in the input parameters. Multiple intervention glossaries can be passed in. If the intervention glossary ID provided is empty, there will be no intervention in the translation results.

Sample:translation_glossary

extension

Object

No

Extension

Sample Request

IopClient client = new IopClient(url, appkey, appSecret);
IopRequest request = new IopRequest();
request.setApiName("/ai/chat/translation/and/polishment");
request.addApiParameter("sourceTextList", "[\"¿Cómo puedo obtener un reembolso?\",\"¿Qué puedo hacer por ti?\"]");
request.addApiParameter("sourceLanguage", "es");
request.addApiParameter("targetLanguage", "en");
request.addApiParameter("formatType", "text");
request.addApiParameter("glossary", "test_glossory");
request.addApiParameter("extension", "{}");
IopResponse response = client.execute(request);
System.out.println(response.getBody());
Thread.sleep(10);

Response Parameters

ParameterTypeDescription

resCode

Number

The returned result code, where 200 indicates success. For detailed error codes, please refer to the error code list.

data

Object

The returned result data.

data.usage

Number

The number of translation character.

data.translated

String[]

The result of translation.

data.detectedLanguage

String[]

The result of language recognization.

requestId

String

Request ID;Used to identify a unique request invocation.

success

Boolean

Whether is successful. True is successful and false is fail.

resMessage

String

The returned request information. For example,"content has sensitive data, please try other input".

Sample Response

{
  "data": {
    "usage": 57,
    "translated": [
      "How can I get a refund?",
      "What can I do for you?"
    ],
    "class": "com.aidc.service.api.client.translate.dto.CommonTranslationResponse"
  },
  "requestId": "21413d5a17193029202356783eb7e5",
  "success": true,
  "resCode": 200,
  "resMessage": "success",
  "code": "0",
  "request_id": "21410ad417193029202356958",
  "_trace_id_": "21413d5a17193029202356783eb7e5"
}

Errors

Error CodeError MessageDescription

501

rate limit exceed

The current interface has reached the current limit. Please contact us via navigation bar or email us (aidge_support@service.alibaba.com) to increase the current limit value.

700

invalid input

The format of the input parameters does not meet the requirements, and resMessage will return detailed fields that do not meet the requirements.

801

model failed

Internal call exception, please contact us via navigation bar or email us (aidge_support@service.alibaba.com) for troubleshooting.

1000

content has sensitive data, please try other input

Content has sensitive data and cannot be handled now. Please try other input.

1001

content control failed, please retry

Content has sensitive data, please try other input. If an error persists, please contact us via navigation bar or email us (aidge_support@service.alibaba.com).

1002

content risk filter failed, please contact us

Content control failed, please contact us via navigation bar or email us (aidge_support@service.alibaba.com).

1007

text language is not supported

The language pais are not supported,please input supported language code.

1008

text length exceeds the limit

The text length exceeds the limit.

Last updated