Skip to content

Commit df9722a

Browse files
authored
Merge pull request #665 from aurelio-labs/james/version-updates
fix: version updates
2 parents 5fe64a5 + eca52e6 commit df9722a

5 files changed

Lines changed: 1169 additions & 257 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "semantic-router"
3-
version = "0.1.14"
3+
version = "0.1.15"
44
description = "Super fast semantic router for AI decision making"
55
authors = [{ name = "Aurelio AI", email = "hello@aurelio.ai" }]
66
requires-python = ">=3.9,<3.14"
@@ -18,7 +18,8 @@ dependencies = [
1818
"aiohttp>=3.10.11,<4",
1919
"tornado>=6.4.2,<7",
2020
"urllib3>=1.26,<3",
21-
"litellm>=1.61.3",
21+
# https://www.cve.org/CVERecord?id=CVE-2026-42208 explains >=1.83.7
22+
"litellm>=1.83.7",
2223
"openai>=1.10.0,<3.0.0",
2324
]
2425

@@ -38,7 +39,7 @@ vision = [
3839
"pillow>=10.2.0,<11.0.0 ; python_version < '3.13'",
3940
"torch>=2.6.0 ; python_version < '3.13'"
4041
]
41-
mistralai = ["mistralai>=0.0.12,<0.1.0"]
42+
mistralai = ["mistralai>=1.0.0,<2.0.0"]
4243
qdrant = ["qdrant-client>=1.11.1,<2"]
4344
google = ["google-cloud-aiplatform>=1.45.0,<2"]
4445
bedrock = [

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: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class MistralAILLM(BaseLLM):
1313
"""LLM for MistralAI. Requires a MistralAI API key from https://console.mistral.ai/api-keys/"""
1414

1515
_client: Any = PrivateAttr()
16-
_mistralai: Any = PrivateAttr()
1716

1817
def __init__(
1918
self,
@@ -36,7 +35,7 @@ def __init__(
3635
if name is None:
3736
name = EncoderDefault.MISTRAL.value["language_model"]
3837
super().__init__(name=name)
39-
self._client, self._mistralai = self._initialize_client(mistralai_api_key)
38+
self._client = self._initialize_client(mistralai_api_key)
4039
self.temperature = temperature
4140
self.max_tokens = max_tokens
4241

@@ -46,11 +45,10 @@ def _initialize_client(self, api_key):
4645
:param api_key: The MistralAI API key.
4746
:type api_key: Optional[str]
4847
:return: The MistralAI client.
49-
:rtype: MistralClient
48+
:rtype: Mistral
5049
"""
5150
try:
52-
import mistralai
53-
from mistralai.client import MistralClient
51+
from mistralai import Mistral
5452
except ImportError:
5553
raise ImportError(
5654
"Please install MistralAI to use MistralAI LLM. "
@@ -61,12 +59,12 @@ def _initialize_client(self, api_key):
6159
if api_key is None:
6260
raise ValueError("MistralAI API key cannot be 'None'.")
6361
try:
64-
client = MistralClient(api_key=api_key)
62+
client = Mistral(api_key=api_key)
6563
except Exception as e:
6664
raise ValueError(
6765
f"MistralAI API client failed to initialize. Error: {e}"
6866
) from e
69-
return client, mistralai
67+
return client
7068

7169
def __call__(self, messages: List[Message]) -> str:
7270
"""Call the MistralAILLM.
@@ -78,14 +76,9 @@ def __call__(self, messages: List[Message]) -> str:
7876
"""
7977
if self._client is None:
8078
raise ValueError("MistralAI client is not initialized.")
81-
chat_messages = [
82-
self._mistralai.models.chat_completion.ChatMessage(
83-
role=m.role, content=m.content
84-
)
85-
for m in messages
86-
]
79+
chat_messages = [{"role": m.role, "content": m.content} for m in messages]
8780
try:
88-
completion = self._client.chat(
81+
completion = self._client.chat.complete(
8982
model=self.name,
9083
messages=chat_messages,
9184
temperature=self.temperature,

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)