-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: Add proper role to human feedback messages for LiteLLM #2113
base: main
Are you sure you want to change the base?
fix: Add proper role to human feedback messages for LiteLLM #2113
Conversation
- Update _handle_human_feedback to set user role for feedback messages - Add test coverage for message format - Fixes #2111 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:
|
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #2113 - LiteLLM Message Role FixOverviewThis PR addresses the feedback handling mechanism in Positive Aspects
Issues and Recommendations1. Inconsistent Message FormattingLocation:
2. Missing Type HintsLocation: Various methods
3. Method Documentation GapsLocation:
4. Lack of Error HandlingLocation: Throughout feedback processing
Security Considerations
Performance ImpactThe changes present minimal performance impact as they mainly adjust message structures. Testing Recommendations
Example Test Case:def test_feedback_message_formatting():
executor = CrewAgentExecutor()
feedback = "This needs improvement"
executor._process_feedback_iteration(feedback)
last_message = executor.messages[-1]
assert last_message["role"] == "user"
assert "feedback" in last_message["content"].lower() Summary of Changes Needed
The modifications present a significant step toward resolving the LiteLLM compatibility issue while simultaneously enhancing code quality. Implementing the suggested improvements will further solidify the resilience and maintainability of the application's feedback handling capabilities. |
- Use _format_msg consistently for feedback messages - Add comprehensive type hints - Improve method documentation - Add error handling for feedback processing Co-Authored-By: Joe Moura <[email protected]>
- Add custom exception for feedback processing errors - Add proper error inheritance and docstrings - Make exception importable via __init__.py Co-Authored-By: Joe Moura <[email protected]>
- Add FeedbackProcessingError for feedback handling - Add validation for empty and long feedback messages - Add test coverage for edge cases Co-Authored-By: Joe Moura <[email protected]>
- Add FeedbackProcessingError for feedback handling - Add validation for empty and long feedback messages - Add test coverage for edge cases Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
- Add type hints and docstrings - Enhance error handling in feedback processing - Standardize message formatting Co-Authored-By: Joe Moura <[email protected]>
- Add comprehensive docstrings - Enhance error handling in LLM feedback response - Add proper type hints Co-Authored-By: Joe Moura <[email protected]>
- Add comprehensive docstrings - Improve type hints clarity - Add missing error documentation Co-Authored-By: Joe Moura <[email protected]>
- Add comprehensive docstrings - Add error handling for training feedback - Add proper type hints Co-Authored-By: Joe Moura <[email protected]>
- Use i18n for feedback message formatting - Enhance method documentation - Improve code organization Co-Authored-By: Joe Moura <[email protected]>
- Fix method parameter formatting - Add trailing commas for consistency Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
Fixes #2111
When human_input is set to True, feedback messages were not properly formatted with a role for LiteLLM. This caused LiteLLM calls to fail. This PR:
human_input
set to True #2111Link to Devin run: https://app.devin.ai/sessions/75d754d9da88477784b62db499274f6c
Requested by: Joe