From 9a705282968a3e5904a443efba87ee402e958936 Mon Sep 17 00:00:00 2001 From: Lorenze Jay Date: Wed, 12 Mar 2025 14:59:37 -0700 Subject: [PATCH] Update type hint for initialize_chat_llm to support BaseLLM - Modify the return type of initialize_chat_llm function to allow for both LLM and BaseLLM instances - Ensure compatibility with recent changes in create_llm function --- src/crewai/cli/crew_chat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crewai/cli/crew_chat.py b/src/crewai/cli/crew_chat.py index cd0da2bb8..1b4e18c78 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 LLM, BaseLLM 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[LLM | BaseLLM]: """Initializes the chat LLM and handles exceptions.""" try: return create_llm(crew.chat_llm)