TsgcAIOpenAIEmbeddingsProperties › Database

Database Property

Vector database component used to persist the generated embeddings.

Syntax

property Database: TsgcAI_Database_Vector read FDatabase write FDatabase;

Default Value

Remarks

Assign any descendant of TsgcAI_Database_Vector to store the embeddings produced by the component. The two databases that ship with sgcWebSockets are TsgcAIDatabaseVectorPinecone (Pinecone cloud vector database) and TsgcAIDatabaseVectorFile (plain text file, intended for testing). When a batch runs, BeginAddData/EndAddData are called on the database and each chunk is persisted as a pair of input text and embedding vector. If Database is not set, embeddings are still generated and exposed through OnAfterCreateEmbedding but nothing is stored.

Example

// File-based database (testing)
oFileDB := TsgcAIDatabaseVectorFile.Create(nil);
oFileDB.FileName := 'vectors.txt';
oEmbeddings.Database := oFileDB;

// Or Pinecone
oPinecone := TsgcAIDatabaseVectorPinecone.Create(nil);
oPinecone.ApiKey := 'pc-...';
oPinecone.IndexName := 'my-index';
oEmbeddings.Database := oPinecone;

Back to Properties