TsgcHTTP_API_OpenAIMethods › DeleteMessage

DeleteMessage Method

Deletes a specific message from a Thread

Syntax

function DeleteMessage(const aThreadId, aMessageId: string) : TsgcOpenAIClass_Response_Delete_Status;

Parameters

NameTypeDescription
aThreadIdconst stringThe identifier of the Thread that owns the message.
aMessageIdconst stringThe identifier of the message to delete.

Return Value

Deletion confirmation with the message id and a boolean Deleted flag (TsgcOpenAIClass_Response_Delete_Status)

Remarks

Calls DELETE /v1/threads/{thread_id}/messages/{message_id} to remove a single message from a Thread. The rest of the conversation history is preserved. The operation cannot be undone.

Example

begin
  if oAPI.DeleteMessage('thread_abc123', 'msg_abc123').Deleted then
    ShowMessage('Message removed');
end;

Back to Methods