TsgcHTTP_API_OpenAIMethods › RetrieveMessage

RetrieveMessage Method

Retrieves a single message from a Thread by its identifier

Syntax

function RetrieveMessage(const aThreadId, aMessageId: string) : TsgcOpenAIClass_Message;

Parameters

NameTypeDescription
aThreadIdconst stringThe identifier of the Thread that owns the message.
aMessageIdconst stringThe identifier of the message to retrieve (e.g. msg_abc123).

Return Value

The Message object with its role, content parts, attachments and metadata (TsgcOpenAIClass_Message)

Remarks

Calls GET /v1/threads/{thread_id}/messages/{message_id} to return the full representation of a single message, including any file citations or generated images. Use this call when you need to inspect a specific message without paging the whole Thread.

Example

var oMessage: TsgcOpenAIClass_Message;
begin
  oMessage := oAPI.RetrieveMessage('thread_abc123', 'msg_abc123');
  ShowMessage(oMessage.ContentAsText);
end;

Back to Methods