Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion schemas/semantic_router.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-router-01JSHK4MJ79HH51PS6WEK6M9MF
name: test-router
routes:
- name: greeting
references:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_semantic_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def test_from_dict(semantic_router):

def test_to_yaml(semantic_router):
yaml_file = str(get_base_path().joinpath("../../schemas/semantic_router.yaml"))
semantic_router.name = "test-router"
semantic_router.to_yaml(yaml_file, overwrite=True)
assert pathlib.Path(yaml_file).exists()

Expand Down
22 changes: 13 additions & 9 deletions tests/integration/test_threshold_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
if sys.version_info.major == 3 and sys.version_info.minor < 10:
pytest.skip("Test requires Python 3.10 or higher", allow_module_level=True)

from redis import Redis

from redisvl.extensions.cache.llm import SemanticCache
from redisvl.extensions.router import Route, SemanticRouter
from redisvl.extensions.router.schema import RoutingConfig
Expand Down Expand Up @@ -35,13 +37,13 @@ def routes():


@pytest.fixture
def semantic_router(client, routes, hf_vectorizer):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test was failing in conftest before evening making it to check the db version

def semantic_router(redis_url, routes, hf_vectorizer):
router = SemanticRouter(
name="test-router",
routes=routes,
vectorizer=hf_vectorizer,
routing_config=RoutingConfig(max_k=2),
redis_client=client,
redis_url=redis_url,
overwrite=False,
)
yield router
Expand Down Expand Up @@ -87,9 +89,10 @@ def test_data_optimization():


def test_routes_different_distance_thresholds_optimizer_default(
semantic_router, routes, redis_url, test_data_optimization, hf_vectorizer
routes, redis_url, test_data_optimization, hf_vectorizer
):
redis_version = semantic_router._index.client.info()["redis_version"]
redis = Redis.from_url(redis_url)
redis_version = redis.info()["redis_version"]
if not compare_versions(redis_version, "7.0.0"):
pytest.skip("Not using a late enough version of Redis")

Expand Down Expand Up @@ -121,10 +124,10 @@ def test_routes_different_distance_thresholds_optimizer_default(


def test_routes_different_distance_thresholds_optimizer_precision(
semantic_router, routes, redis_url, test_data_optimization, hf_vectorizer
routes, redis_url, test_data_optimization, hf_vectorizer
):

redis_version = semantic_router._index.client.info()["redis_version"]
redis = Redis.from_url(redis_url)
redis_version = redis.info()["redis_version"]
if not compare_versions(redis_version, "7.0.0"):
pytest.skip("Not using a late enough version of Redis")

Expand Down Expand Up @@ -158,9 +161,10 @@ def test_routes_different_distance_thresholds_optimizer_precision(


def test_routes_different_distance_thresholds_optimizer_recall(
semantic_router, routes, redis_url, test_data_optimization, hf_vectorizer
routes, redis_url, test_data_optimization, hf_vectorizer, client
):
redis_version = semantic_router._index.client.info()["redis_version"]
redis = Redis.from_url(redis_url)
redis_version = redis.info()["redis_version"]
if not compare_versions(redis_version, "7.0.0"):
pytest.skip("Not using a late enough version of Redis")

Expand Down