All Bundles

VectorStore

OpenAI vector store support

Derived from: EndPoint

Operations

Code example:

file_ids := ["file-xxxxxxxxxxxxxxxxxxxxxxxx", "file-yyyyyyyyyyyyyyyyyyyyyyyy", "file-zzzzzzzzzzzzzzzzzzzzzzzz"];
files := Vector->New()<API.OpenAI.File>;
each(i : file_ids) {
  file_id := file_ids[i];
  file := API.OpenAI.File->Load(file_id, token);
  if(file <> Nil) {
  file->ToString()->PrintLine();
  files->AddBack(file);
  };
};

store := VectorStore->Create("test_1", files, token);
if(store <> Nil) {
  store->ToString()->PrintLine();
};

CompletedCount

Get the number of files successfully processed

method : public : CompletedCount() ~ Int
Return
TypeDescription
Intnumber of files successfully processed

Create

Create a vector store

function : Create(name:String, token:String) ~ VectorStore
Parameters
NameTypeDescription
nameStringname of the store
tokenStringAPI token

Return
TypeDescription
VectorStorevector store

Create a vector store

function : Create(name:String, files:Vector<API.OpenAI.File>, token:String) ~ VectorStore
Parameters
NameTypeDescription
nameStringname of the store
filesFile<>to add to the store
tokenStringAPI token

Return
TypeDescription
VectorStorevector store

Delete

Deletes a store

function : Delete(id:String, token:String) ~ Bool
Parameters
NameTypeDescription
idStringstore ID
tokenStringAPI token

Return
TypeDescription
Booltrue if successful, false otherwise

DeleteAll

Deletes all stores

function : DeleteAll(token:String) ~ Bool
Parameters
NameTypeDescription
tokenStringAPI token

Return
TypeDescription
Booltrue if successful, false otherwise

GetBytes

Get the store's usage in bytes

method : public : GetBytes() ~ Int
Return
TypeDescription
Intstore's usage in bytes

GetCreatedAt

Unix timestamp (in seconds) of when the object instance was created

method : public : GetCreatedAt() ~ Int
Return
TypeDescription
Inttime with the object instance was created

GetId

Get object instance API ID

method : public : GetId() ~ String
Return
TypeDescription
Stringinstance ID

GetLastActiveAt

Unix timestamp (in seconds) of when the object instance was last active

method : public : GetLastActiveAt() ~ Int
Return
TypeDescription
Inttime with the object instance was last active

GetName

Get the name of the store

method : public : GetName() ~ String
Return
TypeDescription
Stringname of the store

GetObject

Get the object type

method : public : GetObject() ~ String
Return
TypeDescription
Stringobject type

GetStatus

Get the store's status

method : public : GetStatus() ~ String
Return
TypeDescription
Stringstore's status

ListStores

Lists vector stores

function : ListStores(token:String) ~ Vector<VectorStore>
Parameters
NameTypeDescription
tokenStringAPI token

Return
TypeDescription
Vector<VectorStore>list of vector stores

Lists vector stores

function : ListStores(non_empties:Bool, token:String) ~ Vector<VectorStore>
Parameters
NameTypeDescription
non_emptiesBoolif true, non empty stores are include, otherwise excluded
tokenStringAPI token

Return
TypeDescription
Vector<VectorStore>list of vector stores

Load

Load a store

function : Load(store_id:String, token:String) ~ API.OpenAI.VectorStore
Parameters
NameTypeDescription
store_idStringvector store ID
tokenStringAPI token

Return
TypeDescription
VectorStorevector store

ToString

String representation of the object

method : public : ToString() ~ String
Return
TypeDescription
Stringstring representation