Skip to content

Commit adab5d8

Browse files
committed
kill type safe warnings
1 parent 38fe7ea commit adab5d8

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

redisvl/utils/optimize/router.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def _generate_run_router(test_data: List[LabeledData], router: SemanticRouter) -
1818
run_dict[td.id] = {}
1919
route_match = router(td.query)
2020
if route_match and route_match.name == td.query_match:
21-
run_dict[td.id][td.query_match] = 1
21+
run_dict[td.id][td.query_match] = np.int64(1)
2222
else:
23-
run_dict[td.id][NULL_RESPONSE_KEY] = 1
23+
run_dict[td.id][NULL_RESPONSE_KEY] = np.int64(1)
2424

2525
return Run(run_dict)
2626

redisvl/utils/optimize/utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import List
22

3+
import numpy as np
34
from ranx import Qrels
45

56
from redisvl.utils.optimize.schema import LabeledData
@@ -13,10 +14,10 @@ def _format_qrels(test_data: List[LabeledData]) -> Qrels:
1314

1415
for td in test_data:
1516
if td.query_match:
16-
qrels_dict[td.id] = {td.query_match: 1}
17+
qrels_dict[td.id] = {td.query_match: np.int64(1)}
1718
else:
1819
# This is for capturing true negatives from test set
19-
qrels_dict[td.id] = {NULL_RESPONSE_KEY: 1}
20+
qrels_dict[td.id] = {NULL_RESPONSE_KEY: np.int64(1)}
2021

2122
return Qrels(qrels_dict)
2223

schemas/semantic_router.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test-router-01JSHERM5V4G94GN3W68XB45PK
1+
name: test-router-01JSHK4MJ79HH51PS6WEK6M9MF
22
routes:
33
- name: greeting
44
references:

tests/integration/test_semantic_router.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,10 @@ def test_add_delete_route_references(semantic_router):
475475
assert len(router_dict["routes"][1]["references"]) == 0
476476

477477

478-
def test_from_existing(redis_url, routes):
478+
def test_from_existing(client, redis_url, routes):
479+
if not compare_versions(client.info()["redis_version"], "7.0.0"):
480+
pytest.skip("Not using a late enough version of Redis")
481+
479482
# connect separately
480483
router = SemanticRouter(
481484
name=f"test-router-{str(ULID())}",

0 commit comments

Comments
 (0)