firstbatchxyz / firstbatch-sdk-ts

TypeScript SDK for FirstBatch: Real-time Personalization using VectorDBs.
https://firstbatch.xyz/
MIT License
5 stars 1 forks source link

Redundant existence checks during `addVdb` #17

Closed erhant closed 8 months ago

erhant commented 8 months ago

addVdb checks if the given vectorDB with vdbid exists via an API call. Sometimes we can be SURE that it exists, i.e. we have done the setup and this thing works in a serverless function etc. so we dont have to check for existence in those cases.

It is possible to bypass this by doing:

sdk.store[vdbid] = vectorStore;

instead of

await sdk.addVdb(vdbid, vectorStore);

which saves making an api call.

We can make this clear to the user via docs, perhaps?

erhant commented 8 months ago

Added docs to addVdb function for this, as most of the time this will not matter to the user unless they are using a really constrained serverless environment.

erhant commented 8 months ago

Will close with PR*