From 773da3f99479238bb380ee5ef1c164f57ec66784 Mon Sep 17 00:00:00 2001 From: Lorenze Jay Date: Mon, 24 Mar 2025 14:07:10 -0700 Subject: [PATCH] Remove unused `stream` method from `BaseLLM` class to enhance code clarity and maintainability. --- src/crewai/llms/base_llm.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/crewai/llms/base_llm.py b/src/crewai/llms/base_llm.py index d77579400..c51e8847d 100644 --- a/src/crewai/llms/base_llm.py +++ b/src/crewai/llms/base_llm.py @@ -89,37 +89,3 @@ class BaseLLM(ABC): """ # Default implementation - subclasses should override with model-specific values return 4096 - - def stream( - self, - messages: Union[str, List[Dict[str, str]]], - stream_callback: Optional[Callable[[str], None]] = None, - tools: Optional[List[dict]] = None, - callbacks: Optional[List[Any]] = None, - available_functions: Optional[Dict[str, Any]] = None, - ) -> str: - """Stream responses from the LLM with optional callbacks for each chunk. - - Args: - messages: Input messages for the LLM. - Can be a string or list of message dictionaries. - stream_callback: Optional callback function that receives each - text chunk as it arrives. - tools: Optional list of tool schemas for function calling. - callbacks: Optional list of callback functions. - available_functions: Optional dict mapping function names to callables. - - Returns: - The complete response as a string (after streaming is complete). - - Raises: - ValueError: If the messages format is invalid. - TimeoutError: If the LLM request times out. - RuntimeError: If the LLM request fails for other reasons. - """ - # Default implementation that doesn't actually stream but calls the callback - # Subclasses should override this with proper streaming implementations - response = self.call(messages, tools, callbacks, available_functions) - if stream_callback: - stream_callback(response) - return response