From d46db0a1b45b3f56e4fbb1f788f70d68482d1533 Mon Sep 17 00:00:00 2001 From: jjovalle99 Date: Mon, 6 Apr 2026 18:27:56 +0100 Subject: [PATCH] fix(tools): use correct import path for mistralai SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mistralai v2.x is a namespace package — `Mistral` class lives at `mistralai.client`, not at the top-level `mistralai` module. The previous `from mistralai import Mistral` raises ImportError at runtime. Update both production code and test fixture to use the correct path. --- tests/tools/test_transcription_tools.py | 2 +- tools/transcription_tools.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_transcription_tools.py b/tests/tools/test_transcription_tools.py index 9f5fab6294..f781c32bd4 100644 --- a/tests/tools/test_transcription_tools.py +++ b/tests/tools/test_transcription_tools.py @@ -875,7 +875,7 @@ def mock_mistral_module(): mock_mistral_cls = MagicMock(return_value=mock_client) fake_module = MagicMock() fake_module.Mistral = mock_mistral_cls - with patch.dict("sys.modules", {"mistralai": fake_module}): + with patch.dict("sys.modules", {"mistralai": fake_module, "mistralai.client": fake_module}): yield mock_client diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py index 296c74a21b..d4f9145c2d 100644 --- a/tools/transcription_tools.py +++ b/tools/transcription_tools.py @@ -546,7 +546,7 @@ def _transcribe_mistral(file_path: str, model_name: str) -> Dict[str, Any]: return {"success": False, "transcript": "", "error": "MISTRAL_API_KEY not set"} try: - from mistralai import Mistral + from mistralai.client import Mistral with Mistral(api_key=api_key) as client: with open(file_path, "rb") as audio_file: