Skip to content

Commit

Permalink
fixed coverage for local index
Browse files Browse the repository at this point in the history
  • Loading branch information
zahid-syed committed Mar 20, 2024
1 parent f517a55 commit eb1ebbb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/unit/test_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit eb1ebbb

Please sign in to comment.