TsgcHTTP_API_OpenAI › Methods › ModifyMessage
Updates the metadata of an existing message in a Thread
function ModifyMessage(const aThreadId, aMessageId: string; const aMessage: TsgcOpenAIClass_Request_Message): TsgcOpenAIClass_Message;
| Name | Type | Description |
|---|---|---|
aThreadId | const string | The identifier of the Thread that owns the message. |
aMessageId | const string | The identifier of the message to modify. |
aMessage | const TsgcOpenAIClass_Request_Message | Request object whose Metadata collection contains the key/value pairs to update. |
The updated Message object reflecting the new metadata (TsgcOpenAIClass_Message)
Calls POST /v1/threads/{thread_id}/messages/{message_id}. Only the metadata field is mutable through this endpoint; the message role and content are immutable once created. Useful to tag messages with application-specific identifiers.
var oRequest: TsgcOpenAIClass_Request_Message;
begin
oRequest := TsgcOpenAIClass_Request_Message.Create;
try
oRequest.Metadata.Values['customer'] := '42';
oAPI.ModifyMessage('thread_abc123', 'msg_abc123', oRequest);
finally
oRequest.Free;
end;
end;