@langchain/google-cloud-sql-pg 0.0.2 → 1.0.0
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/CHANGELOG.md +17 -0
- package/LICENSE +6 -6
- package/README.md +1 -1
- package/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/chat_message_history.cjs +104 -137
- package/dist/chat_message_history.cjs.map +1 -0
- package/dist/chat_message_history.d.cts +57 -0
- package/dist/chat_message_history.d.cts.map +1 -0
- package/dist/chat_message_history.d.ts +53 -43
- package/dist/chat_message_history.d.ts.map +1 -0
- package/dist/chat_message_history.js +103 -133
- package/dist/chat_message_history.js.map +1 -0
- package/dist/engine.cjs +188 -242
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +138 -0
- package/dist/engine.d.cts.map +1 -0
- package/dist/engine.d.ts +102 -80
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +186 -234
- package/dist/engine.js.map +1 -0
- package/dist/index.cjs +21 -20
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +7 -4
- package/dist/indexes.cjs +96 -168
- package/dist/indexes.cjs.map +1 -0
- package/dist/indexes.d.cts +68 -0
- package/dist/indexes.d.cts.map +1 -0
- package/dist/indexes.d.ts +50 -47
- package/dist/indexes.d.ts.map +1 -0
- package/dist/indexes.js +90 -161
- package/dist/indexes.js.map +1 -0
- package/dist/loader.cjs +159 -242
- package/dist/loader.cjs.map +1 -0
- package/dist/loader.d.cts +101 -0
- package/dist/loader.d.cts.map +1 -0
- package/dist/loader.d.ts +40 -26
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +157 -237
- package/dist/loader.js.map +1 -0
- package/dist/utils/utils.cjs +36 -65
- package/dist/utils/utils.cjs.map +1 -0
- package/dist/utils/utils.js +36 -62
- package/dist/utils/utils.js.map +1 -0
- package/dist/vectorstore.cjs +438 -593
- package/dist/vectorstore.cjs.map +1 -0
- package/dist/vectorstore.d.cts +300 -0
- package/dist/vectorstore.d.cts.map +1 -0
- package/dist/vectorstore.d.ts +147 -130
- package/dist/vectorstore.d.ts.map +1 -0
- package/dist/vectorstore.js +436 -588
- package/dist/vectorstore.js.map +1 -0
- package/package.json +38 -47
- package/dist/utils/utils.d.ts +0 -22
- package/index.cjs +0 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
package/dist/indexes.cjs
CHANGED
|
@@ -1,174 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value: void 0
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(this, "indexFunction", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: void 0
|
|
23
|
-
});
|
|
24
|
-
this.operator = operator;
|
|
25
|
-
this.searchFunction = searchFunction;
|
|
26
|
-
this.indexFunction = indexFunction;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
|
|
2
|
+
//#region src/indexes.ts
|
|
3
|
+
var StrategyMixin = class {
|
|
4
|
+
operator;
|
|
5
|
+
searchFunction;
|
|
6
|
+
indexFunction;
|
|
7
|
+
constructor(operator, searchFunction, indexFunction) {
|
|
8
|
+
this.operator = operator;
|
|
9
|
+
this.searchFunction = searchFunction;
|
|
10
|
+
this.indexFunction = indexFunction;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
29
13
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
14
|
+
* Enumerator of the Distance strategies.
|
|
15
|
+
*/
|
|
16
|
+
var DistanceStrategy = class extends StrategyMixin {
|
|
17
|
+
static EUCLIDEAN = new StrategyMixin("<->", "l2_distance", "vector_l2_ops");
|
|
18
|
+
static COSINE_DISTANCE = new StrategyMixin("<=>", "cosine_distance", "vector_cosine_ops");
|
|
19
|
+
static INNER_PRODUCT = new StrategyMixin("<#>", "inner_product", "vector_ip_ops");
|
|
20
|
+
};
|
|
21
|
+
const DEFAULT_DISTANCE_STRATEGY = DistanceStrategy.COSINE_DISTANCE;
|
|
22
|
+
const DEFAULT_INDEX_NAME_SUFFIX = "langchainvectorindex";
|
|
23
|
+
var BaseIndex = class {
|
|
24
|
+
name;
|
|
25
|
+
indexType;
|
|
26
|
+
distanceStrategy;
|
|
27
|
+
partialIndexes;
|
|
28
|
+
constructor(name, indexType = "base", distanceStrategy = DistanceStrategy.COSINE_DISTANCE, partialIndexes = []) {
|
|
29
|
+
this.name = name;
|
|
30
|
+
this.indexType = indexType;
|
|
31
|
+
this.distanceStrategy = distanceStrategy;
|
|
32
|
+
this.partialIndexes = partialIndexes;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var ExactNearestNeighbor = class extends BaseIndex {
|
|
36
|
+
constructor(baseArgs) {
|
|
37
|
+
super(baseArgs?.name, "exactnearestneighbor", baseArgs?.distanceStrategy, baseArgs?.partialIndexes);
|
|
38
|
+
}
|
|
39
|
+
indexOptions() {
|
|
40
|
+
throw new Error("indexOptions method must be implemented by subclass");
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var HNSWIndex = class extends BaseIndex {
|
|
44
|
+
m;
|
|
45
|
+
efConstruction;
|
|
46
|
+
constructor(baseArgs, m, efConstruction) {
|
|
47
|
+
super(baseArgs?.name, "hnsw", baseArgs?.distanceStrategy, baseArgs?.partialIndexes);
|
|
48
|
+
this.m = m ?? 16;
|
|
49
|
+
this.efConstruction = efConstruction ?? 64;
|
|
50
|
+
}
|
|
51
|
+
indexOptions() {
|
|
52
|
+
return `(m = ${this.m}, ef_construction = ${this.efConstruction})`;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var IVFFlatIndex = class extends BaseIndex {
|
|
56
|
+
lists;
|
|
57
|
+
constructor(baseArgs, lists) {
|
|
58
|
+
super(baseArgs?.name, "ivfflat", baseArgs?.distanceStrategy, baseArgs?.partialIndexes);
|
|
59
|
+
this.lists = lists ?? 100;
|
|
60
|
+
}
|
|
61
|
+
indexOptions() {
|
|
62
|
+
return `(lists = ${this.lists})`;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Convert index attributes to string.
|
|
67
|
+
* Must be implemented by subclasses.
|
|
68
|
+
*/
|
|
69
|
+
var QueryOptions = class {};
|
|
70
|
+
var HNSWQueryOptions = class extends QueryOptions {
|
|
71
|
+
efSearch;
|
|
72
|
+
constructor(efSearch) {
|
|
73
|
+
super();
|
|
74
|
+
this.efSearch = efSearch ?? 40;
|
|
75
|
+
}
|
|
76
|
+
to_string() {
|
|
77
|
+
return `hnsw.ef_search = ${this.efSearch}`;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var IVFFlatQueryOptions = class extends QueryOptions {
|
|
81
|
+
probes;
|
|
82
|
+
constructor(probes) {
|
|
83
|
+
super();
|
|
84
|
+
this.probes = probes ?? 1;
|
|
85
|
+
}
|
|
86
|
+
to_string() {
|
|
87
|
+
return `ivflfat.probes = ${this.probes}`;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
87
92
|
exports.BaseIndex = BaseIndex;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
indexOptions() {
|
|
93
|
-
throw new Error("indexOptions method must be implemented by subclass");
|
|
94
|
-
}
|
|
95
|
-
}
|
|
93
|
+
exports.DEFAULT_DISTANCE_STRATEGY = DEFAULT_DISTANCE_STRATEGY;
|
|
94
|
+
exports.DEFAULT_INDEX_NAME_SUFFIX = DEFAULT_INDEX_NAME_SUFFIX;
|
|
95
|
+
exports.DistanceStrategy = DistanceStrategy;
|
|
96
96
|
exports.ExactNearestNeighbor = ExactNearestNeighbor;
|
|
97
|
-
class HNSWIndex extends BaseIndex {
|
|
98
|
-
constructor(baseArgs, m, efConstruction) {
|
|
99
|
-
super(baseArgs?.name, "hnsw", baseArgs?.distanceStrategy, baseArgs?.partialIndexes);
|
|
100
|
-
Object.defineProperty(this, "m", {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
configurable: true,
|
|
103
|
-
writable: true,
|
|
104
|
-
value: void 0
|
|
105
|
-
});
|
|
106
|
-
Object.defineProperty(this, "efConstruction", {
|
|
107
|
-
enumerable: true,
|
|
108
|
-
configurable: true,
|
|
109
|
-
writable: true,
|
|
110
|
-
value: void 0
|
|
111
|
-
});
|
|
112
|
-
this.m = m ?? 16;
|
|
113
|
-
this.efConstruction = efConstruction ?? 64;
|
|
114
|
-
}
|
|
115
|
-
indexOptions() {
|
|
116
|
-
return `(m = ${this.m}, ef_construction = ${this.efConstruction})`;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
97
|
exports.HNSWIndex = HNSWIndex;
|
|
120
|
-
class IVFFlatIndex extends BaseIndex {
|
|
121
|
-
constructor(baseArgs, lists) {
|
|
122
|
-
super(baseArgs?.name, "ivfflat", baseArgs?.distanceStrategy, baseArgs?.partialIndexes);
|
|
123
|
-
Object.defineProperty(this, "lists", {
|
|
124
|
-
enumerable: true,
|
|
125
|
-
configurable: true,
|
|
126
|
-
writable: true,
|
|
127
|
-
value: void 0
|
|
128
|
-
});
|
|
129
|
-
this.lists = lists ?? 100;
|
|
130
|
-
}
|
|
131
|
-
indexOptions() {
|
|
132
|
-
return `(lists = ${this.lists})`;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
exports.IVFFlatIndex = IVFFlatIndex;
|
|
136
|
-
/**
|
|
137
|
-
* Convert index attributes to string.
|
|
138
|
-
* Must be implemented by subclasses.
|
|
139
|
-
*/
|
|
140
|
-
class QueryOptions {
|
|
141
|
-
}
|
|
142
|
-
exports.QueryOptions = QueryOptions;
|
|
143
|
-
class HNSWQueryOptions extends QueryOptions {
|
|
144
|
-
constructor(efSearch) {
|
|
145
|
-
super();
|
|
146
|
-
Object.defineProperty(this, "efSearch", {
|
|
147
|
-
enumerable: true,
|
|
148
|
-
configurable: true,
|
|
149
|
-
writable: true,
|
|
150
|
-
value: void 0
|
|
151
|
-
});
|
|
152
|
-
this.efSearch = efSearch ?? 40;
|
|
153
|
-
}
|
|
154
|
-
to_string() {
|
|
155
|
-
return `hnsw.ef_search = ${this.efSearch}`;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
98
|
exports.HNSWQueryOptions = HNSWQueryOptions;
|
|
159
|
-
|
|
160
|
-
constructor(probes) {
|
|
161
|
-
super();
|
|
162
|
-
Object.defineProperty(this, "probes", {
|
|
163
|
-
enumerable: true,
|
|
164
|
-
configurable: true,
|
|
165
|
-
writable: true,
|
|
166
|
-
value: void 0
|
|
167
|
-
});
|
|
168
|
-
this.probes = probes ?? 1;
|
|
169
|
-
}
|
|
170
|
-
to_string() {
|
|
171
|
-
return `ivflfat.probes = ${this.probes}`;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
99
|
+
exports.IVFFlatIndex = IVFFlatIndex;
|
|
174
100
|
exports.IVFFlatQueryOptions = IVFFlatQueryOptions;
|
|
101
|
+
exports.QueryOptions = QueryOptions;
|
|
102
|
+
//# sourceMappingURL=indexes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexes.cjs","names":["operator: string","searchFunction: string","indexFunction: string","DEFAULT_INDEX_NAME_SUFFIX: string","name?: string","indexType: string","distanceStrategy: DistanceStrategy","partialIndexes: string[]","baseArgs?: BaseIndexArgs","m?: number","efConstruction?: number","baseArgs: BaseIndexArgs","lists?: number","efSearch?: number","probes?: number"],"sources":["../src/indexes.ts"],"sourcesContent":["class StrategyMixin {\n operator: string;\n\n searchFunction: string;\n\n indexFunction: string;\n\n constructor(operator: string, searchFunction: string, indexFunction: string) {\n this.operator = operator;\n this.searchFunction = searchFunction;\n this.indexFunction = indexFunction;\n }\n}\n\n/**\n * Enumerator of the Distance strategies.\n */\nexport class DistanceStrategy extends StrategyMixin {\n public static EUCLIDEAN = new StrategyMixin(\n \"<->\",\n \"l2_distance\",\n \"vector_l2_ops\"\n );\n\n public static COSINE_DISTANCE = new StrategyMixin(\n \"<=>\",\n \"cosine_distance\",\n \"vector_cosine_ops\"\n );\n\n public static INNER_PRODUCT = new StrategyMixin(\n \"<#>\",\n \"inner_product\",\n \"vector_ip_ops\"\n );\n}\n\nexport const DEFAULT_DISTANCE_STRATEGY = DistanceStrategy.COSINE_DISTANCE;\nexport const DEFAULT_INDEX_NAME_SUFFIX: string = \"langchainvectorindex\";\n\nexport interface BaseIndexArgs {\n name?: string;\n distanceStrategy?: DistanceStrategy;\n partialIndexes?: string[];\n}\n\nexport abstract class BaseIndex {\n name?: string;\n\n indexType: string;\n\n distanceStrategy: DistanceStrategy;\n\n partialIndexes?: string[];\n\n constructor(\n name?: string,\n indexType: string = \"base\",\n distanceStrategy: DistanceStrategy = DistanceStrategy.COSINE_DISTANCE,\n partialIndexes: string[] = []\n ) {\n this.name = name;\n this.indexType = indexType;\n this.distanceStrategy = distanceStrategy;\n this.partialIndexes = partialIndexes;\n }\n\n /**\n * Set index query options for vector store initialization.\n */\n abstract indexOptions(): string;\n}\n\nexport class ExactNearestNeighbor extends BaseIndex {\n constructor(baseArgs?: BaseIndexArgs) {\n super(\n baseArgs?.name,\n \"exactnearestneighbor\",\n baseArgs?.distanceStrategy,\n baseArgs?.partialIndexes\n );\n }\n\n indexOptions(): string {\n throw new Error(\"indexOptions method must be implemented by subclass\");\n }\n}\n\nexport class HNSWIndex extends BaseIndex {\n m: number;\n\n efConstruction: number;\n\n constructor(baseArgs?: BaseIndexArgs, m?: number, efConstruction?: number) {\n super(\n baseArgs?.name,\n \"hnsw\",\n baseArgs?.distanceStrategy,\n baseArgs?.partialIndexes\n );\n this.m = m ?? 16;\n this.efConstruction = efConstruction ?? 64;\n }\n\n indexOptions(): string {\n return `(m = ${this.m}, ef_construction = ${this.efConstruction})`;\n }\n}\n\nexport class IVFFlatIndex extends BaseIndex {\n lists: number;\n\n constructor(baseArgs: BaseIndexArgs, lists?: number) {\n super(\n baseArgs?.name,\n \"ivfflat\",\n baseArgs?.distanceStrategy,\n baseArgs?.partialIndexes\n );\n this.lists = lists ?? 100;\n }\n\n indexOptions(): string {\n return `(lists = ${this.lists})`;\n }\n}\n\n/**\n * Convert index attributes to string.\n * Must be implemented by subclasses.\n */\nexport abstract class QueryOptions {\n abstract to_string(): string;\n}\n\nexport class HNSWQueryOptions extends QueryOptions {\n efSearch: number;\n\n constructor(efSearch?: number) {\n super();\n this.efSearch = efSearch ?? 40;\n }\n\n to_string(): string {\n return `hnsw.ef_search = ${this.efSearch}`;\n }\n}\n\nexport class IVFFlatQueryOptions extends QueryOptions {\n readonly probes: number;\n\n constructor(probes?: number) {\n super();\n this.probes = probes ?? 1;\n }\n\n to_string(): string {\n return `ivflfat.probes = ${this.probes}`;\n }\n}\n"],"mappings":";;AAAA,IAAM,gBAAN,MAAoB;CAClB;CAEA;CAEA;CAEA,YAAYA,UAAkBC,gBAAwBC,eAAuB;EAC3E,KAAK,WAAW;EAChB,KAAK,iBAAiB;EACtB,KAAK,gBAAgB;CACtB;AACF;;;;AAKD,IAAa,mBAAb,cAAsC,cAAc;CAClD,OAAc,YAAY,IAAI,cAC5B,OACA,eACA;CAGF,OAAc,kBAAkB,IAAI,cAClC,OACA,mBACA;CAGF,OAAc,gBAAgB,IAAI,cAChC,OACA,iBACA;AAEH;AAED,MAAa,4BAA4B,iBAAiB;AAC1D,MAAaC,4BAAoC;AAQjD,IAAsB,YAAtB,MAAgC;CAC9B;CAEA;CAEA;CAEA;CAEA,YACEC,MACAC,YAAoB,QACpBC,mBAAqC,iBAAiB,iBACtDC,iBAA2B,CAAE,GAC7B;EACA,KAAK,OAAO;EACZ,KAAK,YAAY;EACjB,KAAK,mBAAmB;EACxB,KAAK,iBAAiB;CACvB;AAMF;AAED,IAAa,uBAAb,cAA0C,UAAU;CAClD,YAAYC,UAA0B;EACpC,MACE,UAAU,MACV,wBACA,UAAU,kBACV,UAAU,eACX;CACF;CAED,eAAuB;AACrB,QAAM,IAAI,MAAM;CACjB;AACF;AAED,IAAa,YAAb,cAA+B,UAAU;CACvC;CAEA;CAEA,YAAYA,UAA0BC,GAAYC,gBAAyB;EACzE,MACE,UAAU,MACV,QACA,UAAU,kBACV,UAAU,eACX;EACD,KAAK,IAAI,KAAK;EACd,KAAK,iBAAiB,kBAAkB;CACzC;CAED,eAAuB;AACrB,SAAO,CAAC,KAAK,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,eAAe,CAAC,CAAC;CACnE;AACF;AAED,IAAa,eAAb,cAAkC,UAAU;CAC1C;CAEA,YAAYC,UAAyBC,OAAgB;EACnD,MACE,UAAU,MACV,WACA,UAAU,kBACV,UAAU,eACX;EACD,KAAK,QAAQ,SAAS;CACvB;CAED,eAAuB;AACrB,SAAO,CAAC,SAAS,EAAE,KAAK,MAAM,CAAC,CAAC;CACjC;AACF;;;;;AAMD,IAAsB,eAAtB,MAAmC,CAElC;AAED,IAAa,mBAAb,cAAsC,aAAa;CACjD;CAEA,YAAYC,UAAmB;EAC7B,OAAO;EACP,KAAK,WAAW,YAAY;CAC7B;CAED,YAAoB;AAClB,SAAO,CAAC,iBAAiB,EAAE,KAAK,UAAU;CAC3C;AACF;AAED,IAAa,sBAAb,cAAyC,aAAa;CACpD,AAAS;CAET,YAAYC,QAAiB;EAC3B,OAAO;EACP,KAAK,SAAS,UAAU;CACzB;CAED,YAAoB;AAClB,SAAO,CAAC,iBAAiB,EAAE,KAAK,QAAQ;CACzC;AACF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/indexes.d.ts
|
|
2
|
+
declare class StrategyMixin {
|
|
3
|
+
operator: string;
|
|
4
|
+
searchFunction: string;
|
|
5
|
+
indexFunction: string;
|
|
6
|
+
constructor(operator: string, searchFunction: string, indexFunction: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Enumerator of the Distance strategies.
|
|
10
|
+
*/
|
|
11
|
+
declare class DistanceStrategy extends StrategyMixin {
|
|
12
|
+
static EUCLIDEAN: StrategyMixin;
|
|
13
|
+
static COSINE_DISTANCE: StrategyMixin;
|
|
14
|
+
static INNER_PRODUCT: StrategyMixin;
|
|
15
|
+
}
|
|
16
|
+
declare const DEFAULT_DISTANCE_STRATEGY: StrategyMixin;
|
|
17
|
+
declare const DEFAULT_INDEX_NAME_SUFFIX: string;
|
|
18
|
+
interface BaseIndexArgs {
|
|
19
|
+
name?: string;
|
|
20
|
+
distanceStrategy?: DistanceStrategy;
|
|
21
|
+
partialIndexes?: string[];
|
|
22
|
+
}
|
|
23
|
+
declare abstract class BaseIndex {
|
|
24
|
+
name?: string;
|
|
25
|
+
indexType: string;
|
|
26
|
+
distanceStrategy: DistanceStrategy;
|
|
27
|
+
partialIndexes?: string[];
|
|
28
|
+
constructor(name?: string, indexType?: string, distanceStrategy?: DistanceStrategy, partialIndexes?: string[]);
|
|
29
|
+
/**
|
|
30
|
+
* Set index query options for vector store initialization.
|
|
31
|
+
*/
|
|
32
|
+
abstract indexOptions(): string;
|
|
33
|
+
}
|
|
34
|
+
declare class ExactNearestNeighbor extends BaseIndex {
|
|
35
|
+
constructor(baseArgs?: BaseIndexArgs);
|
|
36
|
+
indexOptions(): string;
|
|
37
|
+
}
|
|
38
|
+
declare class HNSWIndex extends BaseIndex {
|
|
39
|
+
m: number;
|
|
40
|
+
efConstruction: number;
|
|
41
|
+
constructor(baseArgs?: BaseIndexArgs, m?: number, efConstruction?: number);
|
|
42
|
+
indexOptions(): string;
|
|
43
|
+
}
|
|
44
|
+
declare class IVFFlatIndex extends BaseIndex {
|
|
45
|
+
lists: number;
|
|
46
|
+
constructor(baseArgs: BaseIndexArgs, lists?: number);
|
|
47
|
+
indexOptions(): string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Convert index attributes to string.
|
|
51
|
+
* Must be implemented by subclasses.
|
|
52
|
+
*/
|
|
53
|
+
declare abstract class QueryOptions {
|
|
54
|
+
abstract to_string(): string;
|
|
55
|
+
}
|
|
56
|
+
declare class HNSWQueryOptions extends QueryOptions {
|
|
57
|
+
efSearch: number;
|
|
58
|
+
constructor(efSearch?: number);
|
|
59
|
+
to_string(): string;
|
|
60
|
+
}
|
|
61
|
+
declare class IVFFlatQueryOptions extends QueryOptions {
|
|
62
|
+
readonly probes: number;
|
|
63
|
+
constructor(probes?: number);
|
|
64
|
+
to_string(): string;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { BaseIndex, BaseIndexArgs, DEFAULT_DISTANCE_STRATEGY, DEFAULT_INDEX_NAME_SUFFIX, DistanceStrategy, ExactNearestNeighbor, HNSWIndex, HNSWQueryOptions, IVFFlatIndex, IVFFlatQueryOptions, QueryOptions };
|
|
68
|
+
//# sourceMappingURL=indexes.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexes.d.cts","names":["StrategyMixin","DistanceStrategy","DEFAULT_DISTANCE_STRATEGY","DEFAULT_INDEX_NAME_SUFFIX","BaseIndexArgs","BaseIndex","ExactNearestNeighbor","HNSWIndex","IVFFlatIndex","QueryOptions","HNSWQueryOptions","IVFFlatQueryOptions"],"sources":["../src/indexes.d.ts"],"sourcesContent":["declare class StrategyMixin {\n operator: string;\n searchFunction: string;\n indexFunction: string;\n constructor(operator: string, searchFunction: string, indexFunction: string);\n}\n/**\n * Enumerator of the Distance strategies.\n */\nexport declare class DistanceStrategy extends StrategyMixin {\n static EUCLIDEAN: StrategyMixin;\n static COSINE_DISTANCE: StrategyMixin;\n static INNER_PRODUCT: StrategyMixin;\n}\nexport declare const DEFAULT_DISTANCE_STRATEGY: StrategyMixin;\nexport declare const DEFAULT_INDEX_NAME_SUFFIX: string;\nexport interface BaseIndexArgs {\n name?: string;\n distanceStrategy?: DistanceStrategy;\n partialIndexes?: string[];\n}\nexport declare abstract class BaseIndex {\n name?: string;\n indexType: string;\n distanceStrategy: DistanceStrategy;\n partialIndexes?: string[];\n constructor(name?: string, indexType?: string, distanceStrategy?: DistanceStrategy, partialIndexes?: string[]);\n /**\n * Set index query options for vector store initialization.\n */\n abstract indexOptions(): string;\n}\nexport declare class ExactNearestNeighbor extends BaseIndex {\n constructor(baseArgs?: BaseIndexArgs);\n indexOptions(): string;\n}\nexport declare class HNSWIndex extends BaseIndex {\n m: number;\n efConstruction: number;\n constructor(baseArgs?: BaseIndexArgs, m?: number, efConstruction?: number);\n indexOptions(): string;\n}\nexport declare class IVFFlatIndex extends BaseIndex {\n lists: number;\n constructor(baseArgs: BaseIndexArgs, lists?: number);\n indexOptions(): string;\n}\n/**\n * Convert index attributes to string.\n * Must be implemented by subclasses.\n */\nexport declare abstract class QueryOptions {\n abstract to_string(): string;\n}\nexport declare class HNSWQueryOptions extends QueryOptions {\n efSearch: number;\n constructor(efSearch?: number);\n to_string(): string;\n}\nexport declare class IVFFlatQueryOptions extends QueryOptions {\n readonly probes: number;\n constructor(probes?: number);\n to_string(): string;\n}\nexport {};\n"],"mappings":";cAAcA,aAAAA;EAAAA,QAAAA,EAAAA,MAAa;EASNC,cAAAA,EAAAA,MAAgB;EAAA,aAAA,EAAA,MAAA;EAAA,WACfD,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,cAAAA,EAAAA,MAAAA,EAAAA,aAAAA,EAAAA,MAAAA;;;;AADqC;AAKtCE,cALAD,gBAAAA,SAAyBD,aAAAA,CAKe;EACxCG,OAAAA,SAAAA,EALCH,aAKgC;EACrCI,OAAAA,eAAa,EALFJ,aAOLC;EAGOI,OAAAA,aAAS,EATbL,aASa;;AAGjBC,cAVDC,yBAUCD,EAV0BD,aAU1BC;AAEgDA,cAXjDE,yBAWiDF,EAAAA,MAAAA;AAAgB,UAVrEG,aAAAA,CAUqE;EAMjEE,IAAAA,CAAAA,EAAAA,MAAAA;EAAoB,gBAAA,CAAA,EAdlBL,gBAckB;EAAA,cACdG,CAAAA,EAAAA,MAAAA,EAAAA;;AADgC,uBAX7BC,SAAAA,CAW6B;EAItCE,IAAAA,CAAAA,EAAAA,MAAS;EAAA,SAAA,EAAA,MAAA;EAAA,gBAGHH,EAfLH,gBAeKG;EAAa,cAHDC,CAAAA,EAAAA,MAAAA,EAAAA;EAAS,WAAA,CAAA,IAAA,CAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,MAAA,EAAA,gBAAA,CAAA,EAVsBJ,gBAUtB,EAAA,cAAA,CAAA,EAAA,MAAA,EAAA;EAM3BO;;;EAEkB,SAFGH,YAAAA,CAAAA,CAAAA,EAAAA,MAAAA;AAAS;AASrBI,cAnBTH,oBAAAA,SAA6BD,SAAAA,CAmBR;EAGrBK,WAAAA,CAAAA,QAAyBD,CAAT,EArBVL,aAqBmBK;EAKzBE,YAAAA,CAAAA,CAAAA,EAAAA,MAAmB;;cAvBnBJ,SAAAA,SAAkBF,SAAAA;;;yBAGZD;;;cAGNI,YAAAA,SAAqBH,SAAAA;;wBAEhBD;;;;;;;uBAOIK,YAAAA;;;cAGTC,gBAAAA,SAAyBD,YAAY;;;;;cAKrCE,mBAAAA,SAA4BF,YAAY"}
|
package/dist/indexes.d.ts
CHANGED
|
@@ -1,65 +1,68 @@
|
|
|
1
|
+
//#region src/indexes.d.ts
|
|
1
2
|
declare class StrategyMixin {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
operator: string;
|
|
4
|
+
searchFunction: string;
|
|
5
|
+
indexFunction: string;
|
|
6
|
+
constructor(operator: string, searchFunction: string, indexFunction: string);
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* Enumerator of the Distance strategies.
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
declare class DistanceStrategy extends StrategyMixin {
|
|
12
|
+
static EUCLIDEAN: StrategyMixin;
|
|
13
|
+
static COSINE_DISTANCE: StrategyMixin;
|
|
14
|
+
static INNER_PRODUCT: StrategyMixin;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
declare const DEFAULT_DISTANCE_STRATEGY: StrategyMixin;
|
|
17
|
+
declare const DEFAULT_INDEX_NAME_SUFFIX: string;
|
|
18
|
+
interface BaseIndexArgs {
|
|
19
|
+
name?: string;
|
|
20
|
+
distanceStrategy?: DistanceStrategy;
|
|
21
|
+
partialIndexes?: string[];
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
declare abstract class BaseIndex {
|
|
24
|
+
name?: string;
|
|
25
|
+
indexType: string;
|
|
26
|
+
distanceStrategy: DistanceStrategy;
|
|
27
|
+
partialIndexes?: string[];
|
|
28
|
+
constructor(name?: string, indexType?: string, distanceStrategy?: DistanceStrategy, partialIndexes?: string[]);
|
|
29
|
+
/**
|
|
30
|
+
* Set index query options for vector store initialization.
|
|
31
|
+
*/
|
|
32
|
+
abstract indexOptions(): string;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
declare class ExactNearestNeighbor extends BaseIndex {
|
|
35
|
+
constructor(baseArgs?: BaseIndexArgs);
|
|
36
|
+
indexOptions(): string;
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
declare class HNSWIndex extends BaseIndex {
|
|
39
|
+
m: number;
|
|
40
|
+
efConstruction: number;
|
|
41
|
+
constructor(baseArgs?: BaseIndexArgs, m?: number, efConstruction?: number);
|
|
42
|
+
indexOptions(): string;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
declare class IVFFlatIndex extends BaseIndex {
|
|
45
|
+
lists: number;
|
|
46
|
+
constructor(baseArgs: BaseIndexArgs, lists?: number);
|
|
47
|
+
indexOptions(): string;
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
50
|
* Convert index attributes to string.
|
|
50
51
|
* Must be implemented by subclasses.
|
|
51
52
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
declare abstract class QueryOptions {
|
|
54
|
+
abstract to_string(): string;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
declare class HNSWQueryOptions extends QueryOptions {
|
|
57
|
+
efSearch: number;
|
|
58
|
+
constructor(efSearch?: number);
|
|
59
|
+
to_string(): string;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
declare class IVFFlatQueryOptions extends QueryOptions {
|
|
62
|
+
readonly probes: number;
|
|
63
|
+
constructor(probes?: number);
|
|
64
|
+
to_string(): string;
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
//#endregion
|
|
67
|
+
export { BaseIndex, BaseIndexArgs, DEFAULT_DISTANCE_STRATEGY, DEFAULT_INDEX_NAME_SUFFIX, DistanceStrategy, ExactNearestNeighbor, HNSWIndex, HNSWQueryOptions, IVFFlatIndex, IVFFlatQueryOptions, QueryOptions };
|
|
68
|
+
//# sourceMappingURL=indexes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexes.d.ts","names":["StrategyMixin","DistanceStrategy","DEFAULT_DISTANCE_STRATEGY","DEFAULT_INDEX_NAME_SUFFIX","BaseIndexArgs","BaseIndex","ExactNearestNeighbor","HNSWIndex","IVFFlatIndex","QueryOptions","HNSWQueryOptions","IVFFlatQueryOptions"],"sources":["../src/indexes.d.ts"],"sourcesContent":["declare class StrategyMixin {\n operator: string;\n searchFunction: string;\n indexFunction: string;\n constructor(operator: string, searchFunction: string, indexFunction: string);\n}\n/**\n * Enumerator of the Distance strategies.\n */\nexport declare class DistanceStrategy extends StrategyMixin {\n static EUCLIDEAN: StrategyMixin;\n static COSINE_DISTANCE: StrategyMixin;\n static INNER_PRODUCT: StrategyMixin;\n}\nexport declare const DEFAULT_DISTANCE_STRATEGY: StrategyMixin;\nexport declare const DEFAULT_INDEX_NAME_SUFFIX: string;\nexport interface BaseIndexArgs {\n name?: string;\n distanceStrategy?: DistanceStrategy;\n partialIndexes?: string[];\n}\nexport declare abstract class BaseIndex {\n name?: string;\n indexType: string;\n distanceStrategy: DistanceStrategy;\n partialIndexes?: string[];\n constructor(name?: string, indexType?: string, distanceStrategy?: DistanceStrategy, partialIndexes?: string[]);\n /**\n * Set index query options for vector store initialization.\n */\n abstract indexOptions(): string;\n}\nexport declare class ExactNearestNeighbor extends BaseIndex {\n constructor(baseArgs?: BaseIndexArgs);\n indexOptions(): string;\n}\nexport declare class HNSWIndex extends BaseIndex {\n m: number;\n efConstruction: number;\n constructor(baseArgs?: BaseIndexArgs, m?: number, efConstruction?: number);\n indexOptions(): string;\n}\nexport declare class IVFFlatIndex extends BaseIndex {\n lists: number;\n constructor(baseArgs: BaseIndexArgs, lists?: number);\n indexOptions(): string;\n}\n/**\n * Convert index attributes to string.\n * Must be implemented by subclasses.\n */\nexport declare abstract class QueryOptions {\n abstract to_string(): string;\n}\nexport declare class HNSWQueryOptions extends QueryOptions {\n efSearch: number;\n constructor(efSearch?: number);\n to_string(): string;\n}\nexport declare class IVFFlatQueryOptions extends QueryOptions {\n readonly probes: number;\n constructor(probes?: number);\n to_string(): string;\n}\nexport {};\n"],"mappings":";cAAcA,aAAAA;EAAAA,QAAAA,EAAAA,MAAa;EASNC,cAAAA,EAAAA,MAAgB;EAAA,aAAA,EAAA,MAAA;EAAA,WACfD,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,cAAAA,EAAAA,MAAAA,EAAAA,aAAAA,EAAAA,MAAAA;;;;AADqC;AAKtCE,cALAD,gBAAAA,SAAyBD,aAAAA,CAKe;EACxCG,OAAAA,SAAAA,EALCH,aAKgC;EACrCI,OAAAA,eAAa,EALFJ,aAOLC;EAGOI,OAAAA,aAAS,EATbL,aASa;;AAGjBC,cAVDC,yBAUCD,EAV0BD,aAU1BC;AAEgDA,cAXjDE,yBAWiDF,EAAAA,MAAAA;AAAgB,UAVrEG,aAAAA,CAUqE;EAMjEE,IAAAA,CAAAA,EAAAA,MAAAA;EAAoB,gBAAA,CAAA,EAdlBL,gBAckB;EAAA,cACdG,CAAAA,EAAAA,MAAAA,EAAAA;;AADgC,uBAX7BC,SAAAA,CAW6B;EAItCE,IAAAA,CAAAA,EAAAA,MAAS;EAAA,SAAA,EAAA,MAAA;EAAA,gBAGHH,EAfLH,gBAeKG;EAAa,cAHDC,CAAAA,EAAAA,MAAAA,EAAAA;EAAS,WAAA,CAAA,IAAA,CAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,MAAA,EAAA,gBAAA,CAAA,EAVsBJ,gBAUtB,EAAA,cAAA,CAAA,EAAA,MAAA,EAAA;EAM3BO;;;EAEkB,SAFGH,YAAAA,CAAAA,CAAAA,EAAAA,MAAAA;AAAS;AASrBI,cAnBTH,oBAAAA,SAA6BD,SAAAA,CAmBR;EAGrBK,WAAAA,CAAAA,QAAyBD,CAAT,EArBVL,aAqBmBK;EAKzBE,YAAAA,CAAAA,CAAAA,EAAAA,MAAmB;;cAvBnBJ,SAAAA,SAAkBF,SAAAA;;;yBAGZD;;;cAGNI,YAAAA,SAAqBH,SAAAA;;wBAEhBD;;;;;;;uBAOIK,YAAAA;;;cAGTC,gBAAAA,SAAyBD,YAAY;;;;;cAKrCE,mBAAAA,SAA4BF,YAAY"}
|