@@ -55,6 +55,8 @@ static std::string quantize_type_to_string(const QuantizeType type) {
5555 return " UNDEFINED" ;
5656 case QuantizeType::INT8:
5757 return " INT8" ;
58+ case QuantizeType::RABITQ:
59+ return " RABITQ" ;
5860 case QuantizeType::INT4:
5961 return " INT4" ;
6062 case QuantizeType::FP16:
@@ -376,6 +378,43 @@ encapsulates its construction hyperparameters.
376378 t[3 ].cast <QuantizeType>());
377379 }));
378380
381+ // binding hnsw rabitq index params
382+ py::class_<HNSWRabitqIndexParams, VectorIndexParams,
383+ std::shared_ptr<HNSWRabitqIndexParams>>
384+ hnsw_rabitq_params (m, " HnswRabitqIndexParam" , R"pbdoc(
385+ Parameters for configuring an HNSW (Hierarchical Navigable Small World) index with RabitQ.
386+ HNSW is a graph-based approximate nearest neighbor search index. This class
387+ encapsulates its construction hyperparameters.
388+ Attributes:
389+ metric_type (MetricType): Distance metric used for similarity computation.
390+ Default is ``MetricType.IP`` (inner product).
391+ m (int): Number of bi-directional links created for every new element
392+ during construction. Higher values improve accuracy but increase
393+ memory usage and construction time. Default is 100.
394+ ef_construction (int): Size of the dynamic candidate list for nearest
395+ neighbors during index construction. Larger values yield better
396+ graph quality at the cost of slower build time. Default is 500.
397+ quantize_type (QuantizeType): Optional quantization type for vector
398+ compression (e.g., FP16, INT8). Default is `QuantizeType.UNDEFINED` to
399+ disable quantization.
400+ Examples:
401+ >>> from zvec.typing import MetricType, QuantizeType
402+ >>> params = HnswRabitqIndexParam(
403+ ... metric_type=MetricType.COSINE,
404+ ... m=16,
405+ ... ef_construction=200,
406+ ... quantize_type=QuantizeType.INT8
407+ ... )
408+ >>> print(params)
409+ {'metric_type': 'IP', 'm': 16, 'ef_construction': 200, 'quantize_type': 'INT8'}
410+ )pbdoc" );
411+ hnsw_rabitq_params.def (
412+ py::init<MetricType, int , int , QuantizeType>(),
413+ py::arg (" metric_type" ) = MetricType::IP,
414+ py::arg (" m" ) = core_interface::kDefaultHnswNeighborCnt ,
415+ py::arg (" ef_construction" ) = core_interface::kDefaultHnswEfConstruction ,
416+ py::arg (" quantize_type" ) = QuantizeType::UNDEFINED);
417+
379418 // FlatIndexParams
380419 py::class_<FlatIndexParams, VectorIndexParams,
381420 std::shared_ptr<FlatIndexParams>>
0 commit comments