Skip to content

Commit be6b347

Browse files
author
Nitin Kanukolanu
committed
Add migration and integration test scripts
1 parent 0db95db commit be6b347

File tree

4 files changed

+984
-1
lines changed

4 files changed

+984
-1
lines changed

redisvl/redis/connection.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,57 @@ def parse_vector_attrs(attrs):
318318
# Default to float32 if missing
319319
normalized["datatype"] = "float32"
320320

321+
# Handle SVS-VAMANA specific parameters
322+
# Compression - Redis uses different internal names, so we need to map them
323+
if "compression" in vector_attrs:
324+
compression_value = vector_attrs["compression"]
325+
# Map Redis internal names to our enum values
326+
compression_mapping = {
327+
"GlobalSQ8": "LVQ4x4", # Default mapping
328+
"GlobalSQ4": "LVQ4",
329+
# Add more mappings as we discover them
330+
}
331+
# Try to map, otherwise use the value as-is
332+
normalized["compression"] = compression_mapping.get(
333+
compression_value, compression_value
334+
)
335+
336+
# Dimensionality reduction (reduce parameter)
337+
if "reduce" in vector_attrs:
338+
try:
339+
normalized["reduce"] = int(vector_attrs["reduce"])
340+
except (ValueError, TypeError):
341+
pass
342+
343+
# Graph parameters
344+
if "graph_max_degree" in vector_attrs:
345+
try:
346+
normalized["graph_max_degree"] = int(vector_attrs["graph_max_degree"])
347+
except (ValueError, TypeError):
348+
pass
349+
350+
if "construction_window_size" in vector_attrs:
351+
try:
352+
normalized["construction_window_size"] = int(
353+
vector_attrs["construction_window_size"]
354+
)
355+
except (ValueError, TypeError):
356+
pass
357+
358+
if "search_window_size" in vector_attrs:
359+
try:
360+
normalized["search_window_size"] = int(
361+
vector_attrs["search_window_size"]
362+
)
363+
except (ValueError, TypeError):
364+
pass
365+
366+
if "epsilon" in vector_attrs:
367+
try:
368+
normalized["epsilon"] = float(vector_attrs["epsilon"])
369+
except (ValueError, TypeError):
370+
pass
371+
321372
# Validate that we have required dims
322373
if "dims" not in normalized:
323374
# Could not parse dims - this field is not properly supported

redisvl/utils/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from redisvl.utils.compression import CompressionAdvisor
2+
from redisvl.utils.migration import IndexMigrator
23

3-
__all__ = ["CompressionAdvisor"]
4+
__all__ = ["CompressionAdvisor", "IndexMigrator"]

0 commit comments

Comments
 (0)