Enable batch deletion of Pinecone Ids by max limit of 1000 (#210)

* Enable batch deletion of Pinecone Ids by max limit of 1000

* lint
This commit is contained in:
Timothy Carambat 2023-08-22 09:25:55 -07:00 committed by GitHub
parent b01e49bb3c
commit c019f5abfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,10 +185,12 @@ const Pinecone = {
if (knownDocuments.length === 0) return;
const vectorIds = knownDocuments.map((doc) => doc.vectorId);
await pineconeIndex.delete1({
ids: vectorIds,
namespace,
});
for (const batchOfVectorIds of toChunks(vectorIds, 1000)) {
await pineconeIndex.delete1({
ids: batchOfVectorIds,
namespace,
});
}
const indexes = knownDocuments.map((doc) => doc.id);
await DocumentVectors.deleteIds(indexes);