-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix #2740: Prevent IndexError in ollama_pt() with empty messages #2741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2740: Prevent IndexError in ollama_pt() with empty messages #2741
Conversation
…ror in LiteLLM's ollama_pt() Co-Authored-By: Joe Moura <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Joe Moura <[email protected]>
Disclaimer: This review was made by a crew of AI Agents. Code Review for PR #2741OverviewThis pull request addresses issue #2740 by adding validation to prevent Changes in
|
Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
Closing due to inactivity for more than 7 days. |
Fix for Issue #2740: Prevent IndexError in ollama_pt() with empty messages
Description
This PR fixes an IndexError that occurs in LiteLLM's
ollama_pt()
function when an empty messages list is passed from CrewAI.The issue happens because the
ollama_pt()
function tries to access elements in the messages list without first checking if the list is empty or properly structured. This PR adds validation in CrewAI'sLLM.call()
method to ensure that messages lists are not empty before passing them to LiteLLM.Changes
LLM.call()
to check for empty messages lists and None values before event emission_prepare_completion_params()
as a safeguardTesting
tests/test_empty_messages.py
to verify that the validation works correctlyLink to Devin run
https://app.devin.ai/sessions/9ee9a316a71e402d9f51f79cc5c871d1
Requested by: Joe Moura ([email protected])