Add pyo3 signature annotations with default values for all Py* structs (#7891)

* Add pyo3 signature annotations with default values for all Py* structs

- Added #[pyo3(signature = (...))] attributes to all Py* structs with optional parameters
- Ensured non-default parameters come before parameters with defaults
- Follows the pattern established in PyScrollRequest
- Updated structs: PySearchRequest, PySearchParams, PyQuantizationSearchParams,
  PyAcornSearchParams, PyQueryRequest, PyPrefetch, PyOrderBy, PyMmr, PyPoint,
  PyFormula, PyShard::load, PySparseVectorDataConfig, PySparseIndexConfig

* fix params ordering
This commit is contained in:
Andrey Vasnetsov
2026-01-12 22:55:17 +01:00
committed by generall
parent 93d866f18c
commit 8cdc8dea94
8 changed files with 74 additions and 38 deletions

View File

@@ -36,6 +36,7 @@ impl PySparseVectorDataConfig {
#[pymethods]
impl PySparseVectorDataConfig {
#[new]
#[pyo3(signature = (index, storage_type, modifier = None))]
pub fn new(
index: PySparseIndexConfig,
storage_type: PySparseVectorStorageType,
@@ -98,14 +99,15 @@ pub struct PySparseIndexConfig(SparseIndexConfig);
#[pymethods]
impl PySparseIndexConfig {
#[new]
#[pyo3(signature = (index_type, full_scan_threshold = None, datatype = None))]
pub fn new(
full_scan_threshold: Option<usize>,
index_type: PySparseIndexType,
full_scan_threshold: Option<usize>,
datatype: Option<PyVectorStorageDatatype>,
) -> Self {
Self(SparseIndexConfig {
full_scan_threshold,
index_type: SparseIndexType::from(index_type),
full_scan_threshold,
datatype: datatype.map(VectorStorageDatatype::from),
})
}