SseChat - Question answering API
Provides question answering over SSE.
Try it out
You can call this operation in OpenAPI Explorer without calculating a signature. After a successful call, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
The following table describes the authorization information for this API operation. You can use this information in the Action element of a RAM policy statement to grant a RAM user or RAM role permission to call the operation. The columns are described as follows:
-
Action: a specific permission.
-
Access level: the access level of an action. Valid values: Write, Read, and List.
-
Resource type: the types of resources for which the action supports authorization:
- Required resource types are marked with an asterisk (*).
- Actions that do not support resource-level authorization use
All resources.
-
Condition key: a condition key defined by the cloud service.
-
Dependent action: an additional permission required to perform the action. The caller must also have permission to perform the dependent action.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| bailianchatbot:SseChat | none | *All resources * |
| None |
Request syntax
POST /sse/bailian/chat HTTP/1.1
Request parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| AppId | string | Yes | The application ID. Create and query applications in the console. Only one ID can be specified. | chatbot-cn-dDmF3jcdVf |
| Utterance | string | Yes | The input from the chatbot visitor. | What can you do? |
| SessionId | string | No | The session ID, used to identify a visitor's session and maintain context. | 15e04f27-acd7-489d-872f-1d68f7535e33 |
| SenderId | string | No | The visitor ID, used to identify the user in the current session. | uid129312098593 |
| SenderNick | string | No | The visitor nickname. | Zhang San |
| VendorParam | string | No | A JSON-formatted set of user-defined parameters (pass-through parameters) that can be passed to conversation engines. Examples:
| {"docLabels":"标签1,标签2"} |
| Command | string | No | The command for this request. Currently supported values:
| TIMEOUT |
| WorkspaceId | string | Yes | The unique ID of the Model Studio workspace: Obtain workspaceId | llm-g7jspxljq8k909h3 |
Response parameters
| Name | Type | Description | Example |
|---|---|---|---|
| object | Schema of Response | ||
| RequestId | string | The request ID. | 30D68C4C-4512-58A7-A328-568015B39A02 |
| Data | any | The returned data. | See the supplementary response parameter descriptions. |
| Success | boolean | Indicates whether the request succeeded. | True |
| Message | string | The error description. | success |
| Code | string | The result code. | 200 |
Example descriptions
Sample response
{
"MessageBody": {
"DirectMessageBody": {
"ContentType": "RICH_TEXT",
"Ext": {},
"HitSystemAskConfig": "GPTQA_MODEL",
// 大模型输出的答案:把 SentenceList 列表每一个 content 为一个段落。
"SentenceList": [
{
"Content": "我作为一名人工智能助手,"
}
]
},
"Type": "Direct"
},
"MessageId": "d8720210-9588-4b49-b412-09648621a073",
"SequenceId": "f186e72492214631a6a150b2288d269f",
"SessionId": "cidu1dmqF8iUdz2gNonzzZAhsWsocstnJqThr+wp430evc=",
"Source": "SYSTEM_ASK_CONFIG",
"StreamEnd": false
}
Additional sample responses
Source=TASK_DRIVEN_DIALOGUE
{
"MessageBody":{
"Commands":{},
"DirectMessageBody":{
"ContentType":"PLAIN_TEXT",
"Ext":{
"EXTERNAL_FLAGS":{}
},
"SentenceList":[
{
"Content":"北京市晴,气温 8 摄氏度,东风 ≤3 级"
}
]
},
"Type":"Direct"
},
"MessageId":"7a2cdb51-af56-4ac9-9c6d-108905695ac9",
"SequenceId":"4861074fe523498ba3f397e876b60105",
"SessionId":"f3d7e960933411ee96144bea43fe4df3",
"Source":"TASK_DRIVEN_DIALOGUE",
"StreamEnd":true
}
Source=NON_STRUCTURAL_KNOWLEDGE
{
"MessageBody":{
"DirectMessageBody":{
"AnswerReference":{
"ItemList":[
{
"Content":"你好",
"ContentType":"RICH_TEXT",
"DataSource":"FAQ_DIRECT",
"Number":1,
"ReferenceExt":{
"DocName":"FAQ 知识库"
},
"Title":"你好"
}
]
},
"ContentType":"RICH_TEXT",
"SentenceList":[
{
"Content":"你好",
"ReferNumber":1
}
]
},
"Type":"Direct"
},
"MessageId":"808a9cfb-2cec-4230-aad1-66c28df6040e",
"SequenceId":"32a052f098c14769b8b81ac202f38d01",
"SessionId":"595fa8a0940611eeb59a155f6621f5d6",
"Source":"NON_STRUCTURAL_KNOWLEDGE",
"StreamEnd":true
}
Source=SYSTEM_ASK_CONFIG
{
"MessageBody":{
"DirectMessageBody":{
"ContentType":"PLAIN_TEXT",
"HitSystemAskConfig":"NO_ANSWER",
"SentenceList":[
{
"Content":"我还没有学会这个问题,已经记录会尽快学习为您解答,请尝试询问我其他问题"
}
]
},
"Type":"Direct"
},
"MessageId":"f13833e7-9ca4-4a5b-8878-f5cc8a0a327c",
"SequenceId":"245c39ce1f11406bb3cf60b4d017dff0",
"SessionId":"6e7c44a0940111ee91e69d173591e2de",
"Source":"SYSTEM_ASK_CONFIG",
"StreamEnd":true
}
Examples
Sample success response
JSON format
{
"RequestId": "30D68C4C-4512-58A7-A328-568015B39A02",
"Data": "详见返回参数补充说明",
"Success": true,
"Message": "success",
"Code": 200
}
Error codes
For more error codes, see Error Center.