@vectorstores/firestore 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -99,12 +99,12 @@ class FirestoreVectorStore extends core.BaseVectorStore {
99
99
  return ids;
100
100
  }
101
101
  /**
102
- * Deletes all nodes from the vector store that match the given filename
103
- * @param {string} fileName - Name of the file whose nodes should be deleted
102
+ * Deletes all nodes from the vector store that belong to the given document.
103
+ * @param {string} refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
104
104
  * @returns {Promise<void>}
105
- */ async delete(fileName) {
105
+ */ async delete(refDocId) {
106
106
  const collection = this.customCollectionReference(this.firestoreClient.collection(this.collectionName));
107
- const snapshot = await collection.where(`${this.metadataKey}.file_name`, "==", fileName).get();
107
+ const snapshot = await collection.where(`${this.metadataKey}.ref_doc_id`, "==", refDocId).get();
108
108
  const batch = this.firestoreClient.batch();
109
109
  snapshot.docs.forEach((doc)=>{
110
110
  batch.delete(doc.ref);
@@ -158,6 +158,11 @@ class FirestoreVectorStore extends core.BaseVectorStore {
158
158
  ids: topKIds
159
159
  };
160
160
  }
161
+ async exists(refDocId) {
162
+ const collection = this.customCollectionReference(this.firestoreClient.collection(this.collectionName));
163
+ const snapshot = await collection.where(`${this.metadataKey}.ref_doc_id`, "==", refDocId).limit(1).get();
164
+ return !snapshot.empty;
165
+ }
161
166
  }
162
167
 
163
168
  exports.FirestoreVectorStore = FirestoreVectorStore;
package/dist/index.d.cts CHANGED
@@ -42,11 +42,11 @@ declare class FirestoreVectorStore extends BaseVectorStore<Firestore> {
42
42
  */
43
43
  add(nodes: BaseNode<Metadata>[]): Promise<string[]>;
44
44
  /**
45
- * Deletes all nodes from the vector store that match the given filename
46
- * @param {string} fileName - Name of the file whose nodes should be deleted
45
+ * Deletes all nodes from the vector store that belong to the given document.
46
+ * @param {string} refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
47
47
  * @returns {Promise<void>}
48
48
  */
49
- delete(fileName: string): Promise<void>;
49
+ delete(refDocId: string): Promise<void>;
50
50
  /**
51
51
  * Queries the vector store for similar nodes
52
52
  * @param {VectorStoreQuery} query - Query parameters including queryStr or queryEmbedding, filters, and similarityTopK
@@ -55,6 +55,7 @@ declare class FirestoreVectorStore extends BaseVectorStore<Firestore> {
55
55
  * @throws {Error} When neither queryEmbedding nor queryStr is provided
56
56
  */
57
57
  query(query: VectorStoreQuery, _options?: object): Promise<VectorStoreQueryResult>;
58
+ exists(refDocId: string): Promise<boolean>;
58
59
  }
59
60
 
60
61
  export { FirestoreVectorStore };
package/dist/index.d.ts CHANGED
@@ -42,11 +42,11 @@ declare class FirestoreVectorStore extends BaseVectorStore<Firestore> {
42
42
  */
43
43
  add(nodes: BaseNode<Metadata>[]): Promise<string[]>;
44
44
  /**
45
- * Deletes all nodes from the vector store that match the given filename
46
- * @param {string} fileName - Name of the file whose nodes should be deleted
45
+ * Deletes all nodes from the vector store that belong to the given document.
46
+ * @param {string} refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
47
47
  * @returns {Promise<void>}
48
48
  */
49
- delete(fileName: string): Promise<void>;
49
+ delete(refDocId: string): Promise<void>;
50
50
  /**
51
51
  * Queries the vector store for similar nodes
52
52
  * @param {VectorStoreQuery} query - Query parameters including queryStr or queryEmbedding, filters, and similarityTopK
@@ -55,6 +55,7 @@ declare class FirestoreVectorStore extends BaseVectorStore<Firestore> {
55
55
  * @throws {Error} When neither queryEmbedding nor queryStr is provided
56
56
  */
57
57
  query(query: VectorStoreQuery, _options?: object): Promise<VectorStoreQueryResult>;
58
+ exists(refDocId: string): Promise<boolean>;
58
59
  }
59
60
 
60
61
  export { FirestoreVectorStore };
@@ -42,11 +42,11 @@ declare class FirestoreVectorStore extends BaseVectorStore<Firestore> {
42
42
  */
43
43
  add(nodes: BaseNode<Metadata>[]): Promise<string[]>;
44
44
  /**
45
- * Deletes all nodes from the vector store that match the given filename
46
- * @param {string} fileName - Name of the file whose nodes should be deleted
45
+ * Deletes all nodes from the vector store that belong to the given document.
46
+ * @param {string} refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
47
47
  * @returns {Promise<void>}
48
48
  */
49
- delete(fileName: string): Promise<void>;
49
+ delete(refDocId: string): Promise<void>;
50
50
  /**
51
51
  * Queries the vector store for similar nodes
52
52
  * @param {VectorStoreQuery} query - Query parameters including queryStr or queryEmbedding, filters, and similarityTopK
@@ -55,6 +55,7 @@ declare class FirestoreVectorStore extends BaseVectorStore<Firestore> {
55
55
  * @throws {Error} When neither queryEmbedding nor queryStr is provided
56
56
  */
57
57
  query(query: VectorStoreQuery, _options?: object): Promise<VectorStoreQueryResult>;
58
+ exists(refDocId: string): Promise<boolean>;
58
59
  }
59
60
 
60
61
  export { FirestoreVectorStore };
@@ -97,12 +97,12 @@ class FirestoreVectorStore extends BaseVectorStore {
97
97
  return ids;
98
98
  }
99
99
  /**
100
- * Deletes all nodes from the vector store that match the given filename
101
- * @param {string} fileName - Name of the file whose nodes should be deleted
100
+ * Deletes all nodes from the vector store that belong to the given document.
101
+ * @param {string} refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
102
102
  * @returns {Promise<void>}
103
- */ async delete(fileName) {
103
+ */ async delete(refDocId) {
104
104
  const collection = this.customCollectionReference(this.firestoreClient.collection(this.collectionName));
105
- const snapshot = await collection.where(`${this.metadataKey}.file_name`, "==", fileName).get();
105
+ const snapshot = await collection.where(`${this.metadataKey}.ref_doc_id`, "==", refDocId).get();
106
106
  const batch = this.firestoreClient.batch();
107
107
  snapshot.docs.forEach((doc)=>{
108
108
  batch.delete(doc.ref);
@@ -156,6 +156,11 @@ class FirestoreVectorStore extends BaseVectorStore {
156
156
  ids: topKIds
157
157
  };
158
158
  }
159
+ async exists(refDocId) {
160
+ const collection = this.customCollectionReference(this.firestoreClient.collection(this.collectionName));
161
+ const snapshot = await collection.where(`${this.metadataKey}.ref_doc_id`, "==", refDocId).limit(1).get();
162
+ return !snapshot.empty;
163
+ }
159
164
  }
160
165
 
161
166
  export { FirestoreVectorStore };
package/dist/index.js CHANGED
@@ -97,12 +97,12 @@ class FirestoreVectorStore extends BaseVectorStore {
97
97
  return ids;
98
98
  }
99
99
  /**
100
- * Deletes all nodes from the vector store that match the given filename
101
- * @param {string} fileName - Name of the file whose nodes should be deleted
100
+ * Deletes all nodes from the vector store that belong to the given document.
101
+ * @param {string} refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
102
102
  * @returns {Promise<void>}
103
- */ async delete(fileName) {
103
+ */ async delete(refDocId) {
104
104
  const collection = this.customCollectionReference(this.firestoreClient.collection(this.collectionName));
105
- const snapshot = await collection.where(`${this.metadataKey}.file_name`, "==", fileName).get();
105
+ const snapshot = await collection.where(`${this.metadataKey}.ref_doc_id`, "==", refDocId).get();
106
106
  const batch = this.firestoreClient.batch();
107
107
  snapshot.docs.forEach((doc)=>{
108
108
  batch.delete(doc.ref);
@@ -156,6 +156,11 @@ class FirestoreVectorStore extends BaseVectorStore {
156
156
  ids: topKIds
157
157
  };
158
158
  }
159
+ async exists(refDocId) {
160
+ const collection = this.customCollectionReference(this.firestoreClient.collection(this.collectionName));
161
+ const snapshot = await collection.where(`${this.metadataKey}.ref_doc_id`, "==", refDocId).limit(1).get();
162
+ return !snapshot.empty;
163
+ }
159
164
  }
160
165
 
161
166
  export { FirestoreVectorStore };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vectorstores/firestore",
3
3
  "description": "Firestore Storage for vectorstores",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -34,11 +34,11 @@
34
34
  "directory": "packages/providers/storage/firestore"
35
35
  },
36
36
  "devDependencies": {
37
- "@vectorstores/core": "0.1.3",
37
+ "@vectorstores/core": "0.1.5",
38
38
  "@vectorstores/env": "0.1.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@vectorstores/core": "0.1.3",
41
+ "@vectorstores/core": "0.1.5",
42
42
  "@vectorstores/env": "0.1.0"
43
43
  },
44
44
  "dependencies": {