@memberjunction/ai-vectordb 5.33.0 → 5.34.1
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserInfo } from '@memberjunction/core';
|
|
1
2
|
import { BaseRequestParams, BaseResponse, CreateIndexParams, EditIndexParams, IndexList, ListVectorIDsParams, ListVectorIDsResult, UpdateOptions, VectorRecord } from "./record.js";
|
|
2
3
|
import { HybridQueryOptions, QueryOptions } from './query.types.js';
|
|
3
4
|
import { SharedIndexFilterOptions } from './MetadataFilter.js';
|
|
@@ -13,7 +14,19 @@ export declare abstract class VectorDBBase {
|
|
|
13
14
|
abstract CreateIndex(params: CreateIndexParams): BaseResponse | Promise<BaseResponse>;
|
|
14
15
|
abstract DeleteIndex(params: BaseRequestParams): BaseResponse | Promise<BaseResponse>;
|
|
15
16
|
abstract EditIndex(params: EditIndexParams): BaseResponse | Promise<BaseResponse>;
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Query an index for nearest neighbours.
|
|
19
|
+
*
|
|
20
|
+
* @param params - Query parameters (vector or record id, topK, filter, etc.)
|
|
21
|
+
* @param contextUser - Optional caller identity. Remote drivers (Pinecone,
|
|
22
|
+
* Qdrant, pgvector) authenticate via their own credentials and ignore
|
|
23
|
+
* this parameter. In-process drivers that need to honor server-side
|
|
24
|
+
* row-level security (e.g. SimpleVectorDatabase, which calls RunView
|
|
25
|
+
* to load entity vectors) require it. Pattern matches MJ's
|
|
26
|
+
* `RunView(params, contextUser)` and `GetEntityObject(name, contextUser)`
|
|
27
|
+
* conventions.
|
|
28
|
+
*/
|
|
29
|
+
abstract QueryIndex(params: QueryOptions, contextUser?: UserInfo): BaseResponse | Promise<BaseResponse>;
|
|
17
30
|
abstract CreateRecord(record: VectorRecord, indexName?: string): BaseResponse | Promise<BaseResponse>;
|
|
18
31
|
abstract CreateRecords(records: VectorRecord[], indexName?: string): BaseResponse | Promise<BaseResponse>;
|
|
19
32
|
abstract GetRecord(param: BaseRequestParams): BaseResponse | Promise<BaseResponse>;
|
|
@@ -47,7 +60,7 @@ export declare abstract class VectorDBBase {
|
|
|
47
60
|
* Only available on providers where SupportsHybridSearch is true.
|
|
48
61
|
* Default implementation falls back to a standard vector QueryIndex call.
|
|
49
62
|
*/
|
|
50
|
-
HybridQuery(params: HybridQueryOptions): BaseResponse | Promise<BaseResponse>;
|
|
63
|
+
HybridQuery(params: HybridQueryOptions, contextUser?: UserInfo): BaseResponse | Promise<BaseResponse>;
|
|
51
64
|
/**
|
|
52
65
|
* Query the vector index with metadata filtering using SharedIndexFilterOptions.
|
|
53
66
|
*
|
|
@@ -60,7 +73,7 @@ export declare abstract class VectorDBBase {
|
|
|
60
73
|
*/
|
|
61
74
|
MetadataFilteredQuery(params: QueryOptions & {
|
|
62
75
|
metadataFilter: SharedIndexFilterOptions;
|
|
63
|
-
}): BaseResponse | Promise<BaseResponse>;
|
|
76
|
+
}, contextUser?: UserInfo): BaseResponse | Promise<BaseResponse>;
|
|
64
77
|
/**
|
|
65
78
|
* Convert SharedIndexFilterOptions to a provider-native filter object.
|
|
66
79
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorDBBase.d.ts","sourceRoot":"","sources":["../../src/generic/VectorDBBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EACnD,eAAe,EAAE,SAAS,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,aAAa,EACnF,YAAY,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAwB,MAAM,kBAAkB,CAAC;AAElF,8BAAsB,YAAY;IAC9B,OAAO,CAAC,OAAO,CAAS;IACxB;;OAEG;IACH,SAAS,KAAK,MAAM,IAAI,MAAM,CAE7B;gBAEY,MAAM,EA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AAE,YAAY,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAI,OAAO,CAAC,YAAY,CAAC;IAE1G;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAEtG;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAEjF;;;OAGG;IACH,IAAW,oBAAoB,IAAI,OAAO,CAEzC;IAED;;;;OAIG;IACI,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAK5G;;;;;;;;;OASG;IACI,qBAAqB,CACxB,MAAM,EAAE,YAAY,GAAG;QAAE,cAAc,EAAE,wBAAwB,CAAA;KAAE,EACnE,WAAW,CAAC,EAAE,QAAQ,GACvB,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAWvC;;;;;;;;OAQG;IACI,mBAAmB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,GAAG,SAAS;CAGpF"}
|
|
@@ -23,9 +23,9 @@ export class VectorDBBase {
|
|
|
23
23
|
* Only available on providers where SupportsHybridSearch is true.
|
|
24
24
|
* Default implementation falls back to a standard vector QueryIndex call.
|
|
25
25
|
*/
|
|
26
|
-
HybridQuery(params) {
|
|
26
|
+
HybridQuery(params, contextUser) {
|
|
27
27
|
// Default: fall back to pure vector search, ignoring keyword params
|
|
28
|
-
return this.QueryIndex({ vector: params.vector, topK: params.topK, includeMetadata: params.includeMetadata, includeValues: params.includeValues, filter: params.filter });
|
|
28
|
+
return this.QueryIndex({ vector: params.vector, topK: params.topK, includeMetadata: params.includeMetadata, includeValues: params.includeValues, filter: params.filter }, contextUser);
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Query the vector index with metadata filtering using SharedIndexFilterOptions.
|
|
@@ -37,7 +37,7 @@ export class VectorDBBase {
|
|
|
37
37
|
* @param params - Standard query options with an additional metadataFilter field
|
|
38
38
|
* @returns The query response from the vector database
|
|
39
39
|
*/
|
|
40
|
-
MetadataFilteredQuery(params) {
|
|
40
|
+
MetadataFilteredQuery(params, contextUser) {
|
|
41
41
|
const nativeFilter = this.BuildMetadataFilter(params.metadataFilter);
|
|
42
42
|
const queryParams = {
|
|
43
43
|
...params,
|
|
@@ -45,7 +45,7 @@ export class VectorDBBase {
|
|
|
45
45
|
};
|
|
46
46
|
// Remove the metadataFilter before passing to QueryIndex
|
|
47
47
|
delete queryParams['metadataFilter'];
|
|
48
|
-
return this.QueryIndex(queryParams);
|
|
48
|
+
return this.QueryIndex(queryParams, contextUser);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Convert SharedIndexFilterOptions to a provider-native filter object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorDBBase.js","sourceRoot":"","sources":["../../src/generic/VectorDBBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VectorDBBase.js","sourceRoot":"","sources":["../../src/generic/VectorDBBase.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4B,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAElF,MAAM,OAAgB,YAAY;IAE9B;;OAEG;IACH,IAAc,MAAM;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,YAAa,MAAc;QACvB,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAE/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAgDD;;;OAGG;IACH,IAAW,oBAAoB;QAC3B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,MAA0B,EAAE,WAAsB;QACjE,oEAAoE;QACpE,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC;IAC3L,CAAC;IAED;;;;;;;;;OASG;IACI,qBAAqB,CACxB,MAAmE,EACnE,WAAsB;QAEtB,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACrE,MAAM,WAAW,GAAiB;YAC9B,GAAG,MAAM;YACT,MAAM,EAAE,YAAY,IAAI,MAAM,CAAC,MAAM;SACxC,CAAC;QACF,yDAAyD;QACzD,OAAQ,WAAuC,CAAC,gBAAgB,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;OAQG;IACI,mBAAmB,CAAC,OAAiC;QACxD,OAAO,oBAAoB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ai-vectordb",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.34.1",
|
|
5
5
|
"description": "MemberJunction: AI Vector Database Module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"author": "MemberJunction.com",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@memberjunction/core": "5.
|
|
21
|
-
"@memberjunction/global": "5.
|
|
20
|
+
"@memberjunction/core": "5.34.1",
|
|
21
|
+
"@memberjunction/global": "5.34.1",
|
|
22
22
|
"dotenv": "^17.2.4"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|