diff --git a/semantic_router/index/pinecone.py b/semantic_router/index/pinecone.py index 148c9070..31fbfac8 100644 --- a/semantic_router/index/pinecone.py +++ b/semantic_router/index/pinecone.py @@ -122,7 +122,7 @@ def _init_index(self, force_create: bool = False) -> Union[Any, None]: time.sleep(0.5) elif index_exists: # if the index exists we just return it - index = self.client.Index(self.index_name, namespace=self.namespace) + index = self.client.Index(self.index_name) # grab the dimensions from the index self.dimensions = index.describe_index_stats()["dimension"] elif force_create and not dimensions_given: @@ -234,7 +234,7 @@ def get_routes(self) -> List[Tuple]: def delete(self, route_name: str): route_vec_ids = self._get_route_ids(route_name=route_name) if self.index is not None: - self.index.delete(ids=route_vec_ids) + self.index.delete(ids=route_vec_ids, namespace=self.namespace) else: raise ValueError("Index is None, could not delete.") diff --git a/tests/unit/test_layer.py b/tests/unit/test_layer.py index 1cee98ab..7607d37c 100644 --- a/tests/unit/test_layer.py +++ b/tests/unit/test_layer.py @@ -281,9 +281,7 @@ def test_query_filter_pinecone(self, openai_encoder, routes, index_cls): encoder=openai_encoder, routes=routes, index=pineconeindex ) time.sleep(5) # allow for index to be populated - print(routes) query_result = route_layer(text="Hello", route_filter=["Route 1"]).name - print(query_result) try: route_layer(text="Hello", route_filter=["Route 8"]).name