Updated on 2023-09-27 GMT+08:00

Semantic Recognition Interface

Description

This interface is invoked to obtain the matching status of an intention template.

Interface Method

POST

URL

https://IP:PORT/oifde/rest/api/speechrecognition

Request

Table 1 Parameters in the request body

Parameter

Type

Position

Mandatory

Description

userId

String

Body

Yes

User ID.

The value can contain a maximum of 64 characters.

sentence

String

Body

Yes

Text information entered by a customer.

The value can contain a maximum of 1024 characters.

tenantId

String

Body

Yes

Tenant ID.

The value can contain a maximum of 64 characters.

language

String

Body

Yes

Language. The options are as follows:

  • zh_CN: Chinese
  • en_US: English
  • es_ES: Spanish
  • ar: Arabic
  • th_TH: Thai
  • pt_BR: Portuguese
  • fr_FR: French

targetIntentCount

String

Body

No

Number of intentions returned by the chatbot when multiple intentions are required. Generally, this parameter is used when a customer enters one sentence to match multiple intentions.

The value ranges from 1 to 5.

confidence2Top

String

Body

No

Confidence interval between the subsequent intentions and the first intention with the highest confidence is required if multiple intentions are returned. A smaller value indicates a closer proximity between the returned intentions.

The value ranges from 0 to 1.

context

String

Body

No

Context required for intention recognition. Only one context can be transferred.

To use the context, configure a single context based on the intention.

The value can contain a maximum of 128 characters.

domainList

List <String>

Body

No

IDs of activated domains.

A maximum of 100 IDs are allowed.

faqGroupList

List <String>

Body

No

IDs of activated FAQ groups.

A maximum of 100 IDs are allowed.

authToken

String

Body

Yes

Valid token value for accessing the interface.

You can obtain the valid token information by invoking the interface for obtaining tokens.

For details, see C3 OIAP Interface Authentication.

The value can contain a maximum of 32 characters.

Response

Table 2 Parameters in the response body

Parameter

Type

Position

Mandatory

Description

errorCode

Integer

Body

Yes

Error code.

The value 0 indicates success and other values indicates failure.

errorMessage

String

Body

No

Error message.

intentsResponses

intentsResponses[]

Body

No

Intention array, which must be returned when the operation is successful.

Table 3 intentsResponses

Parameter

Type

Position

Mandatory

Description

responses

String[]

Body

No

Response returned by the chatbot. The value is a character string array. Multiple values are allowed.

confidence

Float

Body

Yes

Confidence.

commands

String[]

Body

Yes

Intention command word.

commandParams

Map

Body

No

Keyword parameters. The slot information of general intentions is returned through this parameter.

Example: {"Number":"3"}

For details about operations related to general intentions, see Adding Intention Templates.

scenarioName

String

Body

No

Intention name.

scenarioStatus

String

Body

No

Scenario status.

simQuestions

List <String>

Body

No

If a similar question exists in the FAQ question, the similar question is returned. (Similar questions refer to questions other than the matched main question.)

Example

  • Request
    {
    	"userId": "1649209493813571405",
    	"sentence": "Query the call fee.",
    	"tenantId": "202205125916",
    	"language": "en_US",
    	"targetIntentCount": "2",
    	"confidence2Top": "0.5",
    	"authToken": "Xun4*******************yAmResnf",
            "context":"Query the call fee.",
            "domainList":[10039],
            "faqGroupList":[10952,10950]
    }
  • Response
    {
        "intentsResponses": [
            {
                "scenarioStatus": "finish",
                "confidence": 1.0,
                "responses": "Dear user, your call fee balance is CNY56.",
                "scenarioName": "Call fee query",
                "commands": "Query the call fee."
            }
        ],
        "errorCode": 0
    }
  • Request (including FAQs)
    {
    	"userId": "1649209493813571405",
    	"sentence": "Preferential package recommendation",
    	"tenantId": "202205125916",
    	"language": "en_US",
    	"targetIntentCount": "2",
    	"confidence2Top": "0.5",
    	"authToken": "Xun4vb*******************mResnf",
            "context":"",
            "domainList":[10039],
            "faqGroupList":[10952,10950]
    }
  • Response
    {
        "intentsResponses": [
            {
                "simQuestions": [
                    "Some preferential traffic packages are available."
                ],
                "scenarioStatus": "SUCCESS",
                "confidence": 23.0,
                "responses": "A monthly discount is available, CNY10 for 3 GB traffic.",
                "scenarioName": "1721756338",
                "commands": "systemQA"
            }
        ],
        "errorCode": 0
    }