Skip to content

Commit 2d17953

Browse files
committed
chore: lint
1 parent 50a912a commit 2d17953

7 files changed

Lines changed: 2743 additions & 2721 deletions

File tree

bedrock.ipynb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,11 @@
170170
" region_name=aws_region,\n",
171171
" aws_access_key_id=aws_access_key_id,\n",
172172
" aws_secret_access_key=aws_secret_access_key,\n",
173-
" aws_session_token=aws_session_token\n",
173+
" aws_session_token=aws_session_token,\n",
174174
")\n",
175175
"\n",
176176
"\n",
177-
"encoder = BedrockEncoder(\n",
178-
"\tname=\"amazon.titan-embed-image-v1\",\n",
179-
"\tclient=boto3_client\n",
180-
")"
177+
"encoder = BedrockEncoder(name=\"amazon.titan-embed-image-v1\", client=boto3_client)"
181178
]
182179
},
183180
{

docs/07-multi-modal.ipynb

Lines changed: 2709 additions & 2709 deletions
Large diffs are not rendered by default.

semantic_router/encoders/bedrock.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ def __init__(
105105
if client:
106106
self.client = client
107107
else:
108-
self.access_key_id = self.get_env_variable("AWS_ACCESS_KEY_ID", access_key_id)
108+
self.access_key_id = self.get_env_variable(
109+
"AWS_ACCESS_KEY_ID", access_key_id
110+
)
109111
self.secret_access_key = self.get_env_variable(
110112
"AWS_SECRET_ACCESS_KEY", secret_access_key
111113
)
112-
self.session_token = self.get_env_variable("AWS_SESSION_TOKEN", session_token)
114+
self.session_token = self.get_env_variable(
115+
"AWS_SESSION_TOKEN", session_token
116+
)
113117
self.region = self.get_env_variable(
114118
"AWS_DEFAULT_REGION", region, default="us-west-1"
115119
)
@@ -121,7 +125,9 @@ def __init__(
121125
self.region,
122126
)
123127
except Exception as e:
124-
raise ValueError(f"Bedrock client failed to initialise. Error: {e}") from e
128+
raise ValueError(
129+
f"Bedrock client failed to initialise. Error: {e}"
130+
) from e
125131

126132
def _initialize_client(
127133
self, access_key_id, secret_access_key, session_token, region

semantic_router/index/pinecone.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import hashlib
33
import json
44
import os
5-
import re
65
from typing import Any, Dict, List, Optional, Tuple, Union
76

87
import aiohttp
@@ -290,7 +289,11 @@ def _initialize_client(self, api_key: Optional[str] = None):
290289
try:
291290
import importlib
292291

293-
importlib.import_module(_mod_name).check_realistic_host = _noop
292+
setattr(
293+
importlib.import_module(_mod_name),
294+
"check_realistic_host",
295+
_noop,
296+
)
294297
except (ImportError, AttributeError):
295298
pass
296299
pinecone_args = {

semantic_router/index/qdrant.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@ def add(
249249

250250
# Deterministic UUIDs — namespace-prefixed when set to avoid cross-tenant collisions
251251
ids = [
252-
str(uuid.uuid5(uuid.NAMESPACE_DNS, f"{self.namespace}:{route}:{utterance}" if self.namespace is not None else f"{route}:{utterance}"))
252+
str(
253+
uuid.uuid5(
254+
uuid.NAMESPACE_DNS,
255+
f"{self.namespace}:{route}:{utterance}"
256+
if self.namespace is not None
257+
else f"{route}:{utterance}",
258+
)
259+
)
253260
for route, utterance in zip(routes, utterances)
254261
]
255262

@@ -736,7 +743,14 @@ async def aadd(
736743
for route, utterance, metadata in zip(routes, utterances, metadata_list)
737744
]
738745
ids = [
739-
str(uuid.uuid5(uuid.NAMESPACE_DNS, f"{self.namespace}:{route}:{utterance}" if self.namespace is not None else f"{route}:{utterance}"))
746+
str(
747+
uuid.uuid5(
748+
uuid.NAMESPACE_DNS,
749+
f"{self.namespace}:{route}:{utterance}"
750+
if self.namespace is not None
751+
else f"{route}:{utterance}",
752+
)
753+
)
740754
for route, utterance in zip(routes, utterances)
741755
]
742756
# AsyncQdrantClient.upload_collection is not a coroutine; use batched upsert instead.

semantic_router/route.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
# TODO: remove this - triggering CI tests
1313

14+
1415
def is_valid(route_config: str) -> bool:
1516
"""Check if the route config is valid.
1617

tests/unit/test_qdrant_index.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Unit tests for QdrantIndex — uses in-memory Qdrant, no server needed."""
2+
23
import uuid
34

45
import numpy as np

0 commit comments

Comments
 (0)