fix: improve error handling and import order

- Add better error handling in _get_llm_instance
- Fix import order in test_custom_llm_support.py

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-02-09 22:57:14 +00:00
parent f4efdc55e2
commit 0423dd8134
2 changed files with 24 additions and 18 deletions

View File

@@ -1,6 +1,5 @@
from unittest.mock import MagicMock
import pytest
from unittest.mock import MagicMock
from crewai.agent import Agent
from crewai.crew import Crew
@@ -37,7 +36,7 @@ def test_crew_test_with_custom_llm():
crew.test(n_iterations=1, openai_model_name="gpt-4")
# Test error when neither parameter is provided
with pytest.raises(ValueError, match="Either llm or openai_model_name must be provided"):
with pytest.raises(ValueError, match="Must provide either 'llm' or 'openai_model_name' parameter"):
crew.test(n_iterations=1)
def test_crew_evaluator_with_custom_llm():