@@ -117,6 +117,7 @@ def __init__(
117117 text_scorer score.
118118
119119 Raises:
120+ ImportError: If redis-py>=7.1.0 is not installed.
120121 TypeError: If the stopwords are not a set, list, or tuple of strings.
121122 ValueError: If the text string is empty, or if the text string becomes empty after
122123 stopwords are removed.
@@ -129,7 +130,7 @@ def __init__(
129130 CombineResultsMethod ,
130131 HybridPostProcessingConfig ,
131132 )
132- except ImportError :
133+ except ( ImportError , ModuleNotFoundError ) :
133134 raise ImportError (_IMPORT_ERROR_MESSAGE )
134135
135136 self .postprocessing_config = HybridPostProcessingConfig ()
@@ -218,6 +219,7 @@ def build_base_query(
218219 If LINEAR combination method is used, then at least one of `linear_alpha` or `linear_beta` must be provided.
219220
220221 Raises:
222+ ImportError: If redis-py>=7.1.0 is not installed.
221223 ValueError: If `vector_search_method` is defined and isn't one of {KNN, RANGE}.
222224 ValueError: If `vector_search_method` is "KNN" and `knn_k` is not provided.
223225 ValueError: If `vector_search_method` is "RANGE" and `range_radius` is not provided.
@@ -232,7 +234,7 @@ def build_base_query(
232234 HybridVsimQuery ,
233235 VectorSearchMethods ,
234236 )
235- except ImportError :
237+ except ( ImportError , ModuleNotFoundError ) :
236238 raise ImportError (_IMPORT_ERROR_MESSAGE )
237239
238240 # Serialize the full-text search query
@@ -316,6 +318,7 @@ def build_combination_method(
316318 yield_score_as: The name of the field to yield the combined score as.
317319
318320 Raises:
321+ ImportError: If redis-py>=7.1.0 is not installed.
319322 ValueError: If `combination_method` is defined and isn't one of {RRF, LINEAR}.
320323 ValueError: If `combination_method` is "RRF" and neither `rrf_window` nor `rrf_constant` is provided.
321324 ValueError: If `combination_method` is "LINEAR" and neither `linear_alpha` nor `linear_beta` is provided.
@@ -328,7 +331,7 @@ def build_combination_method(
328331 CombinationMethods ,
329332 CombineResultsMethod ,
330333 )
331- except ImportError :
334+ except ( ImportError , ModuleNotFoundError ) :
332335 raise ImportError (_IMPORT_ERROR_MESSAGE )
333336
334337 method_params : Dict [str , Any ] = {}
0 commit comments