Skip to content

Commit

Permalink
fix stop type errors]
Browse files Browse the repository at this point in the history
  • Loading branch information
bhancockio committed Jan 22, 2025
1 parent dc2e684 commit 0ddf84a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/crewai/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ def __init__(

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()

Expand Down Expand Up @@ -222,7 +230,7 @@ def call(
].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:
Expand Down

0 comments on commit 0ddf84a

Please sign in to comment.