From 0ab66041da8026685dca047dddaa7a61f03b67a1 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 22:50:06 +0000 Subject: [PATCH] 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 --- src/crewai/crew.py | 6 +++--- tests/utilities/evaluators/test_custom_llm_support.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/crewai/crew.py b/src/crewai/crew.py index 10d440955..3b7f9cbbd 100644 --- a/src/crewai/crew.py +++ b/src/crewai/crew.py @@ -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): diff --git a/tests/utilities/evaluators/test_custom_llm_support.py b/tests/utilities/evaluators/test_custom_llm_support.py index 011e7b80f..371237b48 100644 --- a/tests/utilities/evaluators/test_custom_llm_support.py +++ b/tests/utilities/evaluators/test_custom_llm_support.py @@ -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