@@ -34,11 +34,14 @@ class VectorIndexType(str, Enum):
3434 Attributes:
3535 HNSW: Hierarchical Navigable Small World (HNSW) index.
3636 FLAT: Flat index.
37+ DYNAMIC: Dynamic index.
38+ SPFRESH: SPFRESH index.
3739 """
3840
3941 HNSW = "hnsw"
4042 FLAT = "flat"
4143 DYNAMIC = "dynamic"
44+ SPFRESH = "spfresh"
4245
4346
4447class _MultiVectorConfigCreateBase (_ConfigCreateModel ):
@@ -127,6 +130,19 @@ def vector_index_type() -> VectorIndexType:
127130 return VectorIndexType .HNSW
128131
129132
133+ class _VectorIndexConfigSPFreshCreate (_VectorIndexConfigCreate ):
134+ maxPostingSize : Optional [int ]
135+ minPostingSize : Optional [int ]
136+ replicas : Optional [int ]
137+ rngFactor : Optional [int ]
138+ searchProbe : Optional [int ]
139+ centroidsIndexType : Optional [str ]
140+
141+ @staticmethod
142+ def vector_index_type () -> VectorIndexType :
143+ return VectorIndexType .SPFRESH
144+
145+
130146class _VectorIndexConfigFlatCreate (_VectorIndexConfigCreate ):
131147 vectorCacheMaxObjects : Optional [int ]
132148
@@ -149,6 +165,17 @@ def vector_index_type() -> VectorIndexType:
149165 return VectorIndexType .HNSW
150166
151167
168+ class _VectorIndexConfigSPFreshUpdate (_VectorIndexConfigUpdate ):
169+ maxPostingSize : Optional [int ]
170+ minPostingSize : Optional [int ]
171+ rngFactor : Optional [int ]
172+ searchProbe : Optional [int ]
173+
174+ @staticmethod
175+ def vector_index_type () -> VectorIndexType :
176+ return VectorIndexType .SPFRESH
177+
178+
152179class _VectorIndexConfigFlatUpdate (_VectorIndexConfigUpdate ):
153180 vectorCacheMaxObjects : Optional [int ]
154181
@@ -564,6 +591,36 @@ def hnsw(
564591 multivector = multi_vector ,
565592 )
566593
594+ @staticmethod
595+ def spfresh (
596+ distance_metric : Optional [VectorDistances ] = None ,
597+ max_posting_size : Optional [int ] = None ,
598+ min_posting_size : Optional [int ] = None ,
599+ replicas : Optional [int ] = None ,
600+ rng_factor : Optional [int ] = None ,
601+ search_probe : Optional [int ] = None ,
602+ centroids_index_type : Optional [str ] = None ,
603+ quantizer : Optional [_QuantizerConfigCreate ] = None ,
604+ ) -> _VectorIndexConfigSPFreshCreate :
605+ """Create a `_VectorIndexConfigSPFreshCreate` object to be used when defining the SPFresh vector index configuration of Weaviate.
606+
607+ Use this method when defining the `vector_index_config` argument in `collections.create()`.
608+
609+ Args:
610+ See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-spfresh) for a more detailed view!
611+ """
612+ return _VectorIndexConfigSPFreshCreate (
613+ distance = distance_metric ,
614+ maxPostingSize = max_posting_size ,
615+ minPostingSize = min_posting_size ,
616+ replicas = replicas ,
617+ rngFactor = rng_factor ,
618+ searchProbe = search_probe ,
619+ centroidsIndexType = centroids_index_type ,
620+ quantizer = quantizer ,
621+ multivector = None ,
622+ )
623+
567624 @staticmethod
568625 def flat (
569626 distance_metric : Optional [VectorDistances ] = None ,
0 commit comments