Embeddings & Vector Databases

Transform text into semantic vectors and build intelligent search, recommendations, and RAG applications with your own data.

TsgcAIOpenAIEmbeddings

Vector embeddings + RAG. Generate embeddings with OpenAI, store them in a local file or in Pinecone, then query the nearest neighbour for any text.

Component class

TsgcAIOpenAIEmbeddings

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Enterprise (AI add-on)

Drop the component, set a few properties, go

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;

What's inside

4 published properties, 2 methods, 5 events — pulled from the component reference.

Configuration

Published properties: OpenAIOptions, EmbeddingsOptions.

Diagnostics

Published properties: Version.

Storage

Properties: Database.

Generation

Methods: CreateEmbeddings, CreateEmbeddingsFromFile.

Batch lifecycle

Events: OnCreateEmbeddingsStart, OnCreateEmbeddingsProgress, OnCreateEmbeddingsStop.

Per-embedding

Events: OnBeforeCreateEmbedding, OnAfterCreateEmbedding.

Specifications & references

Authoritative sources for the protocols this component implements.

Documentation & Demos

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.
Demo Project — Demos\AI\Embeddings Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Build Intelligent Applications with Embeddings

Download the free trial and start building semantic search, RAG, and recommendation features today.