TsgcAIOpenAIEmbeddings › Methods › CreateEmbeddingsFromFile
Loads a text file and generates embeddings from its contents.
procedure CreateEmbeddingsFromFile(const aFileName: string);
| Name | Type | Description |
|---|---|---|
aFileName | const string | Full path of the text file to read. |
Convenience wrapper around CreateEmbeddings: loads the given text file into memory and then processes the whole content using the same chunking, event and storage behaviour. The file is read with a TStringList, so any text file supported by Delphi can be used. Typical use cases are ingesting documentation, FAQ documents or transcripts into a vector database.
oEmbeddings.OpenAIOptions.ApiKey := 'sk-...';
oEmbeddings.Database := oFileDB;
oEmbeddings.CreateEmbeddingsFromFile('C:\data\knowledge-base.txt');