UploadDataSyncForLLM

Updated at:

Performs real-time text quality inspection using a large language model.

Operation description

Pushes text data in a specific format to Smart Conversation Analysis (SCA) for real-time quality inspection based on user-specified rules, and synchronously returns the analysis results. Compared with uploaded text quality inspection, which typically uploads the complete conversation text after a conversation ends, real-time text quality inspection allows you to push text to SCA for analysis after one or more sentences are spoken by a role, providing higher real-time performance. Special notes:

If the pushed text is a single sentence from one role, some operators in the rules may not work due to the lack of conversation context, such as context repetition check, interruption check, and call silence check. Real-time quality inspection synchronously returns analysis results. SCA does not save call records, so you cannot query quality inspection results through APIs.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

JsonStr

string

Yes

The complete JSON string. For more information, see the following details.

{\"tickets\":[{\"dialogue\":[{\"role\":\"Agent\",\"words\":\"Yes\",\"end\":0,\"beginTime\":1783909236618,\"begin\":0}],\"tid\":\"20260713-20240612032225161783909236618\"}],\"commonRuleIds\":[\"20773\"]}

BaseMeAgentId

integer

No

The business space ID.

123456

jsonStr property description:

PropertyValue typeRequiredDescription
ticketsListYesThe text data to be inspected. You can upload multiple text segments in a single call. For more information, see tickets property description below.
commonRuleIdsListNoThe specified rule IDs. If not specified, all rules are used for analysis. If the total number of rules exceeds 100, only the first 100 rules in the rule list are used. We strongly recommend that you specify quality inspection rules. Otherwise, using a large number of rules for each analysis increases the response latency.
isSimpleLlmResponseFormatBooleanNoSpecifies whether to simplify the large language model output. When set to true, the results contain only the dimension name and whether it is hit.

tickets property description:

PropertyValue typeRequiredDescription
tidStringYesThe ID of this text segment. You can use the corresponding phone call or ticket data ID. Make sure the value is unique.
dialogueListYesThe detailed content of this text conversation. For more information, see dialogue property description below.

dialogue property description:

PropertyValue typeRequiredDescription
roleStringYesThe role in the conversation. Valid values: Agent and Customer.
identityStringNoThe specific identity of the conversation role.
wordsStringYesThe sentence spoken by this role.
beginIntegerYesThe start time of this sentence, which is the offset from the starting point in milliseconds.
endIntegerYesThe end time of this sentence, which is the offset from the starting point in milliseconds.
beginTimeDateYesThe start time of this sentence. Example: 2019-11-25 15:37:16.

Response elements

Element

Type

Description

Example

object

Code

string

The result code. A value of 200 indicates success. Other values indicate failure. You can use this field to determine the cause of failure.

200

Message

string

The error message if the request fails. The value is successful if the request succeeds.

successful

RequestId

string

The request ID.

3CEA0495-341B-4482-9AD9-8191EF4***

Success

boolean

Indicates whether the request was successful. Valid values: true: The request was successful. false/null: The request failed.

true

Data

object

ResultInfo

array<object>

The real-time quality inspection results.

array<object>

The quality inspection results.

Score

integer

The quality inspection score. The default value is 100. Points are added or deducted based on the scoring items associated with the rules.

16

Rules

object

RuleHitInfo

array<object>

The rule hit details.

array<object>

The rule list.

Tid

string

The text ID, which corresponds to the tid in the tickets request parameter.

79127

Rid

string

The ID of the hit rule.

25372

Name

string

The rule name.

Profanity detection

Hit

object

ConditionHitInfo

array<object>

The specific hit position information. At the sentence level, this returns which condition of which rule was hit in the hit sentence and which characters triggered the hit.

array<object>

HitKeyWords

object

HitKeyWord

array<object>

The characters in the current sentence that hit the rule, which are the keywords that need to be highlighted.

object

The keywords hit by the condition.

To

integer

The ending character position (exclusive) of the keyword to be highlighted. The maximum value is the total number of characters in the sentence minus 1. The highlighted text does not include the character at the To position. For example, if the sentence is "I cannot process your refund" and from=0 and to=8, the highlighted keyword is "I cannot".

1

From

integer

The starting character position of the keyword to be highlighted. The value starts from 0, and the maximum value is the total number of characters in the sentence minus 1. The highlighted text includes the character at the From position.

1

Val

string

The specific keyword content.

good

Tid

string

The text ID, which corresponds to the tid in the tickets request parameter.

1

Pid

integer

The index of the current sentence among all sentences, indicating the position of the current sentence in the dialogue array of the request parameters. The value starts from 0.

1

CustomizeCode

string

The quality inspection item name.

Uncivilized language detection

IsMatch

boolean

Indicates whether the keyword is matched.

true

HitCids

object

CidItem

array

The list of condition IDs hit by the current sentence.

string

The list of condition IDs hit by the current sentence.

["3265"]

Phrase

object

The details of the sentence with rule hits.

Words

string

The sentence spoken by this role.

hello

Identity

string

The specific identity of the conversation role.

1

Begin

integer

The start time of this sentence, which is the offset from the starting point in milliseconds.

0

BeginTime

string

The start time of this sentence. Example: 2019-11-25 15:37:16.

1742350336950

End

integer

The end time of this sentence, which is the offset from the starting point in milliseconds.

2090

Role

string

The role in the conversation. Valid values: Agent, Customer, and System.

Agent

ConditionInfo

object

ConditionBasicInfo

array<object>

Deprecated field. Ignore this field.

object

Deprecated field. Ignore this field.

ConditionInfoCid

string

Deprecated field. Ignore this field.

1

TyxmTurboCount

string

The number of times the turbo model is used.

1

TyxmPlusCount

string

The number of times the plus model is used.

1

Examples

Success response

JSON format

{
  "Code": "200",
  "Message": "successful",
  "RequestId": "3CEA0495-341B-4482-9AD9-8191EF4***\t",
  "Success": true,
  "Data": {
    "ResultInfo": [
      {
        "Score": 16,
        "Rules": {
          "RuleHitInfo": [
            {
              "Tid": "79127",
              "Rid": "25372",
              "Name": "Profanity detection",
              "Hit": {
                "ConditionHitInfo": [
                  {
                    "HitKeyWords": {
                      "HitKeyWord": [
                        {
                          "To": 1,
                          "From": 1,
                          "Val": "good",
                          "Tid": "1",
                          "Pid": 1,
                          "CustomizeCode": "Uncivilized language detection",
                          "IsMatch": true
                        }
                      ]
                    },
                    "HitCids": {
                      "CidItem": [
                        "[\"3265\"]"
                      ]
                    },
                    "Phrase": {
                      "Words": "hello",
                      "Identity": "1",
                      "Begin": 0,
                      "BeginTime": "1742350336950",
                      "End": 2090,
                      "Role": "Agent"
                    }
                  }
                ]
              },
              "ConditionInfo": {
                "ConditionBasicInfo": [
                  {
                    "ConditionInfoCid": "1"
                  }
                ]
              }
            }
          ]
        },
        "TyxmTurboCount": "1",
        "TyxmPlusCount": "1"
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.