TsgcAIOpenAIEmbeddingsProperties › OpenAIOptions

OpenAIOptions Property

Connection settings for the OpenAI API (API key, organization, logging and retry).

Syntax

property OpenAIOptions: TsgcHTTPOpenAI_Options read FOpenAIOptions write SetOpenAIOptions;

Default Value

Remarks

Groups the configuration required to call the OpenAI REST endpoints. Set ApiKey with your OpenAI key (required) and, optionally, Organization. Use LogOptions to write every request/response to a text file, and RetryOptions to automatically retry when OpenAI returns a transient error (Enabled, Retries, Wait in milliseconds). The same options are used for every call performed by CreateEmbeddings and CreateEmbeddingsFromFile.

Example

oEmbeddings.OpenAIOptions.ApiKey := 'sk-...';
oEmbeddings.OpenAIOptions.Organization := 'org-...';
oEmbeddings.OpenAIOptions.RetryOptions.Enabled := True;
oEmbeddings.OpenAIOptions.RetryOptions.Retries := 3;
oEmbeddings.OpenAIOptions.RetryOptions.Wait := 1000;
oEmbeddings.OpenAIOptions.LogOptions.Enabled := True;
oEmbeddings.OpenAIOptions.LogOptions.FileName := 'openai.log';

Back to Properties