@@ -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
@@ -561,6 +588,36 @@ def hnsw(
561588 multivector = multi_vector ,
562589 )
563590
591+ @staticmethod
592+ def spfresh (
593+ distance_metric : Optional [VectorDistances ] = None ,
594+ max_posting_size : Optional [int ] = None ,
595+ min_posting_size : Optional [int ] = None ,
596+ replicas : Optional [int ] = None ,
597+ rng_factor : Optional [int ] = None ,
598+ search_probe : Optional [int ] = None ,
599+ centroids_index_type : Optional [str ] = None ,
600+ quantizer : Optional [_QuantizerConfigCreate ] = None ,
601+ ) -> _VectorIndexConfigSPFreshCreate :
602+ """Create a `_VectorIndexConfigSPFreshCreate` object to be used when defining the SPFresh vector index configuration of Weaviate.
603+
604+ Use this method when defining the `vector_index_config` argument in `collections.create()`.
605+
606+ Args:
607+ See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#how-to-configure-spfresh) for a more detailed view!
608+ """
609+ return _VectorIndexConfigSPFreshCreate (
610+ distance = distance_metric ,
611+ maxPostingSize = max_posting_size ,
612+ minPostingSize = min_posting_size ,
613+ replicas = replicas ,
614+ rngFactor = rng_factor ,
615+ searchProbe = search_probe ,
616+ centroidsIndexType = centroids_index_type ,
617+ quantizer = quantizer ,
618+ multivector = None ,
619+ )
620+
564621 @staticmethod
565622 def flat (
566623 distance_metric : Optional [VectorDistances ] = None ,
0 commit comments