fix: address type-checker and lint issues

- Add proper type hints in Crew.test()
- Fix import sorting in test file

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-02-09 22:50:06 +00:00
parent b8f2603bf3
commit 0ab66041da
2 changed files with 5 additions and 4 deletions

View File

@@ -1163,7 +1163,7 @@ class Crew(BaseModel):
if not llm and not openai_model_name:
raise ValueError("Either llm or openai_model_name must be provided")
model_to_use = llm or openai_model_name
model_to_use: Union[str, LLM] = llm if llm is not None else openai_model_name
if isinstance(model_to_use, str):
model_to_use = LLM(model=model_to_use)
@@ -1173,8 +1173,8 @@ class Crew(BaseModel):
test_crew,
n_iterations,
inputs,
str(model_to_use.model), # type: ignore[arg-type]
) # type: ignore[arg-type]
str(model_to_use.model),
)
evaluator = CrewEvaluator(test_crew, model_to_use)
for i in range(1, n_iterations + 1):

View File

@@ -1,6 +1,7 @@
import pytest
from unittest.mock import MagicMock
import pytest
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.llm import LLM