@vectorstores/astra 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 +19 -6
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.edge-light.d.ts +5 -4
- package/dist/index.edge-light.js +19 -6
- package/dist/index.js +19 -6
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -82,19 +82,19 @@ class AstraDBVectorStore extends core.BaseVectorStore {
|
|
|
82
82
|
return insertResult.insertedIds;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* Delete
|
|
85
|
+
* Delete all nodes from your Astra DB collection that belong to the given document.
|
|
86
86
|
*
|
|
87
|
-
* @param refDocId -
|
|
88
|
-
* @param deleteOptions -
|
|
87
|
+
* @param refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
|
|
88
|
+
* @param deleteOptions - DeleteManyOptions to pass to the delete query
|
|
89
89
|
* @returns Promise that resolves if the delete query did not throw an error.
|
|
90
90
|
*/ async delete(refDocId, deleteOptions) {
|
|
91
91
|
if (!this.collection) {
|
|
92
92
|
throw new Error("Must connect to collection before deleting.");
|
|
93
93
|
}
|
|
94
94
|
const collection = this.collection;
|
|
95
|
-
console.debug(`Deleting
|
|
96
|
-
await collection.
|
|
97
|
-
|
|
95
|
+
console.debug(`Deleting all nodes with ref_doc_id ${refDocId}`);
|
|
96
|
+
await collection.deleteMany({
|
|
97
|
+
ref_doc_id: refDocId
|
|
98
98
|
}, deleteOptions);
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -210,6 +210,19 @@ class AstraDBVectorStore extends core.BaseVectorStore {
|
|
|
210
210
|
throw new Error(`Not supported filter operator: ${operator}`);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
+
async exists(refDocId) {
|
|
214
|
+
if (!this.collection) {
|
|
215
|
+
throw new Error("Must connect to collection before querying.");
|
|
216
|
+
}
|
|
217
|
+
const result = await this.collection.findOne({
|
|
218
|
+
ref_doc_id: refDocId
|
|
219
|
+
}, {
|
|
220
|
+
projection: {
|
|
221
|
+
_id: 1
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
return result !== null;
|
|
225
|
+
}
|
|
213
226
|
}
|
|
214
227
|
|
|
215
228
|
exports.AstraDBVectorStore = AstraDBVectorStore;
|
package/dist/index.d.cts
CHANGED
|
@@ -45,13 +45,13 @@ declare class AstraDBVectorStore extends BaseVectorStore {
|
|
|
45
45
|
*/
|
|
46
46
|
add(nodes: BaseNode[]): Promise<string[]>;
|
|
47
47
|
/**
|
|
48
|
-
* Delete
|
|
48
|
+
* Delete all nodes from your Astra DB collection that belong to the given document.
|
|
49
49
|
*
|
|
50
|
-
* @param refDocId -
|
|
51
|
-
* @param deleteOptions -
|
|
50
|
+
* @param refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
|
|
51
|
+
* @param deleteOptions - DeleteManyOptions to pass to the delete query
|
|
52
52
|
* @returns Promise that resolves if the delete query did not throw an error.
|
|
53
53
|
*/
|
|
54
|
-
delete(refDocId: string, deleteOptions?: Parameters<Collection["
|
|
54
|
+
delete(refDocId: string, deleteOptions?: Parameters<Collection["deleteMany"]>[1]): Promise<void>;
|
|
55
55
|
/**
|
|
56
56
|
* Query documents from your Astra DB collection to get the closest match to your embedding.
|
|
57
57
|
*
|
|
@@ -61,6 +61,7 @@ declare class AstraDBVectorStore extends BaseVectorStore {
|
|
|
61
61
|
query(query: VectorStoreQuery, options?: Parameters<Collection["find"]>[1]): Promise<VectorStoreQueryResult>;
|
|
62
62
|
private toAstraFilter;
|
|
63
63
|
private buildFilterItem;
|
|
64
|
+
exists(refDocId: string): Promise<boolean>;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
export { AstraDBVectorStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,13 +45,13 @@ declare class AstraDBVectorStore extends BaseVectorStore {
|
|
|
45
45
|
*/
|
|
46
46
|
add(nodes: BaseNode[]): Promise<string[]>;
|
|
47
47
|
/**
|
|
48
|
-
* Delete
|
|
48
|
+
* Delete all nodes from your Astra DB collection that belong to the given document.
|
|
49
49
|
*
|
|
50
|
-
* @param refDocId -
|
|
51
|
-
* @param deleteOptions -
|
|
50
|
+
* @param refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
|
|
51
|
+
* @param deleteOptions - DeleteManyOptions to pass to the delete query
|
|
52
52
|
* @returns Promise that resolves if the delete query did not throw an error.
|
|
53
53
|
*/
|
|
54
|
-
delete(refDocId: string, deleteOptions?: Parameters<Collection["
|
|
54
|
+
delete(refDocId: string, deleteOptions?: Parameters<Collection["deleteMany"]>[1]): Promise<void>;
|
|
55
55
|
/**
|
|
56
56
|
* Query documents from your Astra DB collection to get the closest match to your embedding.
|
|
57
57
|
*
|
|
@@ -61,6 +61,7 @@ declare class AstraDBVectorStore extends BaseVectorStore {
|
|
|
61
61
|
query(query: VectorStoreQuery, options?: Parameters<Collection["find"]>[1]): Promise<VectorStoreQueryResult>;
|
|
62
62
|
private toAstraFilter;
|
|
63
63
|
private buildFilterItem;
|
|
64
|
+
exists(refDocId: string): Promise<boolean>;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
export { AstraDBVectorStore };
|
|
@@ -45,13 +45,13 @@ declare class AstraDBVectorStore extends BaseVectorStore {
|
|
|
45
45
|
*/
|
|
46
46
|
add(nodes: BaseNode[]): Promise<string[]>;
|
|
47
47
|
/**
|
|
48
|
-
* Delete
|
|
48
|
+
* Delete all nodes from your Astra DB collection that belong to the given document.
|
|
49
49
|
*
|
|
50
|
-
* @param refDocId -
|
|
51
|
-
* @param deleteOptions -
|
|
50
|
+
* @param refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
|
|
51
|
+
* @param deleteOptions - DeleteManyOptions to pass to the delete query
|
|
52
52
|
* @returns Promise that resolves if the delete query did not throw an error.
|
|
53
53
|
*/
|
|
54
|
-
delete(refDocId: string, deleteOptions?: Parameters<Collection["
|
|
54
|
+
delete(refDocId: string, deleteOptions?: Parameters<Collection["deleteMany"]>[1]): Promise<void>;
|
|
55
55
|
/**
|
|
56
56
|
* Query documents from your Astra DB collection to get the closest match to your embedding.
|
|
57
57
|
*
|
|
@@ -61,6 +61,7 @@ declare class AstraDBVectorStore extends BaseVectorStore {
|
|
|
61
61
|
query(query: VectorStoreQuery, options?: Parameters<Collection["find"]>[1]): Promise<VectorStoreQueryResult>;
|
|
62
62
|
private toAstraFilter;
|
|
63
63
|
private buildFilterItem;
|
|
64
|
+
exists(refDocId: string): Promise<boolean>;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
export { AstraDBVectorStore };
|
package/dist/index.edge-light.js
CHANGED
|
@@ -80,19 +80,19 @@ class AstraDBVectorStore extends BaseVectorStore {
|
|
|
80
80
|
return insertResult.insertedIds;
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* Delete
|
|
83
|
+
* Delete all nodes from your Astra DB collection that belong to the given document.
|
|
84
84
|
*
|
|
85
|
-
* @param refDocId -
|
|
86
|
-
* @param deleteOptions -
|
|
85
|
+
* @param refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
|
|
86
|
+
* @param deleteOptions - DeleteManyOptions to pass to the delete query
|
|
87
87
|
* @returns Promise that resolves if the delete query did not throw an error.
|
|
88
88
|
*/ async delete(refDocId, deleteOptions) {
|
|
89
89
|
if (!this.collection) {
|
|
90
90
|
throw new Error("Must connect to collection before deleting.");
|
|
91
91
|
}
|
|
92
92
|
const collection = this.collection;
|
|
93
|
-
console.debug(`Deleting
|
|
94
|
-
await collection.
|
|
95
|
-
|
|
93
|
+
console.debug(`Deleting all nodes with ref_doc_id ${refDocId}`);
|
|
94
|
+
await collection.deleteMany({
|
|
95
|
+
ref_doc_id: refDocId
|
|
96
96
|
}, deleteOptions);
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
@@ -208,6 +208,19 @@ class AstraDBVectorStore extends BaseVectorStore {
|
|
|
208
208
|
throw new Error(`Not supported filter operator: ${operator}`);
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
+
async exists(refDocId) {
|
|
212
|
+
if (!this.collection) {
|
|
213
|
+
throw new Error("Must connect to collection before querying.");
|
|
214
|
+
}
|
|
215
|
+
const result = await this.collection.findOne({
|
|
216
|
+
ref_doc_id: refDocId
|
|
217
|
+
}, {
|
|
218
|
+
projection: {
|
|
219
|
+
_id: 1
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
return result !== null;
|
|
223
|
+
}
|
|
211
224
|
}
|
|
212
225
|
|
|
213
226
|
export { AstraDBVectorStore };
|
package/dist/index.js
CHANGED
|
@@ -80,19 +80,19 @@ class AstraDBVectorStore extends BaseVectorStore {
|
|
|
80
80
|
return insertResult.insertedIds;
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* Delete
|
|
83
|
+
* Delete all nodes from your Astra DB collection that belong to the given document.
|
|
84
84
|
*
|
|
85
|
-
* @param refDocId -
|
|
86
|
-
* @param deleteOptions -
|
|
85
|
+
* @param refDocId - Reference document ID - all nodes with this ref_doc_id will be deleted.
|
|
86
|
+
* @param deleteOptions - DeleteManyOptions to pass to the delete query
|
|
87
87
|
* @returns Promise that resolves if the delete query did not throw an error.
|
|
88
88
|
*/ async delete(refDocId, deleteOptions) {
|
|
89
89
|
if (!this.collection) {
|
|
90
90
|
throw new Error("Must connect to collection before deleting.");
|
|
91
91
|
}
|
|
92
92
|
const collection = this.collection;
|
|
93
|
-
console.debug(`Deleting
|
|
94
|
-
await collection.
|
|
95
|
-
|
|
93
|
+
console.debug(`Deleting all nodes with ref_doc_id ${refDocId}`);
|
|
94
|
+
await collection.deleteMany({
|
|
95
|
+
ref_doc_id: refDocId
|
|
96
96
|
}, deleteOptions);
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
@@ -208,6 +208,19 @@ class AstraDBVectorStore extends BaseVectorStore {
|
|
|
208
208
|
throw new Error(`Not supported filter operator: ${operator}`);
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
+
async exists(refDocId) {
|
|
212
|
+
if (!this.collection) {
|
|
213
|
+
throw new Error("Must connect to collection before querying.");
|
|
214
|
+
}
|
|
215
|
+
const result = await this.collection.findOne({
|
|
216
|
+
ref_doc_id: refDocId
|
|
217
|
+
}, {
|
|
218
|
+
projection: {
|
|
219
|
+
_id: 1
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
return result !== null;
|
|
223
|
+
}
|
|
211
224
|
}
|
|
212
225
|
|
|
213
226
|
export { AstraDBVectorStore };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectorstores/astra",
|
|
3
3
|
"description": "Astra Storage for vectorstores",
|
|
4
|
-
"version": "0.1.
|
|
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/astra"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@vectorstores/core": "0.1.
|
|
37
|
+
"@vectorstores/core": "0.1.5",
|
|
38
38
|
"@vectorstores/env": "0.1.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@vectorstores/core": "0.1.
|
|
41
|
+
"@vectorstores/core": "0.1.5",
|
|
42
42
|
"@vectorstores/env": "0.1.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|