@@ -62,7 +62,8 @@ export type EnsureIndexOptions =
6262 | EnsureTtlIndexOptions
6363 | EnsureMdiIndexOptions
6464 | EnsureMdiPrefixedIndexOptions
65- | EnsureInvertedIndexOptions ;
65+ | EnsureInvertedIndexOptions
66+ | EnsureVectorIndexOptions ;
6667
6768/**
6869 * Shared attributes of all index creation options.
@@ -558,6 +559,56 @@ export type InvertedIndexStoredValueOptions = {
558559 */
559560 cache ?: boolean ;
560561} ;
562+
563+ /**
564+ * Options for creating a vector index.
565+ */
566+ export type EnsureVectorIndexOptions = EnsureIndexOptionsType <
567+ "vector" ,
568+ [ string ] ,
569+ {
570+ /**
571+ * The number of threads to use for indexing. Default is 2.
572+ */
573+ parallelism ?: number ;
574+
575+ /**
576+ * Vector index parameters, following Faiss configuration.
577+ */
578+ params : {
579+ /**
580+ * Whether to use cosine or l2 (Euclidean) distance.
581+ */
582+ metric : "cosine" | "l2" ;
583+
584+ /**
585+ * Vector dimension. Must match the length of vectors in documents.
586+ */
587+ dimension : number ;
588+
589+ /**
590+ * Number of Voronoi cells (centroids) for IVF. Affects accuracy and index build time.
591+ */
592+ nLists : number ;
593+
594+ /**
595+ * How many neighboring centroids to probe by default. Higher = slower, better recall.
596+ */
597+ defaultNProbe ?: number ;
598+
599+ /**
600+ * Training iterations for index build. Default is 25.
601+ */
602+ trainingIterations ?: number ;
603+
604+ /**
605+ * Advanced Faiss index factory string.
606+ * If not specified, defaults to IVF<nLists>,Flat.
607+ */
608+ factory ?: string ;
609+ } ;
610+ }
611+ > ;
561612//#endregion
562613
563614//#region IndexDescription
@@ -572,7 +623,8 @@ export type IndexDescription =
572623 | MdiIndexDescription
573624 | MdiPrefixedIndexDescription
574625 | InvertedIndexDescription
575- | SystemIndexDescription ;
626+ | SystemIndexDescription
627+ | VectorIndexDescription ;
576628
577629/**
578630 * An object representing a system index.
@@ -862,6 +914,26 @@ export type HiddenIndexDescription = (
862914 */
863915 progress ?: number ;
864916} ;
917+
918+ /**
919+ * An object representing a vector index.
920+ */
921+ export type VectorIndexDescription = IndexDescriptionType <
922+ "vector" ,
923+ [ string ] ,
924+ {
925+ parallelism : number ;
926+ inBackground : boolean ;
927+ params : {
928+ metric : "cosine" | "l2" ;
929+ dimension : number ;
930+ nLists : number ;
931+ defaultNProbe ?: number ;
932+ trainingIterations ?: number ;
933+ factory ?: string ;
934+ } ;
935+ }
936+ > ;
865937//#endregion
866938
867939//#region Index selectors
0 commit comments