VectorStore
OpenAI vector store support
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();
};Operations
- CompletedCount
- Create
- Delete
- DeleteAll
- GetBytes
- GetCreatedAt
- GetId
- GetLastActiveAt
- GetName
- GetObject
- GetStatus
- ListStores
- Load
- ToString
CompletedCount
Get the number of files successfully processed
method : public : CompletedCount() ~ IntReturn
| Type | Description |
|---|---|
| Int | number of files successfully processed |
Create
Create a vector store
function : Create(name:String, token:String) ~ VectorStoreParameters
| Name | Type | Description |
|---|---|---|
| name | String | name of the store |
| token | String | API token |
Return
| Type | Description |
|---|---|
| VectorStore | vector store |
Create
Create a vector store
function : Create(name:String, files:Vector<API.OpenAI.File>, token:String) ~ VectorStoreParameters
| Name | Type | Description |
|---|---|---|
| name | String | name of the store |
| files | Vector<APIOpenAIFile> | to add to the store |
| token | String | API token |
Return
| Type | Description |
|---|---|
| VectorStore | vector store |
Delete
Deletes a store
function : Delete(id:String, token:String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| id | String | store ID |
| token | String | API token |
Return
| Type | Description |
|---|---|
| Bool | true if successful, false otherwise |
DeleteAll
Deletes all stores
function : DeleteAll(token:String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| token | String | API token |
Return
| Type | Description |
|---|---|
| Bool | true if successful, false otherwise |
GetBytes
Get the store's usage in bytes
method : public : GetBytes() ~ IntReturn
| Type | Description |
|---|---|
| Int | store's usage in bytes |
GetCreatedAt
Unix timestamp (in seconds) of when the object instance was created
method : public : GetCreatedAt() ~ IntReturn
| Type | Description |
|---|---|
| Int | time with the object instance was created |
GetId
Get object instance API ID
method : public : GetId() ~ StringReturn
| Type | Description |
|---|---|
| String | instance ID |
GetLastActiveAt
Unix timestamp (in seconds) of when the object instance was last active
method : public : GetLastActiveAt() ~ IntReturn
| Type | Description |
|---|---|
| Int | time with the object instance was last active |
GetName
Get the name of the store
method : public : GetName() ~ StringReturn
| Type | Description |
|---|---|
| String | name of the store |
GetObject
Get the object type
method : public : GetObject() ~ StringReturn
| Type | Description |
|---|---|
| String | object type |
GetStatus
Get the store's status
method : public : GetStatus() ~ StringReturn
| Type | Description |
|---|---|
| String | store's status |
ListStores
Lists vector stores
function : ListStores(token:String) ~ Vector<VectorStore>Parameters
| Name | Type | Description |
|---|---|---|
| token | String | API token |
Return
| Type | Description |
|---|---|
| Vector<VectorStore> | list of vector stores |
ListStores
Lists vector stores
function : ListStores(non_empties:Bool, token:String) ~ Vector<VectorStore>Parameters
| Name | Type | Description |
|---|---|---|
| non_empties | Bool | if true, non empty stores are include, otherwise excluded |
| token | String | API token |
Return
| Type | Description |
|---|---|
| Vector<VectorStore> | list of vector stores |
Load
Load a store
function : Load(store_id:String, token:String) ~ API.OpenAI.VectorStoreParameters
| Name | Type | Description |
|---|---|---|
| store_id | String | vector store ID |
| token | String | API token |
Return
| Type | Description |
|---|---|
| VectorStore | vector store |
ToString
String representation of the object
method : public : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string representation |