VectorStoreService
Upgather SDK / VectorStoreService
Class: VectorStoreService
Defined in: lib/services/VectorStoreService.ts:97
Orchestrates file operations (add/update/remove) in your OpenAI vector store, scoped by eventId in Strapi.
Constructors
new VectorStoreService()
new VectorStoreService(
strapi,logger?):VectorStoreService
Defined in: lib/services/VectorStoreService.ts:106
Creates an instance of VectorStoreService.
Parameters
strapi
The StrapiService instance for interacting with Strapi CMS
logger?
Optional logger instance. If not provided, uses a silent logger.
Returns
Methods
addFile()
addFile(
eventId,file,filename?,options?):Promise<UploadedFile>
Defined in: lib/services/VectorStoreService.ts:232
Add a new file to the vector store for a given event.
Parameters
eventId
string
Strapi event identifier.
file
File to upload (Buffer, Readable, or FileObject).
FileObject | Buffer<ArrayBufferLike> | Readable
filename?
string
Optional filename for buffer uploads.
options?
Optional configuration including OpenAI key.
Returns
Promise<UploadedFile>
The uploaded file information.
Throws
Error if upload or association fails.
getVectorConfig()
getVectorConfig(
eventId,providedKey?):Promise<{openAiKey:string;orgKey:string;vectorStoreId:string; }>
Defined in: lib/services/VectorStoreService.ts:121
Fetches the OpenAI API key and vector-store ID for a given event.
Parameters
eventId
string
The Strapi eventId (api::event.event → eventId)
providedKey?
string
Optional OpenAI key to use instead of the org key
Returns
Promise<{ openAiKey: string; orgKey: string; vectorStoreId: string; }>
An object containing:
- openAiKey: the OpenAI key (provided key takes precedence)
- vectorStoreId: the vector store identifier (
VectorStore.vector_store_id) - orgKey: the organization's key (for fallback purposes)
Throws
Error if the event, organization, or vector store is missing or mis-configured.
removeFile()
removeFile(
eventId,fileId,options?):Promise<FileDeleted&object>
Defined in: lib/services/VectorStoreService.ts:444
Remove a file from the vector store and delete it from OpenAI's file storage.
Parameters
eventId
string
Strapi event identifier.
fileId
string
ID of the file to remove.
options?
Optional configuration including OpenAI key.