From 687303ad63b0e7569a0e358622d751a566838ed9 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 4 Mar 2025 17:13:12 +0000 Subject: [PATCH] Fix import sorting and type annotations Co-Authored-By: Joe Moura --- src/crewai/cli/crew_chat.py | 6 +++--- src/crewai/crew.py | 2 +- src/crewai/utilities/llm_utils.py | 2 +- tests/custom_llm_test.py | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/crewai/cli/crew_chat.py b/src/crewai/cli/crew_chat.py index cd0da2bb8..34a0ae2ce 100644 --- a/src/crewai/cli/crew_chat.py +++ b/src/crewai/cli/crew_chat.py @@ -14,7 +14,7 @@ from packaging import version from crewai.cli.utils import read_toml from crewai.cli.version import get_crewai_version from crewai.crew import Crew -from crewai.llm import LLM +from crewai.llm import BaseLLM, LLM from crewai.types.crew_chat import ChatInputField, ChatInputs from crewai.utilities.llm_utils import create_llm @@ -116,7 +116,7 @@ def show_loading(event: threading.Event): print() -def initialize_chat_llm(crew: Crew) -> Optional[LLM]: +def initialize_chat_llm(crew: Crew) -> Optional[BaseLLM]: """Initializes the chat LLM and handles exceptions.""" try: return create_llm(crew.chat_llm) @@ -220,7 +220,7 @@ def get_user_input() -> str: def handle_user_input( user_input: str, - chat_llm: LLM, + chat_llm: BaseLLM, messages: List[Dict[str, str]], crew_tool_schema: Dict[str, Any], available_functions: Dict[str, Any], diff --git a/src/crewai/crew.py b/src/crewai/crew.py index 2e3308177..cf0686f6a 100644 --- a/src/crewai/crew.py +++ b/src/crewai/crew.py @@ -26,7 +26,7 @@ from crewai.agents.cache import CacheHandler from crewai.crews.crew_output import CrewOutput from crewai.knowledge.knowledge import Knowledge from crewai.knowledge.source.base_knowledge_source import BaseKnowledgeSource -from crewai.llm import BaseLLM, LLM +from crewai.llm import LLM, BaseLLM from crewai.memory.entity.entity_memory import EntityMemory from crewai.memory.long_term.long_term_memory import LongTermMemory from crewai.memory.short_term.short_term_memory import ShortTermMemory diff --git a/src/crewai/utilities/llm_utils.py b/src/crewai/utilities/llm_utils.py index 3271e8bcb..8035b6593 100644 --- a/src/crewai/utilities/llm_utils.py +++ b/src/crewai/utilities/llm_utils.py @@ -2,7 +2,7 @@ import os from typing import Any, Dict, List, Optional, Union from crewai.cli.constants import DEFAULT_LLM_MODEL, ENV_VARS, LITELLM_PARAMS -from crewai.llm import BaseLLM, LLM +from crewai.llm import LLM, BaseLLM def create_llm( diff --git a/tests/custom_llm_test.py b/tests/custom_llm_test.py index afedafbd5..fcbdfc52a 100644 --- a/tests/custom_llm_test.py +++ b/tests/custom_llm_test.py @@ -1,6 +1,7 @@ -import pytest from typing import Any, Dict, List, Optional, Union +import pytest + from crewai.llm import BaseLLM from crewai.utilities.llm_utils import create_llm