Embeddings & Vector Databases
Transform text into semantic vectors and build intelligent search, recommendations, and RAG applications with your own data.
Transform text into semantic vectors and build intelligent search, recommendations, and RAG applications with your own data.
Vector embeddings + RAG. Generate embeddings with OpenAI, store them in a local file or in Pinecone, then query the nearest neighbour for any text.
TsgcAIOpenAIEmbeddings
Windows, macOS, Linux, iOS, Android
Enterprise (AI add-on)
Pair with a TsgcAIDatabaseVectorFile or TsgcAIDatabaseVectorPinecone, then call CreateEmbeddingsFromFile.
uses
sgcAI, sgcAI_OpenAI, sgcAI_OpenAI_Embeddings,
sgcAI_DB_Vector, sgcAI_DB_Vector_File, sgcAI_DB_Vector_Pinecone;
var
Embeddings: TsgcAIOpenAIEmbeddings;
DBFile: TsgcAIDatabaseVectorFile;
DBPinecone: TsgcAIDatabaseVectorPinecone;
begin
Embeddings := TsgcAIOpenAIEmbeddings.Create(nil);
Embeddings.OpenAIOptions.ApiKey := 'sk-...';
// Local file-based vector database
DBFile := TsgcAIDatabaseVectorFile.Create(nil);
DBFile.VectorFileOptions.InputFilename := 'corpus.sgcif';
DBFile.VectorFileOptions.VectorFilename := 'corpus.sgcvf';
Embeddings.Database := DBFile;
Embeddings.CreateEmbeddingsFromFile('docs.txt');
// Or push to Pinecone
DBPinecone := TsgcAIDatabaseVectorPinecone.Create(nil);
DBPinecone.PineconeOptions.ApiKey := 'pc-...';
DBPinecone.PineconeOptions.Environment := 'us-west4-gcp-free';
Embeddings.Database := DBPinecone;
Embeddings.CreateEmbeddingsFromFile('docs.txt');
end;
4 published properties, 2 methods, 5 events — pulled from the component reference.
Published properties: OpenAIOptions, EmbeddingsOptions.
Published properties: Version.
Properties: Database.
Methods: CreateEmbeddings, CreateEmbeddingsFromFile.
Events: OnCreateEmbeddingsStart, OnCreateEmbeddingsProgress, OnCreateEmbeddingsStop.
Events: OnBeforeCreateEmbedding, OnAfterCreateEmbedding.
Authoritative sources for the protocols this component implements.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Online Help — TsgcAIOpenAIEmbeddings Full property, method and event reference for this component. | Open | |
| Demo Project — Demos\AI\Embeddings Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |