From 0ddf84a1d02b4e4d2cf01703815b67ca636cd364 Mon Sep 17 00:00:00 2001 From: Brandon Hancock Date: Wed, 22 Jan 2025 11:18:18 -0500 Subject: [PATCH] fix stop type errors] --- src/crewai/llm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/crewai/llm.py b/src/crewai/llm.py index 790d13ead..af10ace15 100644 --- a/src/crewai/llm.py +++ b/src/crewai/llm.py @@ -160,6 +160,14 @@ class LLM: litellm.drop_params = True + # Normalize self.stop to always be a List[str] + if stop is None: + self.stop: List[str] = [] + elif isinstance(stop, str): + self.stop = [stop] + else: + self.stop = stop + self.set_callbacks(callbacks) self.set_env_callbacks() @@ -222,7 +230,7 @@ class LLM: ].message text_response = response_message.content or "" tool_calls = getattr(response_message, "tool_calls", []) - + # Ensure callbacks get the full response object with usage info if callbacks and len(callbacks) > 0: for callback in callbacks: