From 3cc5ce610e8c2fc47febf02e25503e11b41ab2a2 Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Mon, 6 Jan 2025 16:10:06 -0500 Subject: [PATCH] improve type hintings --- src/crewai/cli/crew_chat.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/crewai/cli/crew_chat.py b/src/crewai/cli/crew_chat.py index eee0592be..a38315620 100644 --- a/src/crewai/cli/crew_chat.py +++ b/src/crewai/cli/crew_chat.py @@ -2,12 +2,13 @@ import json import re import sys from pathlib import Path -from typing import Any, Dict, List, Set, Tuple +from typing import Any, Dict, List, Optional, Set, Tuple import click import tomli from crewai.crew import Crew +from crewai.llm import LLM from crewai.types.crew_chat import ChatInputField, ChatInputs from crewai.utilities.llm_utils import create_llm @@ -51,7 +52,7 @@ def run_chat(): chat_loop(chat_llm, messages, crew_tool_schema, available_functions) -def initialize_chat_llm(crew: Crew) -> Any: +def initialize_chat_llm(crew: Crew) -> Optional[LLM]: """Initializes the chat LLM and handles exceptions.""" try: return create_llm(crew.chat_llm)