@wiscale/tauri-plugin-velesdb 0.5.2 → 1.1.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/dist/index.d.mts +240 -1
- package/dist/index.d.ts +240 -1
- package/dist/index.js +42 -2
- package/dist/index.mjs +33 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,25 @@ interface CreateCollectionRequest {
|
|
|
32
32
|
/** Distance metric for similarity calculations. Default: 'cosine'. */
|
|
33
33
|
metric?: DistanceMetric;
|
|
34
34
|
}
|
|
35
|
+
/** Request to create a metadata-only collection. */
|
|
36
|
+
interface CreateMetadataCollectionRequest {
|
|
37
|
+
/** Collection name (unique identifier). */
|
|
38
|
+
name: string;
|
|
39
|
+
}
|
|
40
|
+
/** A metadata-only point to insert (no vector). */
|
|
41
|
+
interface MetadataPointInput {
|
|
42
|
+
/** Unique point identifier. */
|
|
43
|
+
id: number;
|
|
44
|
+
/** Payload with metadata. */
|
|
45
|
+
payload: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
/** Request to upsert metadata-only points. */
|
|
48
|
+
interface UpsertMetadataRequest {
|
|
49
|
+
/** Target collection name. */
|
|
50
|
+
collection: string;
|
|
51
|
+
/** Metadata points to upsert. */
|
|
52
|
+
points: MetadataPointInput[];
|
|
53
|
+
}
|
|
35
54
|
/** Collection information. */
|
|
36
55
|
interface CollectionInfo {
|
|
37
56
|
/** Collection name. */
|
|
@@ -97,6 +116,73 @@ interface QueryRequest {
|
|
|
97
116
|
/** Query parameters (for parameterized queries). */
|
|
98
117
|
params?: Record<string, unknown>;
|
|
99
118
|
}
|
|
119
|
+
/** Request to get points by IDs. */
|
|
120
|
+
interface GetPointsRequest {
|
|
121
|
+
/** Target collection name. */
|
|
122
|
+
collection: string;
|
|
123
|
+
/** Point IDs to retrieve. */
|
|
124
|
+
ids: number[];
|
|
125
|
+
}
|
|
126
|
+
/** Request to delete points by IDs. */
|
|
127
|
+
interface DeletePointsRequest {
|
|
128
|
+
/** Target collection name. */
|
|
129
|
+
collection: string;
|
|
130
|
+
/** Point IDs to delete. */
|
|
131
|
+
ids: number[];
|
|
132
|
+
}
|
|
133
|
+
/** Individual search request within a batch. */
|
|
134
|
+
interface IndividualSearchRequest {
|
|
135
|
+
/** Query vector. */
|
|
136
|
+
vector: number[];
|
|
137
|
+
/** Number of results to return. Default: 10. */
|
|
138
|
+
topK?: number;
|
|
139
|
+
/** Optional metadata filter. */
|
|
140
|
+
filter?: Record<string, unknown>;
|
|
141
|
+
}
|
|
142
|
+
/** Request for batch search. */
|
|
143
|
+
interface BatchSearchRequest {
|
|
144
|
+
/** Target collection name. */
|
|
145
|
+
collection: string;
|
|
146
|
+
/** List of search queries. */
|
|
147
|
+
searches: IndividualSearchRequest[];
|
|
148
|
+
}
|
|
149
|
+
/** Fusion strategy for multi-query search. */
|
|
150
|
+
type FusionStrategy = 'rrf' | 'average' | 'maximum' | 'weighted';
|
|
151
|
+
/** Fusion parameters for multi-query search. */
|
|
152
|
+
interface FusionParams {
|
|
153
|
+
/** RRF k parameter (default: 60). */
|
|
154
|
+
k?: number;
|
|
155
|
+
/** Weighted fusion: average weight (default: 0.6). */
|
|
156
|
+
avgWeight?: number;
|
|
157
|
+
/** Weighted fusion: max weight (default: 0.3). */
|
|
158
|
+
maxWeight?: number;
|
|
159
|
+
/** Weighted fusion: hit weight (default: 0.1). */
|
|
160
|
+
hitWeight?: number;
|
|
161
|
+
}
|
|
162
|
+
/** Request for multi-query fusion search. */
|
|
163
|
+
interface MultiQuerySearchRequest {
|
|
164
|
+
/** Target collection name. */
|
|
165
|
+
collection: string;
|
|
166
|
+
/** List of query vectors. */
|
|
167
|
+
vectors: number[][];
|
|
168
|
+
/** Number of results to return. Default: 10. */
|
|
169
|
+
topK?: number;
|
|
170
|
+
/** Fusion strategy: 'rrf', 'average', 'maximum', 'weighted'. Default: 'rrf'. */
|
|
171
|
+
fusion?: FusionStrategy;
|
|
172
|
+
/** Fusion parameters. */
|
|
173
|
+
fusionParams?: FusionParams;
|
|
174
|
+
/** Optional metadata filter. */
|
|
175
|
+
filter?: Record<string, unknown>;
|
|
176
|
+
}
|
|
177
|
+
/** Point output for get operations. */
|
|
178
|
+
interface PointOutput {
|
|
179
|
+
/** Point ID. */
|
|
180
|
+
id: number;
|
|
181
|
+
/** Vector data. */
|
|
182
|
+
vector: number[];
|
|
183
|
+
/** Point payload (if any). */
|
|
184
|
+
payload?: Record<string, unknown>;
|
|
185
|
+
}
|
|
100
186
|
/** Search result item. */
|
|
101
187
|
interface SearchResult {
|
|
102
188
|
/** Point ID. */
|
|
@@ -138,6 +224,22 @@ interface CommandError {
|
|
|
138
224
|
* ```
|
|
139
225
|
*/
|
|
140
226
|
declare function createCollection(request: CreateCollectionRequest): Promise<CollectionInfo>;
|
|
227
|
+
/**
|
|
228
|
+
* Creates a metadata-only collection (no vectors, just payloads).
|
|
229
|
+
*
|
|
230
|
+
* Useful for storing reference data that can be joined with vector collections.
|
|
231
|
+
*
|
|
232
|
+
* @param request - Collection configuration
|
|
233
|
+
* @returns Collection info
|
|
234
|
+
* @throws {CommandError} If collection already exists
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* const info = await createMetadataCollection({ name: 'products' });
|
|
239
|
+
* console.log(`Created metadata collection: ${info.name}`);
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
declare function createMetadataCollection(request: CreateMetadataCollectionRequest): Promise<CollectionInfo>;
|
|
141
243
|
/**
|
|
142
244
|
* Deletes a collection and all its data.
|
|
143
245
|
*
|
|
@@ -196,6 +298,28 @@ declare function getCollection(name: string): Promise<CollectionInfo>;
|
|
|
196
298
|
* ```
|
|
197
299
|
*/
|
|
198
300
|
declare function upsert(request: UpsertRequest): Promise<number>;
|
|
301
|
+
/**
|
|
302
|
+
* Inserts or updates metadata-only points in a collection.
|
|
303
|
+
*
|
|
304
|
+
* Use this for collections created with createMetadataCollection().
|
|
305
|
+
*
|
|
306
|
+
* @param request - Upsert request with collection name and metadata points
|
|
307
|
+
* @returns Number of points upserted
|
|
308
|
+
* @throws {CommandError} If collection doesn't exist or is not metadata-only
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```typescript
|
|
312
|
+
* const count = await upsertMetadata({
|
|
313
|
+
* collection: 'products',
|
|
314
|
+
* points: [
|
|
315
|
+
* { id: 1, payload: { name: 'Widget', price: 99 } },
|
|
316
|
+
* { id: 2, payload: { name: 'Gadget', price: 149 } }
|
|
317
|
+
* ]
|
|
318
|
+
* });
|
|
319
|
+
* console.log(`Upserted ${count} metadata points`);
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
declare function upsertMetadata(request: UpsertMetadataRequest): Promise<number>;
|
|
199
323
|
/**
|
|
200
324
|
* Performs vector similarity search.
|
|
201
325
|
*
|
|
@@ -269,5 +393,120 @@ declare function hybridSearch(request: HybridSearchRequest): Promise<SearchRespo
|
|
|
269
393
|
* ```
|
|
270
394
|
*/
|
|
271
395
|
declare function query(request: QueryRequest): Promise<SearchResponse>;
|
|
396
|
+
/**
|
|
397
|
+
* Retrieves points by their IDs.
|
|
398
|
+
*
|
|
399
|
+
* @param request - Get points request with collection name and IDs
|
|
400
|
+
* @returns Array of points (null for IDs not found)
|
|
401
|
+
* @throws {CommandError} If collection doesn't exist
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```typescript
|
|
405
|
+
* const points = await getPoints({
|
|
406
|
+
* collection: 'documents',
|
|
407
|
+
* ids: [1, 2, 3]
|
|
408
|
+
* });
|
|
409
|
+
* points.forEach((p, i) => {
|
|
410
|
+
* if (p) console.log(`Point ${p.id}: ${p.payload?.title}`);
|
|
411
|
+
* else console.log(`Point at index ${i} not found`);
|
|
412
|
+
* });
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
declare function getPoints(request: GetPointsRequest): Promise<Array<PointOutput | null>>;
|
|
416
|
+
/**
|
|
417
|
+
* Deletes points by their IDs.
|
|
418
|
+
*
|
|
419
|
+
* @param request - Delete points request with collection name and IDs
|
|
420
|
+
* @throws {CommandError} If collection doesn't exist
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```typescript
|
|
424
|
+
* await deletePoints({
|
|
425
|
+
* collection: 'documents',
|
|
426
|
+
* ids: [1, 2, 3]
|
|
427
|
+
* });
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
declare function deletePoints(request: DeletePointsRequest): Promise<void>;
|
|
431
|
+
/**
|
|
432
|
+
* Performs batch vector similarity search.
|
|
433
|
+
*
|
|
434
|
+
* @param request - Batch search request with multiple queries
|
|
435
|
+
* @returns Array of search responses, one per query
|
|
436
|
+
* @throws {CommandError} If collection doesn't exist
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```typescript
|
|
440
|
+
* const responses = await batchSearch({
|
|
441
|
+
* collection: 'documents',
|
|
442
|
+
* searches: [
|
|
443
|
+
* { vector: embedding1, topK: 5 },
|
|
444
|
+
* { vector: embedding2, topK: 10, filter: { category: 'tech' } }
|
|
445
|
+
* ]
|
|
446
|
+
* });
|
|
447
|
+
* responses.forEach((resp, i) => {
|
|
448
|
+
* console.log(`Query ${i}: ${resp.results.length} results in ${resp.timingMs}ms`);
|
|
449
|
+
* });
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
declare function batchSearch(request: BatchSearchRequest): Promise<SearchResponse[]>;
|
|
453
|
+
/**
|
|
454
|
+
* Performs multi-query fusion search combining results from multiple query vectors.
|
|
455
|
+
*
|
|
456
|
+
* Ideal for RAG pipelines using Multiple Query Generation (MQG).
|
|
457
|
+
*
|
|
458
|
+
* @param request - Multi-query search request
|
|
459
|
+
* @returns Fused search response
|
|
460
|
+
* @throws {CommandError} If collection doesn't exist or parameters are invalid
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```typescript
|
|
464
|
+
* // RRF fusion (default)
|
|
465
|
+
* const response = await multiQuerySearch({
|
|
466
|
+
* collection: 'documents',
|
|
467
|
+
* vectors: [embedding1, embedding2, embedding3],
|
|
468
|
+
* topK: 10,
|
|
469
|
+
* fusion: 'rrf',
|
|
470
|
+
* fusionParams: { k: 60 }
|
|
471
|
+
* });
|
|
472
|
+
*
|
|
473
|
+
* // Weighted fusion
|
|
474
|
+
* const response = await multiQuerySearch({
|
|
475
|
+
* collection: 'documents',
|
|
476
|
+
* vectors: [embedding1, embedding2],
|
|
477
|
+
* topK: 10,
|
|
478
|
+
* fusion: 'weighted',
|
|
479
|
+
* fusionParams: { avgWeight: 0.6, maxWeight: 0.3, hitWeight: 0.1 }
|
|
480
|
+
* });
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
declare function multiQuerySearch(request: MultiQuerySearchRequest): Promise<SearchResponse>;
|
|
484
|
+
/**
|
|
485
|
+
* Checks if a collection is empty.
|
|
486
|
+
*
|
|
487
|
+
* @param name - Collection name
|
|
488
|
+
* @returns true if collection has no points, false otherwise
|
|
489
|
+
* @throws {CommandError} If collection doesn't exist
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```typescript
|
|
493
|
+
* const empty = await isEmpty('documents');
|
|
494
|
+
* if (empty) console.log('Collection is empty');
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
declare function isEmpty(name: string): Promise<boolean>;
|
|
498
|
+
/**
|
|
499
|
+
* Flushes pending changes to disk.
|
|
500
|
+
*
|
|
501
|
+
* @param name - Collection name
|
|
502
|
+
* @throws {CommandError} If collection doesn't exist
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* await flush('documents');
|
|
507
|
+
* console.log('Changes persisted to disk');
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
declare function flush(name: string): Promise<void>;
|
|
272
511
|
|
|
273
|
-
export { type CollectionInfo, type CommandError, type CreateCollectionRequest, type DistanceMetric, type HybridSearchRequest, type PointInput, type QueryRequest, type SearchRequest, type SearchResponse, type SearchResult, type TextSearchRequest, type UpsertRequest, createCollection, deleteCollection, getCollection, hybridSearch, listCollections, query, search, textSearch, upsert };
|
|
512
|
+
export { type BatchSearchRequest, type CollectionInfo, type CommandError, type CreateCollectionRequest, type CreateMetadataCollectionRequest, type DeletePointsRequest, type DistanceMetric, type FusionParams, type FusionStrategy, type GetPointsRequest, type HybridSearchRequest, type IndividualSearchRequest, type MetadataPointInput, type MultiQuerySearchRequest, type PointInput, type PointOutput, type QueryRequest, type SearchRequest, type SearchResponse, type SearchResult, type TextSearchRequest, type UpsertMetadataRequest, type UpsertRequest, batchSearch, createCollection, createMetadataCollection, deleteCollection, deletePoints, flush, getCollection, getPoints, hybridSearch, isEmpty, listCollections, multiQuerySearch, query, search, textSearch, upsert, upsertMetadata };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,25 @@ interface CreateCollectionRequest {
|
|
|
32
32
|
/** Distance metric for similarity calculations. Default: 'cosine'. */
|
|
33
33
|
metric?: DistanceMetric;
|
|
34
34
|
}
|
|
35
|
+
/** Request to create a metadata-only collection. */
|
|
36
|
+
interface CreateMetadataCollectionRequest {
|
|
37
|
+
/** Collection name (unique identifier). */
|
|
38
|
+
name: string;
|
|
39
|
+
}
|
|
40
|
+
/** A metadata-only point to insert (no vector). */
|
|
41
|
+
interface MetadataPointInput {
|
|
42
|
+
/** Unique point identifier. */
|
|
43
|
+
id: number;
|
|
44
|
+
/** Payload with metadata. */
|
|
45
|
+
payload: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
/** Request to upsert metadata-only points. */
|
|
48
|
+
interface UpsertMetadataRequest {
|
|
49
|
+
/** Target collection name. */
|
|
50
|
+
collection: string;
|
|
51
|
+
/** Metadata points to upsert. */
|
|
52
|
+
points: MetadataPointInput[];
|
|
53
|
+
}
|
|
35
54
|
/** Collection information. */
|
|
36
55
|
interface CollectionInfo {
|
|
37
56
|
/** Collection name. */
|
|
@@ -97,6 +116,73 @@ interface QueryRequest {
|
|
|
97
116
|
/** Query parameters (for parameterized queries). */
|
|
98
117
|
params?: Record<string, unknown>;
|
|
99
118
|
}
|
|
119
|
+
/** Request to get points by IDs. */
|
|
120
|
+
interface GetPointsRequest {
|
|
121
|
+
/** Target collection name. */
|
|
122
|
+
collection: string;
|
|
123
|
+
/** Point IDs to retrieve. */
|
|
124
|
+
ids: number[];
|
|
125
|
+
}
|
|
126
|
+
/** Request to delete points by IDs. */
|
|
127
|
+
interface DeletePointsRequest {
|
|
128
|
+
/** Target collection name. */
|
|
129
|
+
collection: string;
|
|
130
|
+
/** Point IDs to delete. */
|
|
131
|
+
ids: number[];
|
|
132
|
+
}
|
|
133
|
+
/** Individual search request within a batch. */
|
|
134
|
+
interface IndividualSearchRequest {
|
|
135
|
+
/** Query vector. */
|
|
136
|
+
vector: number[];
|
|
137
|
+
/** Number of results to return. Default: 10. */
|
|
138
|
+
topK?: number;
|
|
139
|
+
/** Optional metadata filter. */
|
|
140
|
+
filter?: Record<string, unknown>;
|
|
141
|
+
}
|
|
142
|
+
/** Request for batch search. */
|
|
143
|
+
interface BatchSearchRequest {
|
|
144
|
+
/** Target collection name. */
|
|
145
|
+
collection: string;
|
|
146
|
+
/** List of search queries. */
|
|
147
|
+
searches: IndividualSearchRequest[];
|
|
148
|
+
}
|
|
149
|
+
/** Fusion strategy for multi-query search. */
|
|
150
|
+
type FusionStrategy = 'rrf' | 'average' | 'maximum' | 'weighted';
|
|
151
|
+
/** Fusion parameters for multi-query search. */
|
|
152
|
+
interface FusionParams {
|
|
153
|
+
/** RRF k parameter (default: 60). */
|
|
154
|
+
k?: number;
|
|
155
|
+
/** Weighted fusion: average weight (default: 0.6). */
|
|
156
|
+
avgWeight?: number;
|
|
157
|
+
/** Weighted fusion: max weight (default: 0.3). */
|
|
158
|
+
maxWeight?: number;
|
|
159
|
+
/** Weighted fusion: hit weight (default: 0.1). */
|
|
160
|
+
hitWeight?: number;
|
|
161
|
+
}
|
|
162
|
+
/** Request for multi-query fusion search. */
|
|
163
|
+
interface MultiQuerySearchRequest {
|
|
164
|
+
/** Target collection name. */
|
|
165
|
+
collection: string;
|
|
166
|
+
/** List of query vectors. */
|
|
167
|
+
vectors: number[][];
|
|
168
|
+
/** Number of results to return. Default: 10. */
|
|
169
|
+
topK?: number;
|
|
170
|
+
/** Fusion strategy: 'rrf', 'average', 'maximum', 'weighted'. Default: 'rrf'. */
|
|
171
|
+
fusion?: FusionStrategy;
|
|
172
|
+
/** Fusion parameters. */
|
|
173
|
+
fusionParams?: FusionParams;
|
|
174
|
+
/** Optional metadata filter. */
|
|
175
|
+
filter?: Record<string, unknown>;
|
|
176
|
+
}
|
|
177
|
+
/** Point output for get operations. */
|
|
178
|
+
interface PointOutput {
|
|
179
|
+
/** Point ID. */
|
|
180
|
+
id: number;
|
|
181
|
+
/** Vector data. */
|
|
182
|
+
vector: number[];
|
|
183
|
+
/** Point payload (if any). */
|
|
184
|
+
payload?: Record<string, unknown>;
|
|
185
|
+
}
|
|
100
186
|
/** Search result item. */
|
|
101
187
|
interface SearchResult {
|
|
102
188
|
/** Point ID. */
|
|
@@ -138,6 +224,22 @@ interface CommandError {
|
|
|
138
224
|
* ```
|
|
139
225
|
*/
|
|
140
226
|
declare function createCollection(request: CreateCollectionRequest): Promise<CollectionInfo>;
|
|
227
|
+
/**
|
|
228
|
+
* Creates a metadata-only collection (no vectors, just payloads).
|
|
229
|
+
*
|
|
230
|
+
* Useful for storing reference data that can be joined with vector collections.
|
|
231
|
+
*
|
|
232
|
+
* @param request - Collection configuration
|
|
233
|
+
* @returns Collection info
|
|
234
|
+
* @throws {CommandError} If collection already exists
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* const info = await createMetadataCollection({ name: 'products' });
|
|
239
|
+
* console.log(`Created metadata collection: ${info.name}`);
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
declare function createMetadataCollection(request: CreateMetadataCollectionRequest): Promise<CollectionInfo>;
|
|
141
243
|
/**
|
|
142
244
|
* Deletes a collection and all its data.
|
|
143
245
|
*
|
|
@@ -196,6 +298,28 @@ declare function getCollection(name: string): Promise<CollectionInfo>;
|
|
|
196
298
|
* ```
|
|
197
299
|
*/
|
|
198
300
|
declare function upsert(request: UpsertRequest): Promise<number>;
|
|
301
|
+
/**
|
|
302
|
+
* Inserts or updates metadata-only points in a collection.
|
|
303
|
+
*
|
|
304
|
+
* Use this for collections created with createMetadataCollection().
|
|
305
|
+
*
|
|
306
|
+
* @param request - Upsert request with collection name and metadata points
|
|
307
|
+
* @returns Number of points upserted
|
|
308
|
+
* @throws {CommandError} If collection doesn't exist or is not metadata-only
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```typescript
|
|
312
|
+
* const count = await upsertMetadata({
|
|
313
|
+
* collection: 'products',
|
|
314
|
+
* points: [
|
|
315
|
+
* { id: 1, payload: { name: 'Widget', price: 99 } },
|
|
316
|
+
* { id: 2, payload: { name: 'Gadget', price: 149 } }
|
|
317
|
+
* ]
|
|
318
|
+
* });
|
|
319
|
+
* console.log(`Upserted ${count} metadata points`);
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
declare function upsertMetadata(request: UpsertMetadataRequest): Promise<number>;
|
|
199
323
|
/**
|
|
200
324
|
* Performs vector similarity search.
|
|
201
325
|
*
|
|
@@ -269,5 +393,120 @@ declare function hybridSearch(request: HybridSearchRequest): Promise<SearchRespo
|
|
|
269
393
|
* ```
|
|
270
394
|
*/
|
|
271
395
|
declare function query(request: QueryRequest): Promise<SearchResponse>;
|
|
396
|
+
/**
|
|
397
|
+
* Retrieves points by their IDs.
|
|
398
|
+
*
|
|
399
|
+
* @param request - Get points request with collection name and IDs
|
|
400
|
+
* @returns Array of points (null for IDs not found)
|
|
401
|
+
* @throws {CommandError} If collection doesn't exist
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```typescript
|
|
405
|
+
* const points = await getPoints({
|
|
406
|
+
* collection: 'documents',
|
|
407
|
+
* ids: [1, 2, 3]
|
|
408
|
+
* });
|
|
409
|
+
* points.forEach((p, i) => {
|
|
410
|
+
* if (p) console.log(`Point ${p.id}: ${p.payload?.title}`);
|
|
411
|
+
* else console.log(`Point at index ${i} not found`);
|
|
412
|
+
* });
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
declare function getPoints(request: GetPointsRequest): Promise<Array<PointOutput | null>>;
|
|
416
|
+
/**
|
|
417
|
+
* Deletes points by their IDs.
|
|
418
|
+
*
|
|
419
|
+
* @param request - Delete points request with collection name and IDs
|
|
420
|
+
* @throws {CommandError} If collection doesn't exist
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* ```typescript
|
|
424
|
+
* await deletePoints({
|
|
425
|
+
* collection: 'documents',
|
|
426
|
+
* ids: [1, 2, 3]
|
|
427
|
+
* });
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
declare function deletePoints(request: DeletePointsRequest): Promise<void>;
|
|
431
|
+
/**
|
|
432
|
+
* Performs batch vector similarity search.
|
|
433
|
+
*
|
|
434
|
+
* @param request - Batch search request with multiple queries
|
|
435
|
+
* @returns Array of search responses, one per query
|
|
436
|
+
* @throws {CommandError} If collection doesn't exist
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```typescript
|
|
440
|
+
* const responses = await batchSearch({
|
|
441
|
+
* collection: 'documents',
|
|
442
|
+
* searches: [
|
|
443
|
+
* { vector: embedding1, topK: 5 },
|
|
444
|
+
* { vector: embedding2, topK: 10, filter: { category: 'tech' } }
|
|
445
|
+
* ]
|
|
446
|
+
* });
|
|
447
|
+
* responses.forEach((resp, i) => {
|
|
448
|
+
* console.log(`Query ${i}: ${resp.results.length} results in ${resp.timingMs}ms`);
|
|
449
|
+
* });
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
declare function batchSearch(request: BatchSearchRequest): Promise<SearchResponse[]>;
|
|
453
|
+
/**
|
|
454
|
+
* Performs multi-query fusion search combining results from multiple query vectors.
|
|
455
|
+
*
|
|
456
|
+
* Ideal for RAG pipelines using Multiple Query Generation (MQG).
|
|
457
|
+
*
|
|
458
|
+
* @param request - Multi-query search request
|
|
459
|
+
* @returns Fused search response
|
|
460
|
+
* @throws {CommandError} If collection doesn't exist or parameters are invalid
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```typescript
|
|
464
|
+
* // RRF fusion (default)
|
|
465
|
+
* const response = await multiQuerySearch({
|
|
466
|
+
* collection: 'documents',
|
|
467
|
+
* vectors: [embedding1, embedding2, embedding3],
|
|
468
|
+
* topK: 10,
|
|
469
|
+
* fusion: 'rrf',
|
|
470
|
+
* fusionParams: { k: 60 }
|
|
471
|
+
* });
|
|
472
|
+
*
|
|
473
|
+
* // Weighted fusion
|
|
474
|
+
* const response = await multiQuerySearch({
|
|
475
|
+
* collection: 'documents',
|
|
476
|
+
* vectors: [embedding1, embedding2],
|
|
477
|
+
* topK: 10,
|
|
478
|
+
* fusion: 'weighted',
|
|
479
|
+
* fusionParams: { avgWeight: 0.6, maxWeight: 0.3, hitWeight: 0.1 }
|
|
480
|
+
* });
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
declare function multiQuerySearch(request: MultiQuerySearchRequest): Promise<SearchResponse>;
|
|
484
|
+
/**
|
|
485
|
+
* Checks if a collection is empty.
|
|
486
|
+
*
|
|
487
|
+
* @param name - Collection name
|
|
488
|
+
* @returns true if collection has no points, false otherwise
|
|
489
|
+
* @throws {CommandError} If collection doesn't exist
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```typescript
|
|
493
|
+
* const empty = await isEmpty('documents');
|
|
494
|
+
* if (empty) console.log('Collection is empty');
|
|
495
|
+
* ```
|
|
496
|
+
*/
|
|
497
|
+
declare function isEmpty(name: string): Promise<boolean>;
|
|
498
|
+
/**
|
|
499
|
+
* Flushes pending changes to disk.
|
|
500
|
+
*
|
|
501
|
+
* @param name - Collection name
|
|
502
|
+
* @throws {CommandError} If collection doesn't exist
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* await flush('documents');
|
|
507
|
+
* console.log('Changes persisted to disk');
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
declare function flush(name: string): Promise<void>;
|
|
272
511
|
|
|
273
|
-
export { type CollectionInfo, type CommandError, type CreateCollectionRequest, type DistanceMetric, type HybridSearchRequest, type PointInput, type QueryRequest, type SearchRequest, type SearchResponse, type SearchResult, type TextSearchRequest, type UpsertRequest, createCollection, deleteCollection, getCollection, hybridSearch, listCollections, query, search, textSearch, upsert };
|
|
512
|
+
export { type BatchSearchRequest, type CollectionInfo, type CommandError, type CreateCollectionRequest, type CreateMetadataCollectionRequest, type DeletePointsRequest, type DistanceMetric, type FusionParams, type FusionStrategy, type GetPointsRequest, type HybridSearchRequest, type IndividualSearchRequest, type MetadataPointInput, type MultiQuerySearchRequest, type PointInput, type PointOutput, type QueryRequest, type SearchRequest, type SearchResponse, type SearchResult, type TextSearchRequest, type UpsertMetadataRequest, type UpsertRequest, batchSearch, createCollection, createMetadataCollection, deleteCollection, deletePoints, flush, getCollection, getPoints, hybridSearch, isEmpty, listCollections, multiQuerySearch, query, search, textSearch, upsert, upsertMetadata };
|
package/dist/index.js
CHANGED
|
@@ -20,21 +20,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
batchSearch: () => batchSearch,
|
|
23
24
|
createCollection: () => createCollection,
|
|
25
|
+
createMetadataCollection: () => createMetadataCollection,
|
|
24
26
|
deleteCollection: () => deleteCollection,
|
|
27
|
+
deletePoints: () => deletePoints,
|
|
28
|
+
flush: () => flush,
|
|
25
29
|
getCollection: () => getCollection,
|
|
30
|
+
getPoints: () => getPoints,
|
|
26
31
|
hybridSearch: () => hybridSearch,
|
|
32
|
+
isEmpty: () => isEmpty,
|
|
27
33
|
listCollections: () => listCollections,
|
|
34
|
+
multiQuerySearch: () => multiQuerySearch,
|
|
28
35
|
query: () => query,
|
|
29
36
|
search: () => search,
|
|
30
37
|
textSearch: () => textSearch,
|
|
31
|
-
upsert: () => upsert
|
|
38
|
+
upsert: () => upsert,
|
|
39
|
+
upsertMetadata: () => upsertMetadata
|
|
32
40
|
});
|
|
33
41
|
module.exports = __toCommonJS(index_exports);
|
|
34
42
|
var import_core = require("@tauri-apps/api/core");
|
|
35
43
|
async function createCollection(request) {
|
|
36
44
|
return (0, import_core.invoke)("plugin:velesdb|create_collection", { request });
|
|
37
45
|
}
|
|
46
|
+
async function createMetadataCollection(request) {
|
|
47
|
+
return (0, import_core.invoke)("plugin:velesdb|create_metadata_collection", { request });
|
|
48
|
+
}
|
|
38
49
|
async function deleteCollection(name) {
|
|
39
50
|
return (0, import_core.invoke)("plugin:velesdb|delete_collection", { name });
|
|
40
51
|
}
|
|
@@ -47,6 +58,9 @@ async function getCollection(name) {
|
|
|
47
58
|
async function upsert(request) {
|
|
48
59
|
return (0, import_core.invoke)("plugin:velesdb|upsert", { request });
|
|
49
60
|
}
|
|
61
|
+
async function upsertMetadata(request) {
|
|
62
|
+
return (0, import_core.invoke)("plugin:velesdb|upsert_metadata", { request });
|
|
63
|
+
}
|
|
50
64
|
async function search(request) {
|
|
51
65
|
return (0, import_core.invoke)("plugin:velesdb|search", { request });
|
|
52
66
|
}
|
|
@@ -59,15 +73,41 @@ async function hybridSearch(request) {
|
|
|
59
73
|
async function query(request) {
|
|
60
74
|
return (0, import_core.invoke)("plugin:velesdb|query", { request });
|
|
61
75
|
}
|
|
76
|
+
async function getPoints(request) {
|
|
77
|
+
return (0, import_core.invoke)("plugin:velesdb|get_points", { request });
|
|
78
|
+
}
|
|
79
|
+
async function deletePoints(request) {
|
|
80
|
+
return (0, import_core.invoke)("plugin:velesdb|delete_points", { request });
|
|
81
|
+
}
|
|
82
|
+
async function batchSearch(request) {
|
|
83
|
+
return (0, import_core.invoke)("plugin:velesdb|batch_search", { request });
|
|
84
|
+
}
|
|
85
|
+
async function multiQuerySearch(request) {
|
|
86
|
+
return (0, import_core.invoke)("plugin:velesdb|multi_query_search", { request });
|
|
87
|
+
}
|
|
88
|
+
async function isEmpty(name) {
|
|
89
|
+
return (0, import_core.invoke)("plugin:velesdb|is_empty", { name });
|
|
90
|
+
}
|
|
91
|
+
async function flush(name) {
|
|
92
|
+
return (0, import_core.invoke)("plugin:velesdb|flush", { name });
|
|
93
|
+
}
|
|
62
94
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
95
|
0 && (module.exports = {
|
|
96
|
+
batchSearch,
|
|
64
97
|
createCollection,
|
|
98
|
+
createMetadataCollection,
|
|
65
99
|
deleteCollection,
|
|
100
|
+
deletePoints,
|
|
101
|
+
flush,
|
|
66
102
|
getCollection,
|
|
103
|
+
getPoints,
|
|
67
104
|
hybridSearch,
|
|
105
|
+
isEmpty,
|
|
68
106
|
listCollections,
|
|
107
|
+
multiQuerySearch,
|
|
69
108
|
query,
|
|
70
109
|
search,
|
|
71
110
|
textSearch,
|
|
72
|
-
upsert
|
|
111
|
+
upsert,
|
|
112
|
+
upsertMetadata
|
|
73
113
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,9 @@ import { invoke } from "@tauri-apps/api/core";
|
|
|
3
3
|
async function createCollection(request) {
|
|
4
4
|
return invoke("plugin:velesdb|create_collection", { request });
|
|
5
5
|
}
|
|
6
|
+
async function createMetadataCollection(request) {
|
|
7
|
+
return invoke("plugin:velesdb|create_metadata_collection", { request });
|
|
8
|
+
}
|
|
6
9
|
async function deleteCollection(name) {
|
|
7
10
|
return invoke("plugin:velesdb|delete_collection", { name });
|
|
8
11
|
}
|
|
@@ -15,6 +18,9 @@ async function getCollection(name) {
|
|
|
15
18
|
async function upsert(request) {
|
|
16
19
|
return invoke("plugin:velesdb|upsert", { request });
|
|
17
20
|
}
|
|
21
|
+
async function upsertMetadata(request) {
|
|
22
|
+
return invoke("plugin:velesdb|upsert_metadata", { request });
|
|
23
|
+
}
|
|
18
24
|
async function search(request) {
|
|
19
25
|
return invoke("plugin:velesdb|search", { request });
|
|
20
26
|
}
|
|
@@ -27,14 +33,40 @@ async function hybridSearch(request) {
|
|
|
27
33
|
async function query(request) {
|
|
28
34
|
return invoke("plugin:velesdb|query", { request });
|
|
29
35
|
}
|
|
36
|
+
async function getPoints(request) {
|
|
37
|
+
return invoke("plugin:velesdb|get_points", { request });
|
|
38
|
+
}
|
|
39
|
+
async function deletePoints(request) {
|
|
40
|
+
return invoke("plugin:velesdb|delete_points", { request });
|
|
41
|
+
}
|
|
42
|
+
async function batchSearch(request) {
|
|
43
|
+
return invoke("plugin:velesdb|batch_search", { request });
|
|
44
|
+
}
|
|
45
|
+
async function multiQuerySearch(request) {
|
|
46
|
+
return invoke("plugin:velesdb|multi_query_search", { request });
|
|
47
|
+
}
|
|
48
|
+
async function isEmpty(name) {
|
|
49
|
+
return invoke("plugin:velesdb|is_empty", { name });
|
|
50
|
+
}
|
|
51
|
+
async function flush(name) {
|
|
52
|
+
return invoke("plugin:velesdb|flush", { name });
|
|
53
|
+
}
|
|
30
54
|
export {
|
|
55
|
+
batchSearch,
|
|
31
56
|
createCollection,
|
|
57
|
+
createMetadataCollection,
|
|
32
58
|
deleteCollection,
|
|
59
|
+
deletePoints,
|
|
60
|
+
flush,
|
|
33
61
|
getCollection,
|
|
62
|
+
getPoints,
|
|
34
63
|
hybridSearch,
|
|
64
|
+
isEmpty,
|
|
35
65
|
listCollections,
|
|
66
|
+
multiQuerySearch,
|
|
36
67
|
query,
|
|
37
68
|
search,
|
|
38
69
|
textSearch,
|
|
39
|
-
upsert
|
|
70
|
+
upsert,
|
|
71
|
+
upsertMetadata
|
|
40
72
|
};
|
package/package.json
CHANGED