Skip to content
Snippets Groups Projects
Commit 19d54ee6 authored by Ismail Ashraq's avatar Ismail Ashraq
Browse files

update mistral tests

parent bbf717aa
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ class TestMistralEncoder: ...@@ -28,6 +28,7 @@ class TestMistralEncoder:
def test_mistralai_encoder_init_success(self, mocker): def test_mistralai_encoder_init_success(self, mocker):
encoder = MistralEncoder(mistralai_api_key="test_api_key") encoder = MistralEncoder(mistralai_api_key="test_api_key")
assert encoder._client is not None assert encoder._client is not None
assert encoder._mistralai is not None
def test_mistralai_encoder_init_no_api_key(self, mocker): def test_mistralai_encoder_init_no_api_key(self, mocker):
mocker.patch("os.getenv", return_value=None) mocker.patch("os.getenv", return_value=None)
......
...@@ -3,6 +3,8 @@ import pytest ...@@ -3,6 +3,8 @@ import pytest
from semantic_router.llms import MistralAILLM from semantic_router.llms import MistralAILLM
from semantic_router.schema import Message from semantic_router.schema import Message
from unittest.mock import patch
@pytest.fixture @pytest.fixture
def mistralai_llm(mocker): def mistralai_llm(mocker):
...@@ -11,16 +13,16 @@ def mistralai_llm(mocker): ...@@ -11,16 +13,16 @@ def mistralai_llm(mocker):
class TestMistralAILLM: class TestMistralAILLM:
# def test_mistral_llm_import_errors(self): def test_mistral_llm_import_errors(self):
# with patch.dict("sys.modules", {"mistralai": None}): with patch.dict("sys.modules", {"mistralai": None}):
# with pytest.raises(ImportError) as error: with pytest.raises(ImportError) as error:
# MistralAILLM() MistralAILLM()
# assert ( assert (
# "Please install MistralAI to use MistralAI LLM. " "Please install MistralAI to use MistralAI LLM. "
# "You can install it with: " "You can install it with: "
# "`pip install 'semantic-router[mistralai]'`" in str(error.value) "`pip install 'semantic-router[mistralai]'`" in str(error.value)
# ) )
def test_mistralai_llm_init_with_api_key(self, mistralai_llm): def test_mistralai_llm_init_with_api_key(self, mistralai_llm):
assert mistralai_llm._client is not None, "Client should be initialized" assert mistralai_llm._client is not None, "Client should be initialized"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment