mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-09 05:12:58 +00:00
feat: expose hnsw indices (#1595)
PR closes #1522 --------- Co-authored-by: Will Jones <willjones127@gmail.com>
This commit is contained in:
@@ -113,6 +113,25 @@ export interface IvfPqOptions {
|
||||
sampleRate?: number;
|
||||
}
|
||||
|
||||
export interface HnswPqOptions {
|
||||
distanceType?: "l2" | "cosine" | "dot";
|
||||
numPartitions?: number;
|
||||
numSubVectors?: number;
|
||||
maxIterations?: number;
|
||||
sampleRate?: number;
|
||||
m?: number;
|
||||
efConstruction?: number;
|
||||
}
|
||||
|
||||
export interface HnswSqOptions {
|
||||
distanceType?: "l2" | "cosine" | "dot";
|
||||
numPartitions?: number;
|
||||
maxIterations?: number;
|
||||
sampleRate?: number;
|
||||
m?: number;
|
||||
efConstruction?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to create a full text search index
|
||||
*/
|
||||
@@ -227,6 +246,43 @@ export class Index {
|
||||
static fts(options?: Partial<FtsOptions>) {
|
||||
return new Index(LanceDbIndex.fts(options?.withPositions));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Create a hnswpq index
|
||||
*
|
||||
*/
|
||||
static hnswPq(options?: Partial<HnswPqOptions>) {
|
||||
return new Index(
|
||||
LanceDbIndex.hnswPq(
|
||||
options?.distanceType,
|
||||
options?.numPartitions,
|
||||
options?.numSubVectors,
|
||||
options?.maxIterations,
|
||||
options?.sampleRate,
|
||||
options?.m,
|
||||
options?.efConstruction,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Create a hnswsq index
|
||||
*
|
||||
*/
|
||||
static hnswSq(options?: Partial<HnswSqOptions>) {
|
||||
return new Index(
|
||||
LanceDbIndex.hnswSq(
|
||||
options?.distanceType,
|
||||
options?.numPartitions,
|
||||
options?.maxIterations,
|
||||
options?.sampleRate,
|
||||
options?.m,
|
||||
options?.efConstruction,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export interface IndexOptions {
|
||||
|
||||
Reference in New Issue
Block a user