TsgcHTTP_API_OpenAIMethods › CreateVectorStore

CreateVectorStore Method

Creates a new vector store used by the file_search tool

Syntax

function CreateVectorStore(const aRequest : TsgcOpenAIClass_Request_VectorStore): TsgcOpenAIClass_VectorStore;

Parameters

NameTypeDescription
aRequestconst TsgcOpenAIClass_Request_VectorStoreVector store configuration: name, initial file ids, chunking strategy, expiration policy and metadata.

Return Value

The newly created vector store together with its id and processing status (TsgcOpenAIClass_VectorStore)

Remarks

Calls POST /v1/vector_stores to provision a searchable vector store that an Assistant can query through the file_search tool. Files can be attached at creation time via FileIds, or added later with CreateVectorStoreFile/CreateVectorStoreFileBatch. The returned id (e.g. vs_abc123) should be referenced from the Assistant or Thread tool resources.

Example

var oRequest: TsgcOpenAIClass_Request_VectorStore;
begin
  oRequest := TsgcOpenAIClass_Request_VectorStore.Create;
  try
    oRequest.Name := 'Product Manuals';
    ShowMessage(oAPI.CreateVectorStore(oRequest).Id);
  finally
    oRequest.Free;
  end;
end;

Back to Methods