Commit fdee74a
committed
perf: remove proactive module validation to reduce network calls (#370)
Remove MODULE LIST calls during connection initialization and index
creation. Operations now fail naturally when Redis modules are missing,
providing clear error messages at the point of failure.
Changes:
- Remove validate_modules() function and DEFAULT_REQUIRED_MODULES constant
- Remove required_modules parameter from all connection methods
- Remove proactive validation from SearchIndex and AsyncSearchIndex
- Remove validation from SemanticRouter.from_existing()
- Fix SemanticCache to use lazy client initialization
- Remove skip_if_module_version_error test helper
- Remove unused RedisModuleVersionError exception
- Add RediSearch module availability checks to skip tests when module not present
- Fix mocking strategy to patch instance methods instead of class methods
- Handle different Redis versions (6.2.6-v9, latest, 8.0.2) in CI environment
- Ensure tests work with both testcontainers (local) and provided Redis (CI)
- Ensures compatibility across different Redis Stack versions
- Support Redis 6.2.6-v9 returns 'dims' while other versions may return 'dim'.
- Handle multiple field name variations for vector attributes
- Support 'distance_metric' and 'metric' field names
- Support 'data_type', 'type', and 'datatype' field variations
- Safely handle missing or renamed fields across Redis versions
- Provide default 'algorithm' field (flat) when missing
- Provide default 'distance_metric' field (cosine) when missing
- Prevents Pydantic validation errors with older Redis versions
- Improved error handling in parse_vector_attrs function
- Safer attribute parsing with proper bounds checking
- Always provide defaults for all required fields (algorithm, distance_metric, datatype)
- Handle malformed or incomplete attribute lists from older Redis versions
- Scan entire attribute list if standard parsing doesn't find required fields
- Handle attributes appearing at non-standard positions in the list
- More flexible detection of dim/dims fields
- Ensures compatibility when Redis returns attributes in unexpected order
Redis 6.2.6-v9 may return vector attributes at different positions
in the FT.INFO output. This change ensures we find them regardless
of their position in the attribute list.1 parent b32ed95 commit fdee74a
File tree
13 files changed
+585
-254
lines changed- redisvl
- extensions
- cache/llm
- router
- index
- redis
- tests
- integration
13 files changed
+585
-254
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 14 | | |
21 | 15 | | |
22 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
118 | 117 | | |
119 | 118 | | |
120 | 119 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
132 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
133 | 128 | | |
134 | 129 | | |
135 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
| |||
439 | 438 | | |
440 | 439 | | |
441 | 440 | | |
442 | | - | |
443 | 441 | | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
458 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
459 | 450 | | |
460 | 451 | | |
461 | 452 | | |
| |||
481 | 472 | | |
482 | 473 | | |
483 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
484 | 479 | | |
485 | 480 | | |
486 | | - | |
| 481 | + | |
487 | 482 | | |
488 | | - | |
| 483 | + | |
| 484 | + | |
489 | 485 | | |
490 | 486 | | |
491 | 487 | | |
| |||
1193 | 1189 | | |
1194 | 1190 | | |
1195 | 1191 | | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
1211 | 1200 | | |
1212 | 1201 | | |
1213 | 1202 | | |
| |||
1256 | 1245 | | |
1257 | 1246 | | |
1258 | 1247 | | |
1259 | | - | |
| 1248 | + | |
| 1249 | + | |
1260 | 1250 | | |
1261 | 1251 | | |
| 1252 | + | |
| 1253 | + | |
1262 | 1254 | | |
1263 | 1255 | | |
1264 | 1256 | | |
1265 | | - | |
| 1257 | + | |
| 1258 | + | |
1266 | 1259 | | |
1267 | 1260 | | |
1268 | 1261 | | |
| |||
0 commit comments