Skip to content

Commit 38fe7ea

Browse files
committed
sneaky from_existing test
1 parent 537fc9c commit 38fe7ea

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

redisvl/extensions/router/semantic.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ def __init__(
101101
routes=routes,
102102
vectorizer=vectorizer,
103103
routing_config=routing_config,
104+
redis_url=redis_url,
105+
redis_client=redis_client,
104106
)
105107

106108
self._initialize_index(redis_client, redis_url, overwrite, **connection_kwargs)
@@ -130,7 +132,9 @@ def from_existing(
130132
)
131133

132134
router_dict = redis_client.json().get(f"{name}:route_config") # type: ignore
133-
return cls.from_dict(router_dict)
135+
return cls.from_dict(
136+
router_dict, redis_url=redis_url, redis_client=redis_client
137+
)
134138

135139
@deprecated_argument("dtype")
136140
def _initialize_index(

tests/integration/test_threshold_optimizer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_routes_different_distance_thresholds_optimizer_default(
113113

114114
# now run optimizer
115115
router_optimizer = RouterThresholdOptimizer(router, test_data_optimization)
116-
router_optimizer.optimize(max_iterations=10, search_step=0.5)
116+
router_optimizer.optimize(max_iterations=20, search_step=0.5)
117117

118118
# test that it updated thresholds beyond the null case
119119
for route in routes:
@@ -150,7 +150,7 @@ def test_routes_different_distance_thresholds_optimizer_precision(
150150
router_optimizer = RouterThresholdOptimizer(
151151
router, test_data_optimization, eval_metric="precision"
152152
)
153-
router_optimizer.optimize(max_iterations=10, search_step=0.5)
153+
router_optimizer.optimize(max_iterations=20, search_step=0.5)
154154

155155
# test that it updated thresholds beyond the null case
156156
for route in routes:
@@ -186,7 +186,7 @@ def test_routes_different_distance_thresholds_optimizer_recall(
186186
router_optimizer = RouterThresholdOptimizer(
187187
router, test_data_optimization, eval_metric="recall"
188188
)
189-
router_optimizer.optimize(max_iterations=10, search_step=0.5)
189+
router_optimizer.optimize(max_iterations=20, search_step=0.5)
190190

191191
# test that it updated thresholds beyond the null case
192192
for route in routes:

0 commit comments

Comments
 (0)