From 0f0c9604c93dab93866717c61ba309c1d180dddf Mon Sep 17 00:00:00 2001 From: Brian Sam-Bodden Date: Tue, 26 Nov 2024 13:34:36 -0700 Subject: [PATCH 1/2] Add .vscode/settings.json to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a238288e..2e4991cb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ docs/_build/ .venv .env coverage.xml -dist/ \ No newline at end of file +dist/ +.vscode/settings.json From a301c737203765252c62403f9b71678fd08865fd Mon Sep 17 00:00:00 2001 From: Brian Sam-Bodden Date: Tue, 26 Nov 2024 13:35:02 -0700 Subject: [PATCH 2/2] Fix missing redis_url fixture in integration tests --- tests/integration/test_llmcache.py | 14 ++++++++++---- tests/integration/test_semantic_router.py | 11 +++++++++-- tests/integration/test_session_manager.py | 14 ++++++++++---- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/tests/integration/test_llmcache.py b/tests/integration/test_llmcache.py index c2b80e8a..de877554 100644 --- a/tests/integration/test_llmcache.py +++ b/tests/integration/test_llmcache.py @@ -868,13 +868,19 @@ def test_create_cache_with_different_vector_types(): pytest.skip("Not using a late enough version of Redis") -def test_bad_dtype_connecting_to_existing_cache(): +def test_bad_dtype_connecting_to_existing_cache(redis_url): try: - cache = SemanticCache(name="float64_cache", dtype="float64") - same_type = SemanticCache(name="float64_cache", dtype="float64") + cache = SemanticCache( + name="float64_cache", dtype="float64", redis_url=redis_url + ) + same_type = SemanticCache( + name="float64_cache", dtype="float64", redis_url=redis_url + ) # under the hood uses from_existing except RedisModuleVersionError: pytest.skip("Not using a late enough version of Redis") with pytest.raises(ValueError): - bad_type = SemanticCache(name="float64_cache", dtype="float16") + bad_type = SemanticCache( + name="float64_cache", dtype="float16", redis_url=redis_url + ) diff --git a/tests/integration/test_semantic_router.py b/tests/integration/test_semantic_router.py index 8c1f6cf8..521c4387 100644 --- a/tests/integration/test_semantic_router.py +++ b/tests/integration/test_semantic_router.py @@ -241,30 +241,34 @@ def test_bad_connection_info(routes): ) -def test_different_vector_dtypes(routes): +def test_different_vector_dtypes(redis_url, routes): try: bfloat_router = SemanticRouter( name="bfloat_router", routes=routes, dtype="bfloat16", + redis_url=redis_url, ) float16_router = SemanticRouter( name="float16_router", routes=routes, dtype="float16", + redis_url=redis_url, ) float32_router = SemanticRouter( name="float32_router", routes=routes, dtype="float32", + redis_url=redis_url, ) float64_router = SemanticRouter( name="float64_router", routes=routes, dtype="float64", + redis_url=redis_url, ) for router in [bfloat_router, float16_router, float32_router, float64_router]: @@ -273,18 +277,20 @@ def test_different_vector_dtypes(routes): pytest.skip("Not using a late enough version of Redis") -def test_bad_dtype_connecting_to_exiting_router(routes): +def test_bad_dtype_connecting_to_exiting_router(redis_url, routes): try: router = SemanticRouter( name="float64 router", routes=routes, dtype="float64", + redis_url=redis_url, ) same_type = SemanticRouter( name="float64 router", routes=routes, dtype="float64", + redis_url=redis_url, ) # under the hood uses from_existing except RedisModuleVersionError: @@ -295,4 +301,5 @@ def test_bad_dtype_connecting_to_exiting_router(routes): name="float64 router", routes=routes, dtype="float16", + redis_url=redis_url, ) diff --git a/tests/integration/test_session_manager.py b/tests/integration/test_session_manager.py index 54267c54..2083716e 100644 --- a/tests/integration/test_session_manager.py +++ b/tests/integration/test_session_manager.py @@ -563,13 +563,19 @@ def test_different_vector_dtypes(): pytest.skip("Not using a late enough version of Redis") -def test_bad_dtype_connecting_to_exiting_session(): +def test_bad_dtype_connecting_to_exiting_session(redis_url): try: - session = SemanticSessionManager(name="float64 session", dtype="float64") - same_type = SemanticSessionManager(name="float64 session", dtype="float64") + session = SemanticSessionManager( + name="float64 session", dtype="float64", redis_url=redis_url + ) + same_type = SemanticSessionManager( + name="float64 session", dtype="float64", redis_url=redis_url + ) # under the hood uses from_existing except RedisModuleVersionError: pytest.skip("Not using a late enough version of Redis") with pytest.raises(ValueError): - bad_type = SemanticSessionManager(name="float64 session", dtype="float16") + bad_type = SemanticSessionManager( + name="float64 session", dtype="float16", redis_url=redis_url + )