mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-07 15:18:29 +00:00
Some checks failed
Notify Downstream / notify-downstream (push) Has been cancelled
* Fix issue #2421: Handle missing google.genai dependency gracefully Co-Authored-By: Joe Moura <joao@crewai.com> * Fix import sorting in test file Co-Authored-By: Joe Moura <joao@crewai.com> * Fix import sorting with ruff Co-Authored-By: Joe Moura <joao@crewai.com> * Removed unwatned test case * Added dynamic catching for all the embedder function * Dropped the comment * Added test case * Fixed Linting Issue * Flaky test case in 3.13 * Test Case fixed --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Joe Moura <joao@crewai.com> Co-authored-by: Lucas Gomide <lucaslg200@gmail.com>
26 lines
761 B
Python
26 lines
761 B
Python
from unittest.mock import patch
|
|
|
|
import pytest
|
|
|
|
from crewai.rag.embeddings.configurator import EmbeddingConfigurator
|
|
|
|
|
|
def test_configure_embedder_importerror():
|
|
configurator = EmbeddingConfigurator()
|
|
|
|
embedder_config = {
|
|
'provider': 'openai',
|
|
'config': {
|
|
'model': 'text-embedding-ada-002',
|
|
}
|
|
}
|
|
|
|
with patch('chromadb.utils.embedding_functions.openai_embedding_function.OpenAIEmbeddingFunction') as mock_openai:
|
|
mock_openai.side_effect = ImportError("Module not found.")
|
|
|
|
with pytest.raises(ImportError) as exc_info:
|
|
configurator.configure_embedder(embedder_config)
|
|
|
|
assert str(exc_info.value) == "Module not found."
|
|
mock_openai.assert_called_once()
|