An asynchronous API to access the large language model capabilities of DAS.
Operation description
Prerequisites:
Use the latest version of the Alibaba Cloud SDK or the DAS SDK.
When you use an SDK to call the DAS service, you must specify the region as cn-shanghai.
You can create offline tasks only for database instances that have DAS Enterprise Edition enabled. For information about the databases and regions that are supported by different versions of DAS Enterprise Edition, see DAS product editions and features.
For more information about using the Chat API with DAS Agent, see Best practices for DAS Agent interaction (integrating with the Chat API).
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:Chat |
get |
*All Resource
|
None | None |
Request syntax
POST /chat HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Message |
string |
Yes |
The message object. |
{"id":"68fe0321-37fe-4c75-a118-b61b33156f6a","role":"user","content":[{"type":"text","text":"hello"}]} |
| SessionId |
string |
No |
Optional. The session ID, which must be a UUID. If unspecified, a new session is created. To maintain conversational context, use the same session ID for all subsequent requests. |
123e4567-e89b-12d3-a456-xxxxxxxxxxxx |
| AgentId |
string |
No |
Optional. The agent ID. You can use the ID of an agent that is automatically generated when you enable DAS Agent, or the ID of a custom agent. If this parameter is omitted, the default agent is used. |
ag-472T0DxtmjIxxxxx |
| Summary |
string |
No |
Specifies whether to return summary information. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| Type |
string |
The event type. |
TEXT_MESSAGE_CONTENT |
| MessageId |
string |
The message ID. |
61820b594664275c4429**** |
| Role |
string |
The role in the conversation. |
assistant |
| Delta |
string |
The incremental content of the response. |
hello |
| ActivityType |
string |
Indicates the current activity status of the agent. |
waiting_for_agent_thinking |
| ToolCallId |
string |
The tool call ID. |
call_edf9cdb69e0e4c9796a6a5a6 |
| ToolCallName |
string |
The name of the tool. |
das_api |
| Content |
string |
The content of the response. |
I see you have several PolarDB instances, and I will query them for you shortly |
| ParentMessageId |
string |
The ID of the parent message. |
76bee207-31ee-4707-8851-6b9d4da033aa |
| ThreadId |
string |
The thread ID. |
8e481be1-21d5-4a92-a2fb-fb54be0ab4f6 |
| StepName |
string |
The name of the execution step. |
sub_agent_performance_diagnose_mysql |
| RunId |
string |
The run ID. |
ed7cb7b1-ddc8-45d7-9ff3-b315726cb5f7 |
| TaskTrackerId |
string |
The identifier of the callback tool. |
das_api |
| Name |
string |
The key for the additional information. |
summary |
| Value |
any |
The value of the additional information. |
{"CharCount":393,"End":1777428785996,"RequestId":"BE59AED5-D831-5811-BBAD-590B917B2089","SessionId":"123e4567-e89b-12d3-a456-xxxxxxxxxxxx","Start":1777428707927} |
Examples
Success response
JSON format
{
"Type": "TEXT_MESSAGE_CONTENT",
"MessageId": "61820b594664275c4429****",
"Role": "assistant",
"Delta": "hello",
"ActivityType": "waiting_for_agent_thinking",
"ToolCallId": "call_edf9cdb69e0e4c9796a6a5a6",
"ToolCallName": "das_api",
"Content": "I see you have several PolarDB instances, and I will query them for you shortly",
"ParentMessageId": "76bee207-31ee-4707-8851-6b9d4da033aa",
"ThreadId": "8e481be1-21d5-4a92-a2fb-fb54be0ab4f6",
"StepName": "sub_agent_performance_diagnose_mysql",
"RunId": "ed7cb7b1-ddc8-45d7-9ff3-b315726cb5f7",
"TaskTrackerId": "das_api",
"Name": "summary",
"Value": "{\"CharCount\":393,\"End\":1777428785996,\"RequestId\":\"BE59AED5-D831-5811-BBAD-590B917B2089\",\"SessionId\":\"123e4567-e89b-12d3-a456-xxxxxxxxxxxx\",\"Start\":1777428707927}"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | |
| 500 | Timeout | The request processing has failed due to timeout. | Request processing failed due to timeout. |
| 403 | NoPermission | You are not authorized to do this action. | |
| 404 | InstanceNotFound | Requested instance not found. | The corresponding instance ID cannot be found. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.