TsgcHTTP_API_OpenAIMethods › ModifyRun

ModifyRun Method

Updates the metadata of an existing Run

Syntax

function ModifyRun(const aThreadId, aRunId: string; const aRun: TsgcOpenAIClass_Request_Run): TsgcOpenAIClass_Run;

Parameters

NameTypeDescription
aThreadIdconst stringThe identifier of the Thread that owns the Run.
aRunIdconst stringThe identifier of the Run to modify.
aRunconst TsgcOpenAIClass_Request_RunRequest whose Metadata collection contains the key/value pairs to update.

Return Value

The updated Run object reflecting the new metadata (TsgcOpenAIClass_Run)

Remarks

Calls POST /v1/threads/{thread_id}/runs/{run_id}. Only the metadata field is mutable; the Run's execution state, model and tools cannot be changed after creation. Use it to tag Runs with application-specific identifiers.

Example

var oRequest: TsgcOpenAIClass_Request_Run;
begin
  oRequest := TsgcOpenAIClass_Request_Run.Create;
  try
    oRequest.Metadata.Values['trace_id'] := 'abc-42';
    oAPI.ModifyRun('thread_abc123', 'run_abc123', oRequest);
  finally
    oRequest.Free;
  end;
end;

Back to Methods