diff --git a/docs/indexes/postgres/postgres.ipynb b/docs/indexes/postgres/postgres.ipynb index f0f868d56877e69d2e54e0bb77c6fe2c80d97be2..86931eadd135319ed0014382ffbc8bea63dab0cc 100644 --- a/docs/indexes/postgres/postgres.ipynb +++ b/docs/indexes/postgres/postgres.ipynb @@ -97,9 +97,9 @@ "import os\n", "\n", "# Set Postgres connection string\n", - "os.environ[\"POSTGRES_CONNECTION_STRING\"] = (\n", - " \"postgresql://admin:root@localhost:5432/semantic_router\"\n", - ")\n", + "os.environ[\n", + " \"POSTGRES_CONNECTION_STRING\"\n", + "] = \"postgresql://admin:root@localhost:5432/semantic_router\"\n", "# Initialize the Postgres index\n", "postgres_index = PostgresIndex()" ] diff --git a/semantic_router/encoders/bedrock.py b/semantic_router/encoders/bedrock.py index 57779b4e2fcc7bbaae613657030235a1cd31bcd8..cdab5b937903b956ac265ba251d50235bffb1f98 100644 --- a/semantic_router/encoders/bedrock.py +++ b/semantic_router/encoders/bedrock.py @@ -198,7 +198,6 @@ class BedrockEncoder(DenseEncoder): embeddings = [] if self.name and "amazon" in self.name: for doc in docs: - embedding_body = {} if isinstance(doc, dict): diff --git a/semantic_router/index/pinecone.py b/semantic_router/index/pinecone.py index 96ce6788d087d99d7d82374a42f8656cccbc2415..723d8b5ffc50cefc1eb03930d25c741f63e20c7f 100644 --- a/semantic_router/index/pinecone.py +++ b/semantic_router/index/pinecone.py @@ -674,7 +674,6 @@ class PineconeIndex(BaseIndex): if self.base_url and "api.pinecone.io" in self.base_url: self.index.delete(ids=route_vec_ids, namespace=self.namespace) else: - response = requests.post( f"{self.index_host}/vectors/delete", json=DeleteRequest( diff --git a/semantic_router/routers/hybrid.py b/semantic_router/routers/hybrid.py index f3e9107c2db0cfb6c51d637ef3f68e23b36c2094..6bc202f511573c3dd4bfb3d89fbd7352b6366da6 100644 --- a/semantic_router/routers/hybrid.py +++ b/semantic_router/routers/hybrid.py @@ -101,9 +101,12 @@ class HybridRouter(BaseRouter): if isinstance(routes, Route): routes = [routes] # create embeddings for all routes - route_names, all_utterances, all_function_schemas, all_metadata = ( - self._extract_routes_details(routes, include_metadata=True) - ) + ( + route_names, + all_utterances, + all_function_schemas, + all_metadata, + ) = self._extract_routes_details(routes, include_metadata=True) # TODO: to merge, self._encode should probably output a special # TODO Embedding type that can be either dense or hybrid dense_emb, sparse_emb = self._encode(all_utterances) diff --git a/semantic_router/routers/semantic.py b/semantic_router/routers/semantic.py index 72b28388a5ca6911e6cf92137d29cd11b4ec1dcb..45e2aedd73de28cb5d4935bf74b503d6c24d05a4 100644 --- a/semantic_router/routers/semantic.py +++ b/semantic_router/routers/semantic.py @@ -73,9 +73,12 @@ class SemanticRouter(BaseRouter): if isinstance(routes, Route): routes = [routes] # create embeddings for all routes - route_names, all_utterances, all_function_schemas, all_metadata = ( - self._extract_routes_details(routes, include_metadata=True) - ) + ( + route_names, + all_utterances, + all_function_schemas, + all_metadata, + ) = self._extract_routes_details(routes, include_metadata=True) dense_emb = self._encode(all_utterances) self.index.add( embeddings=dense_emb.tolist(), diff --git a/tests/unit/test_router.py b/tests/unit/test_router.py index 4270fb6e8c76716188d9bdf5b90d1d82a0d59350..5f90be3d1662e95d13a6ae3e9bfd60663f6c0dea 100644 --- a/tests/unit/test_router.py +++ b/tests/unit/test_router.py @@ -81,7 +81,6 @@ def init_index( issues during testing. """ if index_cls is PineconeIndex: - if index_name: if not dimensions and "OpenAIEncoder" in index_name: dimensions = 1536 diff --git a/tests/unit/test_sync.py b/tests/unit/test_sync.py index b700cd9e49a189c71a5a087ff4bb4346f877265c..be99f282b2b839df9ff8e2614bdb384a2a1240bb 100644 --- a/tests/unit/test_sync.py +++ b/tests/unit/test_sync.py @@ -115,7 +115,6 @@ def init_index( issues during testing. """ if index_cls is PineconeIndex: - if index_name: if not dimensions and "OpenAIEncoder" in index_name: dimensions = 1536