Skip to content

Commit a21bb4e

Browse files
author
Nitin Kanukolanu
committed
Add more validation after testing for lvq (no compression with lvg4)
1 parent ddf2e46 commit a21bb4e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

redisvl/schema/fields.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,26 @@ def validate_svs_params(self):
220220
f"Unsupported types: BFLOAT16, FLOAT64, INT8, UINT8."
221221
)
222222

223-
# Reduce validation: must be less than dims
223+
# Reduce validation: must be less than dims and only valid with LeanVec
224224
if self.reduce is not None:
225225
if self.reduce >= self.dims:
226226
raise ValueError(
227227
f"reduce ({self.reduce}) must be less than dims ({self.dims})"
228228
)
229-
# Phase C: Add warning for reduce without LeanVec
230-
# if not self.compression or not self.compression.value.startswith("LeanVec"):
231-
# logger.warning(
232-
# "reduce parameter is recommended with LeanVec compression"
233-
# )
229+
230+
# Validate that reduce is only used with LeanVec compression
231+
if self.compression is None:
232+
raise ValueError(
233+
"reduce parameter requires compression to be set. "
234+
"Use LeanVec4x8 or LeanVec8x8 compression with reduce."
235+
)
236+
237+
if not self.compression.value.startswith("LeanVec"):
238+
raise ValueError(
239+
f"reduce parameter is only supported with LeanVec compression types. "
240+
f"Got compression={self.compression.value}. "
241+
f"Either use LeanVec4x8/LeanVec8x8 or remove the reduce parameter."
242+
)
234243

235244
# Phase C: Add warning for LeanVec without reduce
236245
# if self.compression and self.compression.value.startswith("LeanVec") and not self.reduce:

0 commit comments

Comments
 (0)