This topic describes how to use the Message class in the assistant API to create, list, retrieve, and modify messages.
Function name | Type |
|---|---|
create | Create a message class |
retrieve | Retrieve a message class |
modify | Modify a message class |
list | List message classes |
Create a message
- HTTP
- SDK
Parameter name | Input Parameters | Parameter type | Required |
|---|---|---|---|
thread id | The thread ID to which the message is passed. | string | Yes |
content | The content of the message. | string | Yes |
role | The role of the entity that provides the message. Only `user` is supported. | string | No |
metadata | Other related information. | object | No |
- id: the message ID.
- request_id: the request ID.
List messages
- HTTP
- SDK
Parameter name | Description | Parameter type | Required |
|---|---|---|---|
thread id | The thread ID to which the message is passed. | string | Yes |
limit | Number of messages | integer | No |
order | The sorting order by creation time: `asc` or `desc`. | string | No (Default: `desc`) |
- A list of multiple messages.
Retrieve a message
- HTTP
- SDK
Parameter name | Description | Parameter type | Required |
|---|---|---|---|
thread id | The thread ID of the message to retrieve. | string | Yes |
message_id | The ID of the message to retrieve. | string | Yes |
- id: Message ID
- request_id: the request ID.
Modify a message
- HTTP
- SDK
Parameter name | Input Parameters | Parameter type | Required |
|---|---|---|---|
thread_id | The ID of the thread to modify. | string | Yes |
message_id | The ID of the message to modify. | string | Yes |
metadata | The metadata. | dict |
- id: Message ID
- request_id: the request ID.