หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Single-Round Q&A (Offline Soon)

Updated on 2023-06-06 GMT+08:00

Function Description

For QABot, questions entered by users serve as the input, and top N (N is 5 by default) knowledge points matching the input serve as the output. The knowledge points are sorted by score in descending order.

NOTE:

If the returned knowledge point contains the answer, the matched answer is returned. If the returned knowledge point does not contain the answer, the recommended question is returned.

URI

POST https://{endpoint}/v1/{project_id}/qabots/{qabot_id}/requests

Table 1 Path parameters

Parameter

Mandatory

Type

Description

endpoint

Yes

String

Endpoint, which is the request address for calling an API.

The endpoint varies depending on services in different regions. For more details, see Endpoints.

project_id

Yes

String

Project ID, which is used for resource isolation. For details, see Obtaining a Project ID.

qabot_id

Yes

String

Q&A bot ID, which is in the UUID format. For example, 303a0a00-c88a-43e3-aa2f-d5b8b9832b02.

This parameter is displayed in the Q&A Bot Name/ID column of the QABot console.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It is used to obtain the permission to call APIs. The token is the value of X-Subject-Token in the response header in Authentication.

Content-Type

Yes

String

Message body type (format). The value is application/json.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

session_id

Yes

String

Session ID, which is a custom character string used to differentiate sessions.

user_id

No

String

User ID, which uniquely identifies a user.

question

Yes

String

User question.

extends

No

Extends object

Extended parameter.

threshold_enable

No

Boolean

Value true indicates that the internal threshold is enabled. If this parameter is set to true, the answer with threshold processing performed is returned.

Value false indicates that the internal threshold is disabled. If this parameter is set to false, the original answer is returned.

chat_enable

No

Boolean

The default value is true.

true indicates that the chit-chat is used when the bot does not know how to reply.

false indicates that the chit-chat is not used when the bot does not know how to reply.

operate_type

No

Integer

Transferred when the API is called to label the Q&A behavior. The default value is 0. It is displayed in the Q&A log.

  • Value 0 indicates that a user inputs a question.
  • Value 1 indicates that a user clicks a question from the hot questions.
  • Value 3 indicates that a user clicks a question in the Recommend Questions area.
  • Value 4 indicates that a user clicks a question in the prompted questions.
Table 4 Extends

Parameter

Mandatory

Type

Description

domains

No

Array of strings

Domain list. Multiple domains are separated by semicolons (;). If certain domains are specified, the API matches answers from the domains. If no domains are specified, the API matches answers from the entire knowledge base of the user.

Currently, a maximum of 10 domains are supported.

top

No

Integer

Number of answers. The default value is 5. The value ranges from 1 to 10.

Response

Status code: 200
Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Request ID.

This parameter is not included when the API fails to be called.

question

String

Question.

This parameter is not included when the API fails to be called.

answers

Array of Answers objects

Set of questions similar to the user question. This parameter is not included when the API fails to be called.

extends

Extends object

Extended parameter. This parameter is not included when the API fails to be called.

Table 6 Answers

Parameter

Type

Description

qa_pair_id

String

Q&A pair ID.

st_question

String

Standard question.

ex_questions

Array of ExQuestions objects

Extended question.

answer

String

Answer.

score

Float

Similarity score, which is accurate to three decimal places.

domain

String

Problem category

Table 7 ExQuestions

Parameter

Type

Description

content

String

Extended question.

Table 8 Extends

Parameter

Mandatory

Type

Description

domains

No

Array of strings

Domain list. Multiple domains are separated by semicolons (;). If certain domains are specified, the API matches answers from the domains. If no domains are specified, the API matches answers from the entire knowledge base of the user.

Currently, a maximum of 10 domains are supported.

top

No

Integer

Number of answers. The default value is 5. The value ranges from 1 to 10.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code returned when the API fails to be called. This parameter is not included when the API is successfully called.

error_msg

String

Error message returned when the API fails to be called. This parameter is not included when the API is successfully called.

Example Requests

Example request
POST https://{endpoint}/v1/1604d8170cd84440a81281e5a3a04f8b/qabots/303a0a00-c88a-43e3-aa2f-d5b8b9832b02/requests

Request Header:
    Content-Type: application/json
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...

Request Body:
{
    "user_id": "z00123456",
    "session_id": "xxxxxxxxxxxxxxxxxx",
    "operate_type":3,      
    "question": "What should I do if I fail to log in to my cloud desktop?"
    "extends":{
    "domains":" [Cloud desktop]",
	"top":5
    },
    "threshold_enable":false,
    "chat_enable":true
}

Example Responses

Status code: 200

Example of a successful response

  • If the internal threshold is disabled (threshold_enable is set to false), the number of results is returned based on the value of top.
    { 
        "request_id": "303a0a00-c88a",
        "question": "What should I do if I cannot open my cloud desktop?",
        "answers": [
            {
                "qa_pair_id":"123",
                "st_question":"Why does my cloud desktop fail to be opened?",
                "answer":"Incorrect user account",
                "score":0.952,
                "domain":"Cloud desktop"
         },
         {
                "qa_pair_id":"123",
                "st_question":"Why would my cloud desktop fail to be opened?",
                "answer":"Incorrect user account",        
                "score":0.901,
                "domain":"Cloud desktop"
            },
            {
                "qa_pair_id":"123",
                "st_question":"What is cloud desktop?",
                "answer": "Cloud desktop is a system that supports remote office.",
                "score":0.352,
                "domain":"Cloud desktop"
            },
         {
                "qa_pair_id":"123",
                "st_question": "Why does my computer desktop fail to be opened?",
                "answer": "Check whether the monitor is started.",
                "score":0.352,
                "domain":"Cloud desktop"
            },
        ]
    }
  • Enable the internal threshold.
    Table 10 Internal threshold description

    Condition

    Result

    Remarks

    Score > 0.85

    Q&A pairs whose scores have a difference within 0.05 from the highest score are returned.

    If answers of Q&A pairs are specified, the Q&A pairs are returned. If answers are not specified, recommended Q&A pairs are returned.

    0.70 < Score < 0.85

    If there are Q&A pairs whose scores are in this range, Q&A pairs whose highest scores are in this range are returned. If there are no Q&A pairs whose scores are in this range, recommended Q&A pairs are returned.

    0.55 < Score < 0.70

    Recommended Q&A pairs are returned.

    Score < 0.55

    No Q&A pairs are returned.

    • Example 1
      { 
          "request_id": "303a0a00-c88a",
          "question": "What should I do if I cannot open my cloud desktop?",
          "answers": [
              {
                  "qa_pair_id":"123",
                  "st_question":"Why does my cloud desktop fail to be opened?",
                  "ex_questions": [
                      {
                          "content":"Cloud desktop"
                      }
                  ],
                  "answer":"Incorrect user account",
                  "top_score_question":"Why does my cloud desktop fail to be opened?",
                  "score":0.952,
                  "domain":"Cloud desktop"
              },
            {
                  "qa_pair_id":"123",
                  "st_question":"How to open the cloud desktop?",
                  "ex_questions": [
                      {
                          "content":"Desktop"
                      }
                  ],
                  "answer":"Open the cloud desktop.",
                  "top_score_question":"How to open the cloud desktop?",
                  "score":0.912,
                  "domain":"Cloud desktop"
              }
          ]
      }
    • Example 2
      { 
          "request_id": "303a0a00-c88a",
          "question": "What should I do if I cannot open my cloud desktop?",
          "answers": [
              {
                  "qa_pair_id":"123",
                  "st_question":"Why does my cloud desktop fail to be opened?",
                  "top_score_question":"Why does my cloud desktop fail to be opened?",
                  "answer":"Incorrect user account",
                  "score":0.752,
                  "domain":"Cloud desktop"
              }
          {
                  "qa_pair_id":"123",
                  "st_question":"Why would my cloud desktop fail to be opened?",
                  "score":0.70,
                  "domain":"Cloud desktop"
              },
              {
                  "qa_pair_id":"123",
                  "st_question":"What is cloud desktop?",
                  "score":0.54,
                  "domain":"Cloud desktop"
              }
          ]
      }
    • Example 3
      { 
          "request_id": "303a0a00-c88a",
          "question": "What should I do if I cannot open my cloud desktop?",
          "answers": [
          {
                  "qa_pair_id":"123",
                  "st_question":"Why would my cloud desktop fail to be opened?",
                  "score":0.291,
                  "domain":"Cloud desktop"
              },
              {
                  "qa_pair_id":"123",
                  "st_question":"What is cloud desktop?",
                  "score":0.252,
                  "domain":"Cloud desktop"
              }
          ]
      }
  • Have a chit-chat or ask a question with no matched answer.
    { 
        "request_id": "303a0a00-c88a",
        "question": "Hello",
        "answers": [
        {
                "answer": "Hello. May I help you?"
    
            }
        ]
    }

Status code: 400

Example of a failed response

{
  "error_code": "CBS.0022",
  "error_msg": "session_id can not be null"
}

Status Code

For details about status codes, see Status Code.

Error Code

For details about error codes, see Error Code.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback