-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
feat: Improve data handling and text formatting (loop fix) #6771
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…eturn condition in the LoopComponent class 📝 (data.py): Enhance the data_to_text_list function to handle various data structures and ensure consistent text formatting 📝 (LoopTemplate.json): Update the LoopComponent class description and method implementations for better clarity and maintainability 📝 (test_data_to_text_list.py): Add unit tests to cover different scenarios and edge cases for the data_to_text_list function
…fic files in the project. Fix type annotations and improve error handling in data.py module. Add noqa comments to ignore linting rule A005 for specific files in the project.
…parametrize to improve readability and maintainability
…lity and maintainability 🔧 (test_data_to_text_list.py): simplify test_data_to_text_list_complex_nested_data test case for better clarity and conciseness
…ction to improve readability and maintainability
CodSpeed Performance ReportMerging #6771 will not alter performanceComparing Summary
|
ogabrielluiz
requested changes
Feb 24, 2025
Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>
…ic and improve readability by removing unnecessary if conditions and updating the format_dict directly from data_obj.data.
ogabrielluiz
approved these changes
Feb 24, 2025
…defaultdict behavior and improve test coverage
…ect number of occurrences of "modified_value" in the output
…d text length is greater than 20 to ensure the chatbot response is meaningful
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
lgtm
This PR has been approved by a maintainer
size:L
This PR changes 100-499 lines, ignoring generated files.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to improve the handling of data and text formatting in the
langflow
backend. The most important changes include updates to thedata_to_text_list
function, enhancements to theLoopComponent
class, and the addition of new tests for thedata_to_text_list
function.Improvements to data handling and text formatting:
src/backend/base/langflow/helpers/data.py
: Refactored thedata_to_text_list
function to handle various data structures, support nested dictionaries, and use safe string formatting with fallbacks for missing keys. Added detailed docstrings and examples for better understanding.Enhancements to loop component:
src/backend/base/langflow/components/logic/loop.py
: Modified theevaluate_stop_loop
method to simplify the condition for stopping the loop.src/backend/base/langflow/initial_setup/starter_projects/LoopTemplate.json
: Updated theLoopComponent
class to reflect the changes in theevaluate_stop_loop
method.Addition of new tests:
src/backend/tests/unit/helpers/test_data_to_text_list.py
: Added comprehensive tests for thedata_to_text_list
function, covering various input combinations, error handling, and edge cases.Additional imports:
src/backend/base/langflow/helpers/data.py
: Added imports fordefaultdict
,Union
,Tuple
, andList
to support the refactoreddata_to_text_list
function.