-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix: change LoopComponent data input to DataFrame type and update display name #8297
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
Conversation
WalkthroughThe changes update the LoopComponent's input specification to accept only "DataFrame" types instead of both "Data" and "DataFrame", and rename the input display name from "Data or DataFrame" to "Inputs". Corresponding updates are made in the backend, starter project JSON, and frontend tests without altering any processing logic or control flow. Changes
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (9)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/backend/base/langflow/components/logic/loop.py (1)
46-55
: 🛠️ Refactor suggestionUpdate validation logic to match input type restriction.
The
_validate_data
method still handlesData
objects and lists ofData
objects (lines 50-52), but the input specification now only accepts DataFrame. This creates dead code and inconsistent behavior.If DataFrame-only input is intended, simplify the validation method:
def _validate_data(self, data): - """Validate and return a list of Data objects.""" + """Validate DataFrame and return a list of Data objects.""" if isinstance(data, DataFrame): return data.to_data_list() - if isinstance(data, Data): - return [data] - if isinstance(data, list) and all(isinstance(item, Data) for item in data): - return data - msg = "The 'data' input must be a DataFrame, a list of Data objects, or a single Data object." + msg = "The 'data' input must be a DataFrame." raise TypeError(msg)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/backend/base/langflow/components/logic/loop.py
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Optimize new Python code in this PR
- GitHub Check: Update Starter Projects
- GitHub Check: Run Ruff Check and Format
- GitHub Check: Ruff Style Check (3.13)
display_name="DataFrame", | ||
info="The initial list of Data objects or DataFrame to iterate over.", | ||
input_types=["Data", "DataFrame"], | ||
input_types=["DataFrame"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent input type restriction - requires comprehensive update.
The change restricts input types to only "DataFrame", but several parts of the codebase still expect to handle "Data" objects:
- The
info
string (line 18) still mentions "Data objects or DataFrame" - The class description (line 10) still mentions "Data objects"
- The
_validate_data
method (lines 50-52) still handlesData
objects and lists ofData
objects - The error message (line 54) still mentions Data objects
This creates inconsistencies that could confuse users and result in dead code.
Apply this diff to make the component consistent with DataFrame-only input:
- info="The initial list of Data objects or DataFrame to iterate over.",
+ info="The DataFrame to iterate over.",
And update the class description:
- description = (
- "Iterates over a list of Data objects, outputting one item at a time and aggregating results from loop inputs."
- )
+ description = (
+ "Iterates over a DataFrame, outputting one item at a time and aggregating results from loop inputs."
+ )
Alternatively, if Data objects should still be supported, revert the input_types change:
- input_types=["DataFrame"],
+ input_types=["Data", "DataFrame"],
- display_name="DataFrame",
+ display_name="Data or DataFrame",
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/backend/base/langflow/components/logic/loop.py around lines 10 to 54,
there is inconsistency between the input_types restriction to only "DataFrame"
and other parts of the code and documentation that still reference "Data"
objects. To fix this, either update the class description, info string,
_validate_data method, and error messages to reflect that only DataFrame inputs
are supported, removing all mentions and handling of Data objects, or revert the
input_types change to include both "Data" and "DataFrame" to maintain
consistency with the existing code and documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edwinjosechittilappilly I agree with these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (1)
1725-1731
: Align inputinfo
text with the new single-type restriction
You updateddisplay_name
to “DataFrame” and restrictedinput_types
to["DataFrame"]
. The accompanyinginfo
string still mentions “Data objects or DataFrame”, which is now outdated. Please revise it to something like:"info": "The DataFrame to iterate over."to keep the description accurate.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Run Ruff Check and Format
- GitHub Check: Optimize new Python code in this PR
- GitHub Check: Run benchmarks (3.12)
- GitHub Check: Update Starter Projects
- GitHub Check: Ruff Style Check (3.13)
@@ -112,7 +111,7 @@ | |||
"source": "ArXivComponent-ylKFb", | |||
"sourceHandle": "{œdataTypeœ: œArXivComponentœ, œidœ: œArXivComponent-ylKFbœ, œnameœ: œdataframeœ, œoutput_typesœ: [œDataFrameœ]}", | |||
"target": "LoopComponent-9BK8B", | |||
"targetHandle": "{œfieldNameœ: œdataœ, œidœ: œLoopComponent-9BK8Bœ, œinputTypesœ: [œDataœ, œDataFrameœ], œtypeœ: œotherœ}" | |||
"targetHandle": "{œfieldNameœ: œdataœ, œidœ: œLoopComponent-9BK8Bœ, œinputTypesœ: [œDataFrameœ], œtypeœ: œotherœ}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure edge id
consistency after restricting input types
The targetHandle
now correctly restricts inputTypes
to ["DataFrame"]
. However, the edge’s "id"
property (line 109) still embeds the old ["Data", "DataFrame"]
metadata, causing a mismatch. Please update the "id"
to reflect only DataFrame
or switch to a stable identifier that doesn’t hardcode input metadata.
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Research Translation
Loop.json at line 114, the targetHandle restricts inputTypes to ["DataFrame"],
but the edge "id" at line 109 still references the old input metadata ["Data",
"DataFrame"]. Update the "id" property at line 109 to reflect only "DataFrame"
or replace it with a stable identifier that does not hardcode input metadata to
ensure consistency.
CodSpeed Performance ReportMerging #8297 will degrade performances by 13%Comparing Summary
Benchmarks breakdown
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…prove test distribution and efficiency
…e a maximum of 10 shards instead of 40 for better test distribution 🐛 (loop-component.spec.ts): fix getByTestId selector to match the updated element ID for testing purposes
…play name (#8297) * Update loop.py * [autofix.ci] apply automated fixes * Update loop-component.spec.ts * change dataframe input name to inputs * [autofix.ci] apply automated fixes * 🐛 (typescript_test.yml): increase the maximum shard count to 40 to improve test distribution and efficiency * 🔧 (typescript_test.yml): adjust optimal shard count calculation to use a maximum of 10 shards instead of 40 for better test distribution 🐛 (loop-component.spec.ts): fix getByTestId selector to match the updated element ID for testing purposes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yuqi Tang <[email protected]> Co-authored-by: cristhianzl <[email protected]>
Summary by CodeRabbit
Refactor
Tests