@@ -136,6 +136,56 @@ curl https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads/{thread_id}/mess
136
136
137
137
---
138
138
139
+ ## Retrieve message
140
+
141
+ ``` http
142
+ GET https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads/{thread_id}/messages/{message_id}?api-version=2024-05-01-preview
143
+ ```
144
+
145
+ Retrieves a message file.
146
+
147
+ ** Path parameters**
148
+
149
+ | Parameter| Type | Required | Description |
150
+ | ---| ---| ---| ---|
151
+ | ` thread_id ` | string | Required | The ID of the thread that the message belongs to. |
152
+ | ` message_id ` | string | Required | The ID of the message to retrieve. |
153
+
154
+
155
+ ### Returns
156
+
157
+ The [ message] ( #message-object ) object matching the specified ID.
158
+
159
+ ### Example retrieve message request
160
+
161
+ # [ Python 1.x] ( #tab/python )
162
+
163
+ ``` python
164
+ from openai import AzureOpenAI
165
+
166
+ client = AzureOpenAI(
167
+ api_key = os.getenv(" AZURE_OPENAI_API_KEY" ),
168
+ api_version = " 2024-05-01-preview" ,
169
+ azure_endpoint = os.getenv(" AZURE_OPENAI_ENDPOINT" )
170
+ )
171
+
172
+ message = client.beta.threads.messages.retrieve(
173
+ message_id = " msg_abc123" ,
174
+ thread_id = " thread_abc123" ,
175
+ )
176
+ print (message)
177
+
178
+ ```
179
+
180
+ # [ REST] ( #tab/rest )
181
+
182
+ ``` console
183
+ curl https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads/{thread_id}/messages/{message_id}?api-version=2024-05-01-preview \
184
+ -H "api-key: $AZURE_OPENAI_API_KEY" \
185
+ -H 'Content-Type: application/json'
186
+ ```
187
+
188
+ ---
139
189
140
190
## Modify message
141
191
@@ -202,6 +252,53 @@ curl https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads/{thread_id}/mess
202
252
203
253
---
204
254
255
+ ## Delete message
256
+
257
+
258
+ ``` http
259
+ DELETE https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads/{thread_id}/messages/{message_id}?api-version=2024-05-01-preview
260
+ ```
261
+
262
+ Deletes a message.
263
+
264
+ ** Path parameters**
265
+
266
+ | Parameter| Type | Required | Description |
267
+ | ---| ---| ---| ---|
268
+ | ` thread_id ` | string | Required | The ID of the thread to which the message belongs. |
269
+ | ` message_id ` | string | Required | The ID of the message to modify. |
270
+
271
+ ### Returns
272
+
273
+ The deletion status of the [ message] ( #message-object ) object.
274
+
275
+ # [ Python 1.x] ( #tab/python )
276
+
277
+ ``` python
278
+ from openai import AzureOpenAI
279
+ client = AzureOpenAI(
280
+ api_key = os.getenv(" AZURE_OPENAI_API_KEY" ),
281
+ api_version = " 2024-05-01-preview" ,
282
+ azure_endpoint = os.getenv(" AZURE_OPENAI_ENDPOINT" )
283
+ )
284
+
285
+ deleted_message = client.beta.threads.messages.delete(
286
+ message_id = " msg_abc12" ,
287
+ thread_id = " thread_abc123" ,
288
+ )
289
+ print (deleted_message)
290
+ ```
291
+
292
+ # [ REST] ( #tab/rest )
293
+
294
+ ``` console
295
+ curl -x DELETE https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads/{thread_id}/messages/{message_id}?api-version=2024-05-01-preview \
296
+ -H "api-key: $AZURE_OPENAI_API_KEY" \
297
+ -H 'Content-Type: application/json'
298
+ ```
299
+
300
+ ---
301
+
205
302
## Message object
206
303
207
304
Represents a message within a thread.
0 commit comments