@lov3kaizen/agentsea-embeddings 0.5.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.
- package/LICENSE +21 -0
- package/README.md +475 -0
- package/dist/caching/index.d.mts +286 -0
- package/dist/caching/index.d.ts +286 -0
- package/dist/caching/index.js +1005 -0
- package/dist/caching/index.mjs +27 -0
- package/dist/chunk-3KM32UQK.mjs +207 -0
- package/dist/chunk-DJAURHAS.mjs +1117 -0
- package/dist/chunk-NBHIRTJT.mjs +895 -0
- package/dist/chunk-QAITLJ2E.mjs +259 -0
- package/dist/chunk-TER262ST.mjs +877 -0
- package/dist/chunk-VPSMDBHH.mjs +957 -0
- package/dist/chunking/index.d.mts +1 -0
- package/dist/chunking/index.d.ts +1 -0
- package/dist/chunking/index.js +1408 -0
- package/dist/chunking/index.mjs +37 -0
- package/dist/embedding.types-CCgPVxt1.d.mts +102 -0
- package/dist/embedding.types-CCgPVxt1.d.ts +102 -0
- package/dist/index-CeG6God2.d.mts +297 -0
- package/dist/index-DMaQRn2w.d.mts +172 -0
- package/dist/index-DMaQRn2w.d.ts +172 -0
- package/dist/index-DWddsKRi.d.ts +297 -0
- package/dist/index.d.mts +647 -0
- package/dist/index.d.ts +647 -0
- package/dist/index.js +5259 -0
- package/dist/index.mjs +1028 -0
- package/dist/providers/index.d.mts +2 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +1235 -0
- package/dist/providers/index.mjs +32 -0
- package/dist/stores/index.d.mts +298 -0
- package/dist/stores/index.d.ts +298 -0
- package/dist/stores/index.js +1178 -0
- package/dist/stores/index.mjs +26 -0
- package/package.json +102 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseProvider,
|
|
3
|
+
CohereProvider,
|
|
4
|
+
HuggingFaceProvider,
|
|
5
|
+
LocalProvider,
|
|
6
|
+
OpenAIProvider,
|
|
7
|
+
VoyageProvider,
|
|
8
|
+
createCohereProvider,
|
|
9
|
+
createHuggingFaceProvider,
|
|
10
|
+
createLocalProvider,
|
|
11
|
+
createMockProvider,
|
|
12
|
+
createOpenAIProvider,
|
|
13
|
+
createRandomProvider,
|
|
14
|
+
createVoyageProvider
|
|
15
|
+
} from "../chunk-NBHIRTJT.mjs";
|
|
16
|
+
import "../chunk-3KM32UQK.mjs";
|
|
17
|
+
import "../chunk-QAITLJ2E.mjs";
|
|
18
|
+
export {
|
|
19
|
+
BaseProvider,
|
|
20
|
+
CohereProvider,
|
|
21
|
+
HuggingFaceProvider,
|
|
22
|
+
LocalProvider,
|
|
23
|
+
OpenAIProvider,
|
|
24
|
+
VoyageProvider,
|
|
25
|
+
createCohereProvider,
|
|
26
|
+
createHuggingFaceProvider,
|
|
27
|
+
createLocalProvider,
|
|
28
|
+
createMockProvider,
|
|
29
|
+
createOpenAIProvider,
|
|
30
|
+
createRandomProvider,
|
|
31
|
+
createVoyageProvider
|
|
32
|
+
};
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { E as EmbeddingVector, C as ChunkMetadata, S as SearchOptions, e as SearchResult } from '../embedding.types-CCgPVxt1.mjs';
|
|
2
|
+
|
|
3
|
+
type VectorStoreType = 'pinecone' | 'weaviate' | 'chroma' | 'qdrant' | 'milvus' | 'pgvector' | 'memory' | 'custom';
|
|
4
|
+
interface StoreConfig {
|
|
5
|
+
type: VectorStoreType;
|
|
6
|
+
namespace?: string;
|
|
7
|
+
dimensions?: number;
|
|
8
|
+
metric?: DistanceMetric;
|
|
9
|
+
}
|
|
10
|
+
type DistanceMetric = 'cosine' | 'euclidean' | 'dot_product' | 'manhattan';
|
|
11
|
+
interface VectorRecord {
|
|
12
|
+
id: string;
|
|
13
|
+
vector: EmbeddingVector;
|
|
14
|
+
text?: string;
|
|
15
|
+
metadata?: ChunkMetadata;
|
|
16
|
+
}
|
|
17
|
+
interface StoredVector {
|
|
18
|
+
id: string;
|
|
19
|
+
namespace?: string;
|
|
20
|
+
dimensions: number;
|
|
21
|
+
hasText: boolean;
|
|
22
|
+
metadataKeys: string[];
|
|
23
|
+
createdAt?: number;
|
|
24
|
+
updatedAt?: number;
|
|
25
|
+
}
|
|
26
|
+
interface PineconeStoreConfig extends StoreConfig {
|
|
27
|
+
type: 'pinecone';
|
|
28
|
+
apiKey: string;
|
|
29
|
+
environment?: string;
|
|
30
|
+
indexName: string;
|
|
31
|
+
podType?: string;
|
|
32
|
+
replicas?: number;
|
|
33
|
+
metric?: DistanceMetric;
|
|
34
|
+
}
|
|
35
|
+
interface WeaviateStoreConfig extends StoreConfig {
|
|
36
|
+
type: 'weaviate';
|
|
37
|
+
url: string;
|
|
38
|
+
apiKey?: string;
|
|
39
|
+
className: string;
|
|
40
|
+
schema?: WeaviateSchema;
|
|
41
|
+
}
|
|
42
|
+
interface WeaviateSchema {
|
|
43
|
+
class: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
properties: WeaviateProperty[];
|
|
46
|
+
vectorizer?: string;
|
|
47
|
+
moduleConfig?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
interface WeaviateProperty {
|
|
50
|
+
name: string;
|
|
51
|
+
dataType: string[];
|
|
52
|
+
description?: string;
|
|
53
|
+
indexFilterable?: boolean;
|
|
54
|
+
indexSearchable?: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface ChromaStoreConfig extends StoreConfig {
|
|
57
|
+
type: 'chroma';
|
|
58
|
+
url?: string;
|
|
59
|
+
collectionName: string;
|
|
60
|
+
auth?: {
|
|
61
|
+
token?: string;
|
|
62
|
+
credentials?: string;
|
|
63
|
+
};
|
|
64
|
+
tenant?: string;
|
|
65
|
+
database?: string;
|
|
66
|
+
}
|
|
67
|
+
interface QdrantStoreConfig extends StoreConfig {
|
|
68
|
+
type: 'qdrant';
|
|
69
|
+
url: string;
|
|
70
|
+
apiKey?: string;
|
|
71
|
+
collectionName: string;
|
|
72
|
+
vectorConfig?: QdrantVectorConfig;
|
|
73
|
+
}
|
|
74
|
+
interface QdrantVectorConfig {
|
|
75
|
+
size: number;
|
|
76
|
+
distance: 'Cosine' | 'Euclid' | 'Dot';
|
|
77
|
+
hnswConfig?: {
|
|
78
|
+
m?: number;
|
|
79
|
+
efConstruct?: number;
|
|
80
|
+
fullScanThreshold?: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
interface MilvusStoreConfig extends StoreConfig {
|
|
84
|
+
type: 'milvus';
|
|
85
|
+
url: string;
|
|
86
|
+
username?: string;
|
|
87
|
+
password?: string;
|
|
88
|
+
collectionName: string;
|
|
89
|
+
indexType?: 'IVF_FLAT' | 'IVF_SQ8' | 'IVF_PQ' | 'HNSW' | 'ANNOY';
|
|
90
|
+
indexParams?: Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
interface PgVectorStoreConfig extends StoreConfig {
|
|
93
|
+
type: 'pgvector';
|
|
94
|
+
connectionString?: string;
|
|
95
|
+
host?: string;
|
|
96
|
+
port?: number;
|
|
97
|
+
database?: string;
|
|
98
|
+
user?: string;
|
|
99
|
+
password?: string;
|
|
100
|
+
tableName: string;
|
|
101
|
+
vectorColumn?: string;
|
|
102
|
+
contentColumn?: string;
|
|
103
|
+
metadataColumn?: string;
|
|
104
|
+
indexType?: 'ivfflat' | 'hnsw';
|
|
105
|
+
indexParams?: {
|
|
106
|
+
lists?: number;
|
|
107
|
+
m?: number;
|
|
108
|
+
efConstruction?: number;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
interface MemoryStoreConfig extends StoreConfig {
|
|
112
|
+
type: 'memory';
|
|
113
|
+
maxVectors?: number;
|
|
114
|
+
persistPath?: string;
|
|
115
|
+
persistInterval?: number;
|
|
116
|
+
}
|
|
117
|
+
interface UpsertOptions {
|
|
118
|
+
namespace?: string;
|
|
119
|
+
batchSize?: number;
|
|
120
|
+
onProgress?: (progress: {
|
|
121
|
+
completed: number;
|
|
122
|
+
total: number;
|
|
123
|
+
}) => void;
|
|
124
|
+
}
|
|
125
|
+
interface UpsertResult {
|
|
126
|
+
upsertedIds: string[];
|
|
127
|
+
upsertedCount: number;
|
|
128
|
+
errors: Array<{
|
|
129
|
+
id: string;
|
|
130
|
+
error: string;
|
|
131
|
+
}>;
|
|
132
|
+
durationMs: number;
|
|
133
|
+
}
|
|
134
|
+
interface DeleteOptions {
|
|
135
|
+
namespace?: string;
|
|
136
|
+
deleteAll?: boolean;
|
|
137
|
+
filter?: Record<string, unknown>;
|
|
138
|
+
}
|
|
139
|
+
interface DeleteResult {
|
|
140
|
+
deletedCount: number;
|
|
141
|
+
durationMs: number;
|
|
142
|
+
}
|
|
143
|
+
interface StoreQueryOptions extends SearchOptions {
|
|
144
|
+
includeVectors?: boolean;
|
|
145
|
+
includeText?: boolean;
|
|
146
|
+
scoreThreshold?: number;
|
|
147
|
+
}
|
|
148
|
+
interface StoreQueryResult {
|
|
149
|
+
matches: SearchResult[];
|
|
150
|
+
namespace?: string;
|
|
151
|
+
durationMs: number;
|
|
152
|
+
}
|
|
153
|
+
interface StoreStats {
|
|
154
|
+
type: VectorStoreType;
|
|
155
|
+
vectorCount: number;
|
|
156
|
+
namespaceCount: number;
|
|
157
|
+
indexSizeBytes?: number;
|
|
158
|
+
dimensions: number;
|
|
159
|
+
metric: DistanceMetric;
|
|
160
|
+
lastUpdated?: number;
|
|
161
|
+
}
|
|
162
|
+
interface StoreHealth {
|
|
163
|
+
healthy: boolean;
|
|
164
|
+
latencyMs: number;
|
|
165
|
+
error?: string;
|
|
166
|
+
lastCheck: number;
|
|
167
|
+
}
|
|
168
|
+
interface IndexInfo {
|
|
169
|
+
name: string;
|
|
170
|
+
dimensions: number;
|
|
171
|
+
metric: DistanceMetric;
|
|
172
|
+
vectorCount: number;
|
|
173
|
+
indexType?: string;
|
|
174
|
+
createdAt?: number;
|
|
175
|
+
status: 'ready' | 'initializing' | 'scaling' | 'error';
|
|
176
|
+
}
|
|
177
|
+
interface CollectionInfo {
|
|
178
|
+
name: string;
|
|
179
|
+
vectorCount: number;
|
|
180
|
+
dimensions: number;
|
|
181
|
+
metric: DistanceMetric;
|
|
182
|
+
createdAt?: number;
|
|
183
|
+
metadata?: Record<string, unknown>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare abstract class BaseStore {
|
|
187
|
+
abstract readonly storeType: VectorStoreType;
|
|
188
|
+
protected config: StoreConfig;
|
|
189
|
+
constructor(config: StoreConfig);
|
|
190
|
+
abstract upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
191
|
+
abstract query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
192
|
+
abstract delete(ids: string[], options?: DeleteOptions): Promise<DeleteResult>;
|
|
193
|
+
abstract deleteAll(options?: DeleteOptions): Promise<DeleteResult>;
|
|
194
|
+
abstract getStats(): Promise<StoreStats>;
|
|
195
|
+
abstract checkHealth(): Promise<StoreHealth>;
|
|
196
|
+
abstract close(): Promise<void>;
|
|
197
|
+
get namespace(): string;
|
|
198
|
+
get dimensions(): number | undefined;
|
|
199
|
+
get metric(): DistanceMetric;
|
|
200
|
+
protected calculateScore(a: EmbeddingVector, b: EmbeddingVector): number;
|
|
201
|
+
protected filterByMetadata(records: VectorRecord[], filter?: Record<string, unknown>): VectorRecord[];
|
|
202
|
+
protected toSearchResults(records: Array<VectorRecord & {
|
|
203
|
+
score: number;
|
|
204
|
+
}>, options?: StoreQueryOptions): SearchResult[];
|
|
205
|
+
}
|
|
206
|
+
interface StoreFactoryOptions {
|
|
207
|
+
defaultType?: VectorStoreType;
|
|
208
|
+
stores?: Record<VectorStoreType, StoreConfig>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare class MemoryStore extends BaseStore {
|
|
212
|
+
readonly storeType: VectorStoreType;
|
|
213
|
+
private vectors;
|
|
214
|
+
private namespaces;
|
|
215
|
+
private persistPath?;
|
|
216
|
+
private persistInterval?;
|
|
217
|
+
private maxVectors;
|
|
218
|
+
constructor(config?: MemoryStoreConfig);
|
|
219
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
220
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
221
|
+
delete(ids: string[], options?: DeleteOptions): Promise<DeleteResult>;
|
|
222
|
+
deleteAll(options?: DeleteOptions): Promise<DeleteResult>;
|
|
223
|
+
getStats(): Promise<StoreStats>;
|
|
224
|
+
checkHealth(): Promise<StoreHealth>;
|
|
225
|
+
close(): Promise<void>;
|
|
226
|
+
persist(): Promise<void>;
|
|
227
|
+
load(): Promise<void>;
|
|
228
|
+
getAll(): VectorRecord[];
|
|
229
|
+
getById(id: string): VectorRecord | undefined;
|
|
230
|
+
}
|
|
231
|
+
declare function createMemoryStore(config?: MemoryStoreConfig): MemoryStore;
|
|
232
|
+
|
|
233
|
+
declare class PineconeStore extends BaseStore {
|
|
234
|
+
readonly storeType: VectorStoreType;
|
|
235
|
+
private client;
|
|
236
|
+
private index;
|
|
237
|
+
private apiKey;
|
|
238
|
+
private indexName;
|
|
239
|
+
private initialized;
|
|
240
|
+
constructor(config: PineconeStoreConfig);
|
|
241
|
+
init(): Promise<void>;
|
|
242
|
+
private ensureInitialized;
|
|
243
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
244
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
245
|
+
delete(ids: string[], options?: DeleteOptions): Promise<DeleteResult>;
|
|
246
|
+
deleteAll(options?: DeleteOptions): Promise<DeleteResult>;
|
|
247
|
+
getStats(): Promise<StoreStats>;
|
|
248
|
+
checkHealth(): Promise<StoreHealth>;
|
|
249
|
+
close(): Promise<void>;
|
|
250
|
+
}
|
|
251
|
+
declare function createPineconeStore(config: PineconeStoreConfig): PineconeStore;
|
|
252
|
+
|
|
253
|
+
declare class ChromaStore extends BaseStore {
|
|
254
|
+
readonly storeType: VectorStoreType;
|
|
255
|
+
private client;
|
|
256
|
+
private collection;
|
|
257
|
+
private collectionName;
|
|
258
|
+
private url?;
|
|
259
|
+
private initialized;
|
|
260
|
+
constructor(config: ChromaStoreConfig);
|
|
261
|
+
init(): Promise<void>;
|
|
262
|
+
private metricToChroma;
|
|
263
|
+
private ensureInitialized;
|
|
264
|
+
upsert(records: VectorRecord[], _options?: UpsertOptions): Promise<UpsertResult>;
|
|
265
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
266
|
+
delete(ids: string[], _options?: DeleteOptions): Promise<DeleteResult>;
|
|
267
|
+
deleteAll(_options?: DeleteOptions): Promise<DeleteResult>;
|
|
268
|
+
getStats(): Promise<StoreStats>;
|
|
269
|
+
checkHealth(): Promise<StoreHealth>;
|
|
270
|
+
close(): Promise<void>;
|
|
271
|
+
}
|
|
272
|
+
declare function createChromaStore(config: ChromaStoreConfig): ChromaStore;
|
|
273
|
+
|
|
274
|
+
declare class QdrantStore extends BaseStore {
|
|
275
|
+
readonly storeType: VectorStoreType;
|
|
276
|
+
private client;
|
|
277
|
+
private collectionName;
|
|
278
|
+
private url;
|
|
279
|
+
private apiKey?;
|
|
280
|
+
private initialized;
|
|
281
|
+
constructor(config: QdrantStoreConfig);
|
|
282
|
+
init(): Promise<void>;
|
|
283
|
+
private metricToQdrant;
|
|
284
|
+
private ensureInitialized;
|
|
285
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
286
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
287
|
+
private buildQdrantFilter;
|
|
288
|
+
delete(ids: string[], _options?: DeleteOptions): Promise<DeleteResult>;
|
|
289
|
+
deleteAll(_options?: DeleteOptions): Promise<DeleteResult>;
|
|
290
|
+
getStats(): Promise<StoreStats>;
|
|
291
|
+
checkHealth(): Promise<StoreHealth>;
|
|
292
|
+
close(): Promise<void>;
|
|
293
|
+
}
|
|
294
|
+
declare function createQdrantStore(config: QdrantStoreConfig): QdrantStore;
|
|
295
|
+
|
|
296
|
+
declare function createStore(type: VectorStoreType, config: StoreConfig): BaseStore;
|
|
297
|
+
|
|
298
|
+
export { BaseStore, ChromaStore, type ChromaStoreConfig, type CollectionInfo, type DeleteOptions, type DeleteResult, type DistanceMetric, type IndexInfo, MemoryStore, type MemoryStoreConfig, type MilvusStoreConfig, type PgVectorStoreConfig, PineconeStore, type PineconeStoreConfig, QdrantStore, type QdrantStoreConfig, type StoreConfig, type StoreFactoryOptions, type StoreHealth, type StoreQueryOptions, type StoreQueryResult, type StoreStats, type StoredVector, type UpsertOptions, type UpsertResult, type VectorRecord, type VectorStoreType, type WeaviateStoreConfig, createChromaStore, createMemoryStore, createPineconeStore, createQdrantStore, createStore };
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { E as EmbeddingVector, C as ChunkMetadata, S as SearchOptions, e as SearchResult } from '../embedding.types-CCgPVxt1.js';
|
|
2
|
+
|
|
3
|
+
type VectorStoreType = 'pinecone' | 'weaviate' | 'chroma' | 'qdrant' | 'milvus' | 'pgvector' | 'memory' | 'custom';
|
|
4
|
+
interface StoreConfig {
|
|
5
|
+
type: VectorStoreType;
|
|
6
|
+
namespace?: string;
|
|
7
|
+
dimensions?: number;
|
|
8
|
+
metric?: DistanceMetric;
|
|
9
|
+
}
|
|
10
|
+
type DistanceMetric = 'cosine' | 'euclidean' | 'dot_product' | 'manhattan';
|
|
11
|
+
interface VectorRecord {
|
|
12
|
+
id: string;
|
|
13
|
+
vector: EmbeddingVector;
|
|
14
|
+
text?: string;
|
|
15
|
+
metadata?: ChunkMetadata;
|
|
16
|
+
}
|
|
17
|
+
interface StoredVector {
|
|
18
|
+
id: string;
|
|
19
|
+
namespace?: string;
|
|
20
|
+
dimensions: number;
|
|
21
|
+
hasText: boolean;
|
|
22
|
+
metadataKeys: string[];
|
|
23
|
+
createdAt?: number;
|
|
24
|
+
updatedAt?: number;
|
|
25
|
+
}
|
|
26
|
+
interface PineconeStoreConfig extends StoreConfig {
|
|
27
|
+
type: 'pinecone';
|
|
28
|
+
apiKey: string;
|
|
29
|
+
environment?: string;
|
|
30
|
+
indexName: string;
|
|
31
|
+
podType?: string;
|
|
32
|
+
replicas?: number;
|
|
33
|
+
metric?: DistanceMetric;
|
|
34
|
+
}
|
|
35
|
+
interface WeaviateStoreConfig extends StoreConfig {
|
|
36
|
+
type: 'weaviate';
|
|
37
|
+
url: string;
|
|
38
|
+
apiKey?: string;
|
|
39
|
+
className: string;
|
|
40
|
+
schema?: WeaviateSchema;
|
|
41
|
+
}
|
|
42
|
+
interface WeaviateSchema {
|
|
43
|
+
class: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
properties: WeaviateProperty[];
|
|
46
|
+
vectorizer?: string;
|
|
47
|
+
moduleConfig?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
interface WeaviateProperty {
|
|
50
|
+
name: string;
|
|
51
|
+
dataType: string[];
|
|
52
|
+
description?: string;
|
|
53
|
+
indexFilterable?: boolean;
|
|
54
|
+
indexSearchable?: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface ChromaStoreConfig extends StoreConfig {
|
|
57
|
+
type: 'chroma';
|
|
58
|
+
url?: string;
|
|
59
|
+
collectionName: string;
|
|
60
|
+
auth?: {
|
|
61
|
+
token?: string;
|
|
62
|
+
credentials?: string;
|
|
63
|
+
};
|
|
64
|
+
tenant?: string;
|
|
65
|
+
database?: string;
|
|
66
|
+
}
|
|
67
|
+
interface QdrantStoreConfig extends StoreConfig {
|
|
68
|
+
type: 'qdrant';
|
|
69
|
+
url: string;
|
|
70
|
+
apiKey?: string;
|
|
71
|
+
collectionName: string;
|
|
72
|
+
vectorConfig?: QdrantVectorConfig;
|
|
73
|
+
}
|
|
74
|
+
interface QdrantVectorConfig {
|
|
75
|
+
size: number;
|
|
76
|
+
distance: 'Cosine' | 'Euclid' | 'Dot';
|
|
77
|
+
hnswConfig?: {
|
|
78
|
+
m?: number;
|
|
79
|
+
efConstruct?: number;
|
|
80
|
+
fullScanThreshold?: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
interface MilvusStoreConfig extends StoreConfig {
|
|
84
|
+
type: 'milvus';
|
|
85
|
+
url: string;
|
|
86
|
+
username?: string;
|
|
87
|
+
password?: string;
|
|
88
|
+
collectionName: string;
|
|
89
|
+
indexType?: 'IVF_FLAT' | 'IVF_SQ8' | 'IVF_PQ' | 'HNSW' | 'ANNOY';
|
|
90
|
+
indexParams?: Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
interface PgVectorStoreConfig extends StoreConfig {
|
|
93
|
+
type: 'pgvector';
|
|
94
|
+
connectionString?: string;
|
|
95
|
+
host?: string;
|
|
96
|
+
port?: number;
|
|
97
|
+
database?: string;
|
|
98
|
+
user?: string;
|
|
99
|
+
password?: string;
|
|
100
|
+
tableName: string;
|
|
101
|
+
vectorColumn?: string;
|
|
102
|
+
contentColumn?: string;
|
|
103
|
+
metadataColumn?: string;
|
|
104
|
+
indexType?: 'ivfflat' | 'hnsw';
|
|
105
|
+
indexParams?: {
|
|
106
|
+
lists?: number;
|
|
107
|
+
m?: number;
|
|
108
|
+
efConstruction?: number;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
interface MemoryStoreConfig extends StoreConfig {
|
|
112
|
+
type: 'memory';
|
|
113
|
+
maxVectors?: number;
|
|
114
|
+
persistPath?: string;
|
|
115
|
+
persistInterval?: number;
|
|
116
|
+
}
|
|
117
|
+
interface UpsertOptions {
|
|
118
|
+
namespace?: string;
|
|
119
|
+
batchSize?: number;
|
|
120
|
+
onProgress?: (progress: {
|
|
121
|
+
completed: number;
|
|
122
|
+
total: number;
|
|
123
|
+
}) => void;
|
|
124
|
+
}
|
|
125
|
+
interface UpsertResult {
|
|
126
|
+
upsertedIds: string[];
|
|
127
|
+
upsertedCount: number;
|
|
128
|
+
errors: Array<{
|
|
129
|
+
id: string;
|
|
130
|
+
error: string;
|
|
131
|
+
}>;
|
|
132
|
+
durationMs: number;
|
|
133
|
+
}
|
|
134
|
+
interface DeleteOptions {
|
|
135
|
+
namespace?: string;
|
|
136
|
+
deleteAll?: boolean;
|
|
137
|
+
filter?: Record<string, unknown>;
|
|
138
|
+
}
|
|
139
|
+
interface DeleteResult {
|
|
140
|
+
deletedCount: number;
|
|
141
|
+
durationMs: number;
|
|
142
|
+
}
|
|
143
|
+
interface StoreQueryOptions extends SearchOptions {
|
|
144
|
+
includeVectors?: boolean;
|
|
145
|
+
includeText?: boolean;
|
|
146
|
+
scoreThreshold?: number;
|
|
147
|
+
}
|
|
148
|
+
interface StoreQueryResult {
|
|
149
|
+
matches: SearchResult[];
|
|
150
|
+
namespace?: string;
|
|
151
|
+
durationMs: number;
|
|
152
|
+
}
|
|
153
|
+
interface StoreStats {
|
|
154
|
+
type: VectorStoreType;
|
|
155
|
+
vectorCount: number;
|
|
156
|
+
namespaceCount: number;
|
|
157
|
+
indexSizeBytes?: number;
|
|
158
|
+
dimensions: number;
|
|
159
|
+
metric: DistanceMetric;
|
|
160
|
+
lastUpdated?: number;
|
|
161
|
+
}
|
|
162
|
+
interface StoreHealth {
|
|
163
|
+
healthy: boolean;
|
|
164
|
+
latencyMs: number;
|
|
165
|
+
error?: string;
|
|
166
|
+
lastCheck: number;
|
|
167
|
+
}
|
|
168
|
+
interface IndexInfo {
|
|
169
|
+
name: string;
|
|
170
|
+
dimensions: number;
|
|
171
|
+
metric: DistanceMetric;
|
|
172
|
+
vectorCount: number;
|
|
173
|
+
indexType?: string;
|
|
174
|
+
createdAt?: number;
|
|
175
|
+
status: 'ready' | 'initializing' | 'scaling' | 'error';
|
|
176
|
+
}
|
|
177
|
+
interface CollectionInfo {
|
|
178
|
+
name: string;
|
|
179
|
+
vectorCount: number;
|
|
180
|
+
dimensions: number;
|
|
181
|
+
metric: DistanceMetric;
|
|
182
|
+
createdAt?: number;
|
|
183
|
+
metadata?: Record<string, unknown>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare abstract class BaseStore {
|
|
187
|
+
abstract readonly storeType: VectorStoreType;
|
|
188
|
+
protected config: StoreConfig;
|
|
189
|
+
constructor(config: StoreConfig);
|
|
190
|
+
abstract upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
191
|
+
abstract query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
192
|
+
abstract delete(ids: string[], options?: DeleteOptions): Promise<DeleteResult>;
|
|
193
|
+
abstract deleteAll(options?: DeleteOptions): Promise<DeleteResult>;
|
|
194
|
+
abstract getStats(): Promise<StoreStats>;
|
|
195
|
+
abstract checkHealth(): Promise<StoreHealth>;
|
|
196
|
+
abstract close(): Promise<void>;
|
|
197
|
+
get namespace(): string;
|
|
198
|
+
get dimensions(): number | undefined;
|
|
199
|
+
get metric(): DistanceMetric;
|
|
200
|
+
protected calculateScore(a: EmbeddingVector, b: EmbeddingVector): number;
|
|
201
|
+
protected filterByMetadata(records: VectorRecord[], filter?: Record<string, unknown>): VectorRecord[];
|
|
202
|
+
protected toSearchResults(records: Array<VectorRecord & {
|
|
203
|
+
score: number;
|
|
204
|
+
}>, options?: StoreQueryOptions): SearchResult[];
|
|
205
|
+
}
|
|
206
|
+
interface StoreFactoryOptions {
|
|
207
|
+
defaultType?: VectorStoreType;
|
|
208
|
+
stores?: Record<VectorStoreType, StoreConfig>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare class MemoryStore extends BaseStore {
|
|
212
|
+
readonly storeType: VectorStoreType;
|
|
213
|
+
private vectors;
|
|
214
|
+
private namespaces;
|
|
215
|
+
private persistPath?;
|
|
216
|
+
private persistInterval?;
|
|
217
|
+
private maxVectors;
|
|
218
|
+
constructor(config?: MemoryStoreConfig);
|
|
219
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
220
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
221
|
+
delete(ids: string[], options?: DeleteOptions): Promise<DeleteResult>;
|
|
222
|
+
deleteAll(options?: DeleteOptions): Promise<DeleteResult>;
|
|
223
|
+
getStats(): Promise<StoreStats>;
|
|
224
|
+
checkHealth(): Promise<StoreHealth>;
|
|
225
|
+
close(): Promise<void>;
|
|
226
|
+
persist(): Promise<void>;
|
|
227
|
+
load(): Promise<void>;
|
|
228
|
+
getAll(): VectorRecord[];
|
|
229
|
+
getById(id: string): VectorRecord | undefined;
|
|
230
|
+
}
|
|
231
|
+
declare function createMemoryStore(config?: MemoryStoreConfig): MemoryStore;
|
|
232
|
+
|
|
233
|
+
declare class PineconeStore extends BaseStore {
|
|
234
|
+
readonly storeType: VectorStoreType;
|
|
235
|
+
private client;
|
|
236
|
+
private index;
|
|
237
|
+
private apiKey;
|
|
238
|
+
private indexName;
|
|
239
|
+
private initialized;
|
|
240
|
+
constructor(config: PineconeStoreConfig);
|
|
241
|
+
init(): Promise<void>;
|
|
242
|
+
private ensureInitialized;
|
|
243
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
244
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
245
|
+
delete(ids: string[], options?: DeleteOptions): Promise<DeleteResult>;
|
|
246
|
+
deleteAll(options?: DeleteOptions): Promise<DeleteResult>;
|
|
247
|
+
getStats(): Promise<StoreStats>;
|
|
248
|
+
checkHealth(): Promise<StoreHealth>;
|
|
249
|
+
close(): Promise<void>;
|
|
250
|
+
}
|
|
251
|
+
declare function createPineconeStore(config: PineconeStoreConfig): PineconeStore;
|
|
252
|
+
|
|
253
|
+
declare class ChromaStore extends BaseStore {
|
|
254
|
+
readonly storeType: VectorStoreType;
|
|
255
|
+
private client;
|
|
256
|
+
private collection;
|
|
257
|
+
private collectionName;
|
|
258
|
+
private url?;
|
|
259
|
+
private initialized;
|
|
260
|
+
constructor(config: ChromaStoreConfig);
|
|
261
|
+
init(): Promise<void>;
|
|
262
|
+
private metricToChroma;
|
|
263
|
+
private ensureInitialized;
|
|
264
|
+
upsert(records: VectorRecord[], _options?: UpsertOptions): Promise<UpsertResult>;
|
|
265
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
266
|
+
delete(ids: string[], _options?: DeleteOptions): Promise<DeleteResult>;
|
|
267
|
+
deleteAll(_options?: DeleteOptions): Promise<DeleteResult>;
|
|
268
|
+
getStats(): Promise<StoreStats>;
|
|
269
|
+
checkHealth(): Promise<StoreHealth>;
|
|
270
|
+
close(): Promise<void>;
|
|
271
|
+
}
|
|
272
|
+
declare function createChromaStore(config: ChromaStoreConfig): ChromaStore;
|
|
273
|
+
|
|
274
|
+
declare class QdrantStore extends BaseStore {
|
|
275
|
+
readonly storeType: VectorStoreType;
|
|
276
|
+
private client;
|
|
277
|
+
private collectionName;
|
|
278
|
+
private url;
|
|
279
|
+
private apiKey?;
|
|
280
|
+
private initialized;
|
|
281
|
+
constructor(config: QdrantStoreConfig);
|
|
282
|
+
init(): Promise<void>;
|
|
283
|
+
private metricToQdrant;
|
|
284
|
+
private ensureInitialized;
|
|
285
|
+
upsert(records: VectorRecord[], options?: UpsertOptions): Promise<UpsertResult>;
|
|
286
|
+
query(vector: EmbeddingVector, options?: StoreQueryOptions): Promise<StoreQueryResult>;
|
|
287
|
+
private buildQdrantFilter;
|
|
288
|
+
delete(ids: string[], _options?: DeleteOptions): Promise<DeleteResult>;
|
|
289
|
+
deleteAll(_options?: DeleteOptions): Promise<DeleteResult>;
|
|
290
|
+
getStats(): Promise<StoreStats>;
|
|
291
|
+
checkHealth(): Promise<StoreHealth>;
|
|
292
|
+
close(): Promise<void>;
|
|
293
|
+
}
|
|
294
|
+
declare function createQdrantStore(config: QdrantStoreConfig): QdrantStore;
|
|
295
|
+
|
|
296
|
+
declare function createStore(type: VectorStoreType, config: StoreConfig): BaseStore;
|
|
297
|
+
|
|
298
|
+
export { BaseStore, ChromaStore, type ChromaStoreConfig, type CollectionInfo, type DeleteOptions, type DeleteResult, type DistanceMetric, type IndexInfo, MemoryStore, type MemoryStoreConfig, type MilvusStoreConfig, type PgVectorStoreConfig, PineconeStore, type PineconeStoreConfig, QdrantStore, type QdrantStoreConfig, type StoreConfig, type StoreFactoryOptions, type StoreHealth, type StoreQueryOptions, type StoreQueryResult, type StoreStats, type StoredVector, type UpsertOptions, type UpsertResult, type VectorRecord, type VectorStoreType, type WeaviateStoreConfig, createChromaStore, createMemoryStore, createPineconeStore, createQdrantStore, createStore };
|