Skip to content

Commit eca52e6

Browse files
committed
fix: mistral tests
1 parent 6792d59 commit eca52e6

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

semantic_router/index/qdrant.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,13 @@ def _build_filter(self, base_filter: Optional[Any] = None) -> Optional[Any]:
211211

212212
return models.Filter(must=[ns_condition, base_filter])
213213

214-
def _point_ids_for_utterances(self, routes_to_delete: dict) -> list[str]:
214+
def _point_ids_for_utterances(self, routes_to_delete: dict) -> list[str | int]:
215215
"""Compute deterministic point IDs for the given route→utterance mapping.
216216
217217
Uses the same uuid5 scheme as ``add()`` so IDs are derived without
218218
a round-trip to Qdrant.
219219
"""
220-
ids = []
220+
ids: list[str | int] = []
221221
for route, utterances in routes_to_delete.items():
222222
for utterance in utterances:
223223
key = (

semantic_router/llms/mistral.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ def __call__(self, messages: List[Message]) -> str:
7676
"""
7777
if self._client is None:
7878
raise ValueError("MistralAI client is not initialized.")
79-
chat_messages = [
80-
{"role": m.role, "content": m.content} for m in messages
81-
]
79+
chat_messages = [{"role": m.role, "content": m.content} for m in messages]
8280
try:
8381
completion = self._client.chat.complete(
8482
model=self.name,

tests/unit/llms/test_llm_mistral.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
@pytest.fixture
1010
def mistralai_llm(mocker):
11-
mocker.patch("mistralai.client.MistralClient")
11+
mocker.patch("mistralai.Mistral")
1212
return MistralAILLM(mistralai_api_key="test_api_key")
1313

1414

@@ -48,7 +48,7 @@ def test_mistralai_llm_call_uninitialized_client(self, mistralai_llm):
4848

4949
def test_mistralai_llm_init_exception(self, mocker):
5050
mocker.patch(
51-
"mistralai.client.MistralClient",
51+
"mistralai.Mistral",
5252
side_effect=Exception("Initialization error"),
5353
)
5454
with pytest.raises(ValueError) as e:
@@ -61,8 +61,8 @@ def test_mistralai_llm_call_success(self, mistralai_llm, mocker):
6161

6262
mocker.patch("os.getenv", return_value="fake-api-key")
6363
mocker.patch.object(
64-
mistralai_llm._client,
65-
"chat",
64+
mistralai_llm._client.chat,
65+
"complete",
6666
return_value=mock_completion,
6767
)
6868
llm_input = [Message(role="user", content="test")]

0 commit comments

Comments
 (0)