TsgcAIOpenAIEmbeddingsEvents › OnCreateEmbeddingsStart

OnCreateEmbeddingsStart Event

Fired once when a batch of embeddings starts, reporting the total input size.

Syntax

property OnCreateEmbeddingsStart: TsgcOpenAICreateEmbeddingsStart;
// TsgcOpenAICreateEmbeddingsStart = procedure(Sender: TObject; aSize: Int64) of object

Default Value

Remarks

Triggered once at the beginning of a call to CreateEmbeddings or CreateEmbeddingsFromFile, before the first chunk is sent. aSize contains the length, in characters, of the full input, which can be used to size a progress bar. After this event the component emits one OnBeforeCreateEmbedding/OnAfterCreateEmbedding/OnCreateEmbeddingsProgress cycle per chunk, and finally OnCreateEmbeddingsStop.

Example

procedure TForm1.oEmbeddingsCreateEmbeddingsStart(Sender: TObject; aSize: Int64);
begin
  ProgressBar1.Min := 0;
  ProgressBar1.Max := aSize;
  ProgressBar1.Position := 0;
end;

Back to Events