mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 09:08:31 +00:00
More clean up
This commit is contained in:
@@ -1623,7 +1623,7 @@ def test_litellm_auth_error_handling():
|
||||
agent=agent,
|
||||
)
|
||||
|
||||
# Mock the LLM call to raise LiteLLMAuthenticationError
|
||||
# Mock the LLM call to raise AuthenticationError
|
||||
with (
|
||||
patch.object(LLM, "call") as mock_llm_call,
|
||||
pytest.raises(LiteLLMAuthenticationError, match="Invalid API key"),
|
||||
@@ -1639,7 +1639,7 @@ def test_litellm_auth_error_handling():
|
||||
|
||||
def test_crew_agent_executor_litellm_auth_error():
|
||||
"""Test that CrewAgentExecutor handles LiteLLM authentication errors by raising them."""
|
||||
from litellm import AuthenticationError as LiteLLMAuthenticationError
|
||||
from litellm.exceptions import AuthenticationError
|
||||
|
||||
from crewai.agents.tools_handler import ToolsHandler
|
||||
from crewai.utilities import Printer
|
||||
@@ -1672,13 +1672,13 @@ def test_crew_agent_executor_litellm_auth_error():
|
||||
tools_handler=ToolsHandler(),
|
||||
)
|
||||
|
||||
# Mock the LLM call to raise LiteLLMAuthenticationError
|
||||
# Mock the LLM call to raise AuthenticationError
|
||||
with (
|
||||
patch.object(LLM, "call") as mock_llm_call,
|
||||
patch.object(Printer, "print") as mock_printer,
|
||||
pytest.raises(LiteLLMAuthenticationError, match="Invalid API key"),
|
||||
pytest.raises(AuthenticationError, match="Invalid API key"),
|
||||
):
|
||||
mock_llm_call.side_effect = LiteLLMAuthenticationError(
|
||||
mock_llm_call.side_effect = AuthenticationError(
|
||||
message="Invalid API key", llm_provider="openai", model="gpt-4"
|
||||
)
|
||||
executor.invoke(
|
||||
@@ -1711,7 +1711,7 @@ def test_litellm_anthropic_error_handling():
|
||||
role="test role",
|
||||
goal="test goal",
|
||||
backstory="test backstory",
|
||||
llm=LLM(model="claude-3.5-sonnet-20240620"),
|
||||
llm=LLM(model="claude-3.5-sonnet-20240620"),
|
||||
max_retry_limit=0,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user