From eb1ebbb7a6fcb65ef0be9b1e1802e391f3da11e4 Mon Sep 17 00:00:00 2001 From: zahid-syed Date: Wed, 20 Mar 2024 10:34:08 -0400 Subject: [PATCH] fixed coverage for local index --- tests/unit/test_layer.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/unit/test_layer.py b/tests/unit/test_layer.py index 4a55777b..a54891f3 100644 --- a/tests/unit/test_layer.py +++ b/tests/unit/test_layer.py @@ -8,6 +8,7 @@ from semantic_router.layer import LayerConfig, RouteLayer from semantic_router.llms.base import BaseLLM from semantic_router.route import Route +from semantic_router.index.pinecone import PineconeIndex def mock_encoder_call(utterances): @@ -214,6 +215,16 @@ def test_query_and_classification(self, openai_encoder, routes): route_layer = RouteLayer(encoder=openai_encoder, routes=routes) query_result = route_layer(text="Hello").name assert query_result in ["Route 1", "Route 2"] + + def test_query_filter(self, openai_encoder, routes): + route_layer = RouteLayer(encoder=openai_encoder, routes=routes) + query_result = route_layer(text="Hello", route_filter=["Route 1"]).name + assert query_result in ["Route 1"] + + # def test_query_filter_openai_index(self, openai_encoder, routes): + # route_layer = RouteLayer(encoder=openai_encoder, routes=routes, index=PineconeIndex) + # query_result = route_layer(text="Hello", route_filter=["Route 1"]).name + # assert query_result in ["Route 1"] def test_query_with_no_index(self, openai_encoder): route_layer = RouteLayer(encoder=openai_encoder)