All Products
Search
Document Center

Database Autonomy Service:Chat

Last Updated:Jun 10, 2026

API asinkron untuk mengakses kemampuan model bahasa Tingkat Tinggi DAS.

Deskripsi operasi

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).

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

hdm:Chat

get

*全部资源

*

None None

Sintaks permintaan

POST /chat HTTP/1.1

Parameter permintaan

Parameter

Type

Required

Description

Example

Message

string

Yes

Objek Paket.

{"id":"68fe0321-37fe-4c75-a118-b61b33156f6a","role":"user","content":[{"type":"text","text":"hello"}]}

SessionId

string

No

Opsional. ID Sesi, yang harus berupa UUID. Jika tidak ditentukan, Sesi baru akan dibuat. Untuk mempertahankan konteks percakapan, gunakan ID Sesi yang sama untuk semua permintaan berikutnya.

123e4567-e89b-12d3-a456-xxxxxxxxxxxx

AgentId

string

No

Opsional. ID Agen. Anda dapat menggunakan ID Agen yang dibuat secara otomatis saat Anda mengaktifkan DAS Agent, atau ID Agen kustom. Jika parameter ini dihilangkan, Agen default akan digunakan.

ag-472T0DxtmjIxxxxx

Summary

string

No

Apakah akan mengembalikan informasi ringkasan.

false

Elemen respons

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}

Contoh

Respons sukses

JSONformat

{
  "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}"
}

Kode kesalahan

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.
403 NoPermission You are not authorized to do this action.
404 InstanceNotFound Requested instance not found.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.