(&self)
| 169 | } |
| 170 | |
| 171 | fn to_bytes(&self) -> Result<Vec<u8>, RerankError> { |
| 172 | let codec = self.codec.as_ref().ok_or_else(|| { |
| 173 | RerankError::NotTrained("pq sidecar serialize: codec not trained".to_string()) |
| 174 | })?; |
| 175 | codec |
| 176 | .to_bytes() |
| 177 | .map_err(|e| RerankError::BadInput(format!("pq to_bytes: {e}"))) |
| 178 | } |
| 179 | |
| 180 | /// Train PQ codebooks via k-means on a sample of vectors. |
| 181 | /// |