Skip to content

fix: Refactor a few more components to proper folders#8324

Merged
erichare merged 19 commits into
mainfrom
fix-remove-save-file-output
Jun 3, 2025
Merged

fix: Refactor a few more components to proper folders#8324
erichare merged 19 commits into
mainfrom
fix-remove-save-file-output

Conversation

@erichare
Copy link
Copy Markdown
Collaborator

@erichare erichare commented Jun 2, 2025

This pull request moves a couple of components to the Processing folder, while removing the Save File output.

Summary by CodeRabbit

  • New Features

    • Added new processing components: BatchRunComponent and StructuredOutputComponent are now available for use.
  • Bug Fixes

    • Improved file loading components to return data in a consistent format across various modules.
    • Updated output method names in several starter projects to ensure correct data handling.
  • Refactor

    • Streamlined and clarified component exports and internal data flow for file and video processing.
    • Removed unused outputs and cleaned up component metadata for better maintainability.
  • Tests

    • Updated test imports to reflect component restructuring.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 2, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2025

## Walkthrough

The changes reorganize and update method names and component exports related to file loading and processing. Key file-loading methods are renamed and their control flow adjusted for clarity. Two components, `BatchRunComponent` and `StructuredOutputComponent`, are moved from the helpers module to the processing module. Associated JSON configurations and test imports are updated to match these changes, and output declarations for some components are streamlined.

## Changes

| File(s) / Path(s)                                                                                   | Change Summary                                                                                           |
|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| `src/backend/base/langflow/base/data/base_file.py`                                                  | Renamed file loading methods: `load_files``load_files_core`, `load_dataframe``load_files`; adjusted logic to separate raw file loading from DataFrame construction. |
| `src/backend/base/langflow/components/helpers/__init__.py`                                          | Removed exports and imports for `BatchRunComponent` and `StructuredOutputComponent`.                     |
| `src/backend/base/langflow/components/processing/__init__.py`                                       | Added imports and exports for `BatchRunComponent` and `StructuredOutputComponent`.                       |
| `src/backend/base/langflow/components/processing/save_file.py`                                      | Removed the `outputs` attribute from `SaveToFileComponent`.                                              |
| `src/backend/base/langflow/components/twelvelabs/video_file.py`                                     | Changed `load_files` return type from `list[Data]` to `DataFrame` and updated return statements.         |
| `src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json`<br>`.../Portfolio Website Code Generator.json`<br>`.../Text Sentiment Analysis.json`<br>`.../Vector Store RAG.json` | Changed output method for "Loaded Files" from `load_dataframe` to `load_files` in File component nodes.   |
| `src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json`                     | Removed the `confirmation` output from the `SaveToFile` component's outputs array in JSON metadata.      |
| `src/backend/base/langflow/initial_setup/starter_projects/document_qa.py`                           | Changed parser input from `file_component.load_dataframe` to `file_component.load_files`.                |
| `src/backend/base/langflow/initial_setup/starter_projects/vector_store_rag.py`                      | Changed text splitter input from `FileComponent.load_dataframe` to `FileComponent.load_files`.           |
| `src/backend/tests/unit/initial_setup/starter_projects/test_vector_store_rag.py`                    | Updated ingestion graph to use `load_files` instead of `load_dataframe` for text splitter input.         |
| `src/backend/tests/unit/components/processing/test_batch_run_component.py`                          | Changed import path for `BatchRunComponent` to processing module.                                        |
| `src/backend/tests/unit/components/processing/test_structured_output_component.py`                  | Changed import path for `StructuredOutputComponent` to processing module.                                |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant FileComponent
    participant DataLoader

    User->>FileComponent: Request loaded files (load_files)
    FileComponent->>FileComponent: Call load_files_core()
    FileComponent->>DataLoader: Process files (CSV/non-CSV)
    DataLoader-->>FileComponent: Return raw file data
    FileComponent->>FileComponent: Convert data to DataFrame
    FileComponent-->>User: Return DataFrame of loaded files
sequenceDiagram
    participant User
    participant ProcessingModule
    participant BatchRunComponent
    participant StructuredOutputComponent

    User->>ProcessingModule: Import BatchRunComponent/StructuredOutputComponent
    ProcessingModule->>BatchRunComponent: Expose BatchRunComponent
    ProcessingModule->>StructuredOutputComponent: Expose StructuredOutputComponent
    ProcessingModule-->>User: Components available for use
Loading

## Possibly related PRs

- langflow-ai/langflow#8117: Refactors file loading methods in `BaseFileComponent` by renaming and separating raw data loading from DataFrame construction, closely related to this PR's changes in method naming and output handling.


<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between ac6dd20d30f7a2e992b569657519d6e205801dac and 53c12f245737c6c9ceae08cacd3c72fc6bd53cbc.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `src/backend/tests/unit/components/processing/test_structured_output_component.py` (4 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧬 Code Graph Analysis (1)</summary>

<details>
<summary>src/backend/tests/unit/components/processing/test_structured_output_component.py (1)</summary><blockquote>

<details>
<summary>src/backend/base/langflow/components/processing/structured_output.py (1)</summary>

* `StructuredOutputComponent` (20-183)

</details>

</blockquote></details>

</details><details>
<summary>🪛 Pylint (3.3.7)</summary>

<details>
<summary>src/backend/tests/unit/components/processing/test_structured_output_component.py</summary>

[error] 8-8: Unable to import 'langflow.components.processing.structured_output'

(E0401)

---

[error] 8-8: No name 'components' in module 'langflow'

(E0611)

---

[convention] 56-56: Line too long (109/100)

(C0301)

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (17)</summary>

* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 9/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 10/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 3/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 1/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 6/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 5/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 8/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 7/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 4/10
* GitHub Check: Run Frontend Tests / Playwright Tests - Shard 2/10
* GitHub Check: Lint Backend / Run Mypy (3.13)
* GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
* GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
* GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
* GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
* GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
* GitHub Check: Optimize new Python code in this PR

</details>

<details>
<summary>🔇 Additional comments (4)</summary><blockquote>

<details>
<summary>src/backend/tests/unit/components/processing/test_structured_output_component.py (4)</summary>

`8-8`: **Update import path to reflect relocated component.**

The import has been correctly changed to `langflow.components.processing.structured_output.StructuredOutputComponent`. Ensure that the `processing` package is included in your test PYTHONPATH and that all necessary `__init__.py` files exist so this import resolves in CI.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 Pylint (3.3.7)</summary>

[error] 8-8: Unable to import 'langflow.components.processing.structured_output'

(E0401)

---

[error] 8-8: No name 'components' in module 'langflow'

(E0611)

</details>

</details>

---

`56-56`: **Adjust patch target to new module path.**

The `patch` decorator now correctly points to `get_chat_result` in the `processing.structured_output` module. This aligns with the refactoring.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 Pylint (3.3.7)</summary>

[convention] 56-56: Line too long (109/100)

(C0301)

</details>

</details>

---

`177-177`: **Synchronize patch decorator with updated module.**

Good update—this decorator now mocks `get_chat_result` from the relocated component module.

---

`211-211`: **Correct patch path for large-input test.**

The patch target here is consistent with the component’s new location, ensuring proper mocking in this test.

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAM3gADy4bEli0MXw+NEhYkgB3SGZMjyZmbnxyDFxkAh4KfG5KHPwvJQpEaMg8tGQHAWZ1Gno5MNgPbEQmyngGWGcPHs8f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KoGOB7BrBsQVQAAFZbBAANhcEHBaAAgNILQAACMgQ2IJEL2ACATBZgiAJAB2DWC/BRwaIYENsFoBrBewHYH4MCHWDAhDAWgAwEiHhCdgAgI4EEIYAHBrBRwWIJYIYA7BAhgQgQDsEsGJDRBLQvYLYNiAMAshJAPYH4L2CNDbBvQ2gDsFsEHBLBgQuIRpFiBWDLBRwdIJYKCFs1bBXQ8wcMIECBC/BRxPwUoECF7A3QfgkYaUIYBHAGhaAHYEcBaGxBaA7gg4HQDQB7A7hWw5IccL8GRC2akQ0QFBFSAHAdgTg5YdkNsF0B4hZwvwdsEOHWCbhoQ2gHsA+FQB0ggQskHUMRE+Dshzwywe4IEAFDZhAQ74ZYNoCBCSAdQvwakMiHyR/Us0UQSMLKEHBYgxwAIb0IGEMAmh3cEgNYJ2DqgShewBgNMP6FtDaADIgQLSM0FJCoAOgyDHoLDa/NDBRMRaCYKAA== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=langflow-ai/langflow&utm_content=8324):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) 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)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 2, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 2, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 2, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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 (2)
src/backend/base/langflow/components/processing/save_file.py (2)

54-93: 🛠️ Refactor suggestion

Consider security implications of file path handling.

The method uses Path(self.file_name).expanduser() which could be vulnerable to path traversal attacks if user input isn't properly validated. Users could potentially provide paths like ../../../etc/passwd to access files outside the intended directory.

Consider adding path validation to restrict file operations to a safe directory:

def save_to_file(self) -> str:
    """Save the input to a file and upload it, returning a confirmation message."""
    # Validate inputs
    if not self.file_name:
        msg = "File name must be provided."
        raise ValueError(msg)
+   
+   # Validate file name for security
+   if ".." in self.file_name or self.file_name.startswith("/"):
+       msg = "Invalid file name: path traversal not allowed."
+       raise ValueError(msg)
🧰 Tools
🪛 Pylint (3.3.7)

[convention] 67-67: Line too long (108/100)

(C0301)


[convention] 70-70: Line too long (113/100)

(C0301)


131-141: 🛠️ Refactor suggestion

Improve resource management for database sessions.

The current pattern async for db in get_session(): doesn't show explicit session cleanup or transaction management. This could lead to resource leaks if exceptions occur during the upload process.

Consider using proper async context management:

-       with file_path.open("rb") as f:
-           async for db in get_session():
-               user_id, _ = await create_user_longterm_token(db)
-               current_user = await get_user_by_id(db, user_id)
-
-               await upload_user_file(
-                   file=UploadFile(filename=file_path.name, file=f, size=file_path.stat().st_size),
-                   session=db,
-                   current_user=current_user,
-                   storage_service=get_storage_service(),
-                   settings_service=get_settings_service(),
-               )
+       try:
+           with file_path.open("rb") as f:
+               async for db in get_session():
+                   try:
+                       user_id, _ = await create_user_longterm_token(db)
+                       current_user = await get_user_by_id(db, user_id)
+
+                       await upload_user_file(
+                           file=UploadFile(filename=file_path.name, file=f, size=file_path.stat().st_size),
+                           session=db,
+                           current_user=current_user,
+                           storage_service=get_storage_service(),
+                           settings_service=get_settings_service(),
+                       )
+                   except Exception as e:
+                       # Log error and ensure session cleanup
+                       raise e
+       except Exception as e:
+           msg = f"Failed to upload file: {e}"
+           raise RuntimeError(msg) from e
🧹 Nitpick comments (2)
src/backend/base/langflow/base/data/base_file.py (1)

239-273: Consider data structure consistency when combining CSV and non-CSV data.

The implementation efficiently handles CSV files using pandas, but there's a potential for data structure inconsistency when combining CSV data (which comes as dictionaries from pd.read_csv().to_dict("records")) with manually constructed non-CSV rows.

Potential issues:

  1. CSV files may have different column structures than the manually constructed rows
  2. The generic Exception catch in the CSV processing could mask specific pandas errors

Consider these improvements:

             try:
-                csv_data.extend(pd.read_csv(file_path).to_dict("records"))
-            except Exception as e:
+                df = pd.read_csv(file_path)
+                # Ensure consistent column structure
+                csv_records = df.to_dict("records")
+                csv_data.extend(csv_records)
+            except (pd.errors.EmptyDataError, pd.errors.ParserError, FileNotFoundError) as e:
                 self.log(f"Error processing CSV file {file_path}: {e}")
                 if not self.silent_errors:
                     raise
+            except Exception as e:
+                self.log(f"Unexpected error processing CSV file {file_path}: {e}")
+                if not self.silent_errors:
+                    raise

This provides more specific error handling and makes the CSV processing more explicit.

🧰 Tools
🪛 Pylint (3.3.7)

[warning] 258-258: Catching too general exception Exception

(W0718)

src/backend/base/langflow/components/processing/save_file.py (1)

175-198: Optimize async iterator handling for large streams.

The current implementation loads the entire content of async iterators into memory before writing to file. For large streams, this could cause memory issues.

Consider streaming the content directly to file:

async def _save_message(self, message: Message, path: Path, fmt: str) -> str:
    """Save a Message to the specified file format, handling async iterators."""
    if message.text is None:
        content = ""
    elif isinstance(message.text, AsyncIterator):
-       async for item in message.text:
-           content += str(item) + " "
-       content = content.strip()
+       if fmt == "txt":
+           with path.open("w", encoding="utf-8") as f:
+               async for item in message.text:
+                   f.write(str(item) + " ")
+           return f"Message saved successfully as '{path}'"
+       else:
+           # For JSON/markdown, we still need to collect content
+           content = ""
+           async for item in message.text:
+               content += str(item) + " "
+           content = content.strip()
    elif isinstance(message.text, Iterator):
        content = " ".join(str(item) for item in message.text)
    else:
        content = str(message.text)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3608368 and 4907798.

📒 Files selected for processing (9)
  • src/backend/base/langflow/base/data/base_file.py (3 hunks)
  • src/backend/base/langflow/components/helpers/__init__.py (0 hunks)
  • src/backend/base/langflow/components/processing/__init__.py (3 hunks)
  • src/backend/base/langflow/components/processing/save_file.py (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (1 hunks)
💤 Files with no reviewable changes (1)
  • src/backend/base/langflow/components/helpers/init.py
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/backend/base/langflow/components/processing/__init__.py (2)
src/backend/base/langflow/components/processing/batch_run.py (1)
  • BatchRunComponent (16-204)
src/backend/base/langflow/components/processing/structured_output.py (1)
  • StructuredOutputComponent (20-183)
src/backend/base/langflow/components/processing/save_file.py (1)
src/backend/base/langflow/inputs/inputs.py (3)
  • DropdownInput (467-491)
  • HandleInput (76-87)
  • StrInput (128-184)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (11)
src/backend/base/langflow/components/processing/__init__.py (2)

2-2: Expose BatchRunComponent in processing module
The import statement on line 2 and the corresponding __all__ entry on line 26 correctly relocate BatchRunComponent from helpers to the processing package, aligning with the PR's restructuring goals.

Also applies to: 26-26


21-21: Expose StructuredOutputComponent in processing module
The import on line 21 and the __all__ inclusion on line 45 properly make StructuredOutputComponent publicly available under components.processing, completing its move from the helpers module.

Also applies to: 45-45

src/backend/base/langflow/base/data/base_file.py (2)

228-237: Well-structured method separation.

The introduction of load_files_core provides clear separation of concerns between loading raw data (this method) and creating DataFrame views (load_files). The implementation is clean and well-documented.


245-245: Clean method call refactoring.

The call to load_files_core() correctly implements the new method structure and maintains the same functionality while improving code organization.

src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (1)

1858-1864:

Details

❓ Verification inconclusive

Verify method name consistency in JSON configuration

The File component’s output method has been updated to "load_files" to align with the backend refactor (renamed from load_dataframe). Please ensure all starter project JSONs and any downstream code referencing the old "load_dataframe" method have been updated accordingly.

To validate there are no lingering references, run:


🏁 Script executed:

#!/bin/bash
# Search for outdated 'load_dataframe' usage in starter project configs
rg '"load_dataframe"' -g 'src/backend/base/langflow/initial_setup/starter_projects/*.json'

Length of output: 92


Confirmed JSON configs now use “load_files”

Ran:

rg '"load_dataframe"' -g 'src/backend/base/langflow/initial_setup/starter_projects/*.json'

▶ no matches found

• All starter project JSONs have been updated to "load_files".
• Please verify that any downstream code (e.g., Python modules or other configs) no longer references "load_dataframe".

src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (2)

268-270: Update method name to reflect backend refactor

The output method has been correctly updated from load_dataframe to load_files, aligning this starter project configuration with the renamed implementation in BaseFileComponent.


1-2870:

Details

✅ Verification successful

Audit other starter project configurations

Ensure there are no residual references to the deprecated load_dataframe method in other starter project JSON files.


🏁 Script executed:

#!/bin/bash
# Search for any occurrences of the old method in JSON configs
rg -n '"load_dataframe"' -g 'src/backend/base/langflow/initial_setup/starter_projects/*.json'

Length of output: 95


No deprecated load_dataframe references found

I searched all JSON starter project configurations under src/backend/base/langflow/initial_setup/starter_projects and found no occurrences of the deprecated load_dataframe method.

src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1)

807-807:

Details

✅ Verification successful

Align output method with refactored backend

The File component’s output method has been correctly updated from "load_dataframe" to "load_files" to match the backend refactor. Please ensure this update is consistently applied across all starter project JSONs and that no stale "load_dataframe" references remain.

To verify, you can run:


🏁 Script executed:

#!/bin/bash
# Check for any remaining references to the old method in starter project JSONs
rg -n '"method": "load_dataframe"' --glob='src/backend/base/langflow/initial_setup/starter_projects/*.json'

Length of output: 109


No remaining “load_dataframe” references found

The File component’s output method has been consistently updated from "load_dataframe" to "load_files" across all starter project JSONs—no stale references detected.

src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (1)

2423-2423: Align JSON config with renamed method
The "method" property has been updated from "load_dataframe" to "load_files", matching the refactored loader in base_file.py. This change ensures the starter project invokes the correct backend function.

src/backend/base/langflow/components/processing/save_file.py (1)

12-12:

Details

✅ Verification successful

Verify the intentional removal of Output declaration.

The import of Output was removed, and correspondingly, there's no outputs attribute in the class. However, the save_to_file method still returns confirmation messages. This creates a disconnect where the method produces output but it's not accessible to other components in a flow.


🏁 Script executed:

#!/bin/bash
# Description: Check if other components or flows depend on SaveToFile outputs
# Expected: Find references to SaveToFile outputs in the codebase

echo "Searching for SaveToFile output references..."
rg -A 5 -B 5 "SaveToFile.*output|SaveToFile.*confirmation" --type json --type py

echo "Searching for save_to_file method calls..."
rg -A 3 "save_to_file" --type py --type json

Length of output: 49213


SaveToFileComponent is a sink and intentionally omits an outputs declaration.
No flows or other components reference its return value as an output, and all existing tests invoke save_to_file() directly and continue passing. No changes are needed here.

src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json (1)

1642-1642: Sync JSON metadata with updated SaveToFile component
The "outputs": [] entry has been correctly removed to match the refactored SaveToFileComponent class, which no longer declares any outputs. This ensures the starter project flow stays in sync with the backend component.

Comment thread src/backend/base/langflow/base/data/base_file.py
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 2, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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/processing/save_file.py (1)

19-53: 💡 Verification agent

🧩 Analysis chain

Missing outputs declaration may break component functionality.

According to the AI summary, the outputs attribute was removed from this component class. However, the save_to_file method (line 54) still returns a confirmation string, suggesting this should be exposed as an output for use in flows.

Without an explicit outputs declaration, this component may not be usable in the Langflow UI, as the system needs to know what outputs are available for connecting to other components.

Consider adding the outputs declaration back:

    ]

+    outputs = [
+        Output(
+            display_name="Confirmation",
+            name="confirmation", 
+            method="save_to_file"
+        )
+    ]

    async def save_to_file(self) -> str:

Please verify if this component is still functional in flows without the outputs declaration.


🏁 Script executed:

#!/bin/bash
# Verify if SaveToFileComponent is used in other flows and how outputs are handled
rg -A 5 -B 5 "SaveToFile" --type json

Length of output: 15032


🏁 Script executed:

#!/bin/bash
# Locate the definition of the base Component class
rg -n "class Component" -n .

Length of output: 6492


#!/bin/bash
# Inspect the CustomComponent base class for outputs handling
rg --max-count 1 -A20 -B5 "class Component" src/backend/base/langflow/custom/custom_component/component.py
rg -n "outputs" src/backend/base/langflow/custom/custom_component/component.py

# Check how outputs are handled in the component tool
rg -n "outputs" -n src/backend/base/langflow/base/tools/component_tool.py

#!/bin/bash
# Show the definition of the custom Component base class
rg -n "class Component" -A10 -B3 src/backend/base/langflow/custom/custom_component/component.py

# Search for any default outputs handling in that file
rg -n "outputs" src/backend/base/langflow/custom/custom_component/component.py

#!/bin/bash
# Inspect the CustomComponent base class for outputs handling
rg -n "class Component" -A10 -B3 src/backend/base/langflow/custom/custom_component/component.py

# Search for any 'outputs' attribute or default behavior in that file
rg -n "outputs" src/backend/base/langflow/custom/custom_component/component.py

# Check how the ComponentTool processes outputs
rg -n "outputs" -n src/backend/base/langflow/base/tools/component_tool.py

Add outputs declaration to SaveToFileComponent

The SaveToFileComponent defines a save_to_file method that returns a confirmation string, but without an explicit outputs attribute the framework won’t expose this return value for downstream components. To restore full functionality in flows, re-introduce the outputs declaration:

File: src/backend/base/langflow/components/processing/save_file.py

     ]

+    outputs = [
+        Output(
+            display_name="Confirmation",
+            name="confirmation",
+            method="save_to_file",
+        )
+    ]

     async def save_to_file(self) -> str:

This ensures the confirmation message is available as a connectable output.

🧰 Tools
🪛 Pylint (3.3.7)

[convention] 48-48: Line too long (111/100)

(C0301)


[convention] 19-19: Missing class docstring

(C0115)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3608368 and 4907798.

📒 Files selected for processing (9)
  • src/backend/base/langflow/base/data/base_file.py (3 hunks)
  • src/backend/base/langflow/components/helpers/__init__.py (0 hunks)
  • src/backend/base/langflow/components/processing/__init__.py (3 hunks)
  • src/backend/base/langflow/components/processing/save_file.py (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json (2 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (1 hunks)
  • src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (1 hunks)
💤 Files with no reviewable changes (1)
  • src/backend/base/langflow/components/helpers/init.py
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/backend/base/langflow/components/processing/save_file.py (1)
src/backend/base/langflow/inputs/inputs.py (3)
  • DropdownInput (467-491)
  • HandleInput (76-87)
  • StrInput (128-184)
src/backend/base/langflow/components/processing/__init__.py (2)
src/backend/base/langflow/components/processing/batch_run.py (1)
  • BatchRunComponent (16-204)
src/backend/base/langflow/components/processing/structured_output.py (1)
  • StructuredOutputComponent (20-183)
🔇 Additional comments (15)
src/backend/base/langflow/components/processing/__init__.py (4)

2-2: Expose BatchRunComponent in processing namespace
Adding BatchRunComponent to this package aligns the public API with the new folder structure, ensuring downstream imports continue to work after relocating it from helpers.


21-21: Expose StructuredOutputComponent in processing namespace
Including StructuredOutputComponent here completes its relocation into processing, making it available for consumers without breaking existing import patterns.


26-26: Update __all__ to include BatchRunComponent
By listing BatchRunComponent in __all__, we guarantee it’s publicly exportable when users import from this module.


45-45: Update __all__ to include StructuredOutputComponent
Adding StructuredOutputComponent to __all__ ensures it’s accessible via wildcard imports from the processing package.

src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (1)

268-272:

Details

✅ Verification successful

Align JSON config with refactored FileComponent method

The output method has been updated from load_dataframe to load_files, matching the renamed FileComponent.load_files method. This change ensures the starter project invokes the correct loader.

Please run the following to confirm no lingering load_dataframe references across all starter project JSON files:


🏁 Script executed:

#!/usr/bin/env bash
# Verify no obsolete `load_dataframe` references in starter project configs
rg -l '"method": "load_dataframe"' src/backend/base/langflow/initial_setup/starter_projects

Length of output: 93


🏁 Script executed:

#!/usr/bin/env bash
# Re-verify no obsolete `load_dataframe` references across the entire repository
rg -l '"method": "load_dataframe"'

Length of output: 36


No remaining load_dataframe references – changes approved

All starter project configs have been updated from load_dataframe to load_files, and a repository-wide search for "method": "load_dataframe" returned no matches. The JSON now correctly aligns with the refactored FileComponent.load_files method.

src/backend/base/langflow/components/processing/save_file.py (1)

12-12: Import statement updated correctly.

The import statement properly includes the required input types from langflow.io.

src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1)

807-807:

Details

✅ Verification successful

Verify method name consistency with component implementation.

The method name has been changed from "load_dataframe" to "load_files". This change should align with the actual method names in the File component implementation.

Please verify that the underlying File component has the load_files method and that this change is consistent across all starter project configurations:


🏁 Script executed:

#!/bin/bash
# Verify the File component has the load_files method
ast-grep --pattern $'class $_ {
  $$$
  def load_files($$$) {
    $$$
  }
  $$$
}'

# Check for consistency across starter projects
rg -A 2 -B 2 '"method":\s*"load_(dataframe|files)"' --type json

Length of output: 2649


🏁 Script executed:

#!/bin/bash
# Search for any existing implementations of load_dataframe or load_files in Python code
rg -n "def load_dataframe" -t py
rg -n "def load_files" -t py

# List all Python classes containing 'File' in their name to locate the File component definition
rg -n "class .*File" -t py

Length of output: 2240


load_files implementation confirmed

The load_files method is defined on BaseFileComponent (src/backend/base/langflow/base/data/base_file.py:239) and is inherited by FileComponent. All starter project JSONs now consistently reference "method": "load_files" with no remaining load_dataframe. This change aligns with the refactoring and requires no further action.

src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (1)

2423-2423:

Details

✅ Verification successful

Method name updated correctly; verify consistency across configs.

The "method": "load_files" now aligns with the renamed function in base_file.py. Please ensure there are no remaining "load_dataframe" references in any of the starter project JSON files to prevent runtime mismatches.


🏁 Script executed:

#!/bin/bash
# Verify no JSON starter project still references load_dataframe
rg -n '"load_dataframe"' src/backend/base/langflow/initial_setup/starter_projects

Length of output: 83


All starter project JSONs updated to “load_files”
Verified via search in src/backend/base/langflow/initial_setup/starter_projects—no "load_dataframe" occurrences remain. Configs now align with the renamed function in base_file.py.

src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json (1)

1859-1861: Method name updated correctly in JSON
The method field for the File component’s dataframe output was updated to "load_files" to match the refactored Python implementation.

src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json (2)

1642-1642: Verify downstream flow compatibility after removing SaveToFile outputs

The "outputs": [] entry for the Save to File node clears its confirmation output, which downstream logic or UI flows might have relied on. Please confirm that there are no edges or starter project steps expecting a SaveToFile output, and update any affected flows or documentation accordingly.


1662-1662: The embedded Python code in the "value" field remains unchanged and does not require review.

src/backend/base/langflow/base/data/base_file.py (4)

177-177: LGTM! Output method reference updated correctly.

The output method reference has been properly updated to match the renamed method, ensuring consistency between the public API declaration and the actual implementation.


228-237: Good separation of concerns with method renaming.

Renaming this method to load_files_core clarifies its role as the base file loading functionality, distinguishing it from the higher-level DataFrame processing in the new load_files method.


239-273: Excellent refactoring with improved CSV handling.

The method refactoring successfully separates concerns and adds enhanced CSV processing using pandas. The logic correctly:

  • Delegates core loading to load_files_core()
  • Processes CSV files with pandas for better data structure
  • Maintains consistent DataFrame output
  • Includes proper error handling

Consider adding memory optimization for large CSV files by using chunked reading if needed in future iterations.

🧰 Tools
🪛 Pylint (3.3.7)

[warning] 258-258: Catching too general exception Exception

(W0718)


245-245: Correct method call for the refactored architecture.

The call to load_files_core() properly utilizes the renamed core loading method, maintaining the clean separation between raw data loading and DataFrame processing.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 2, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 2, 2025
@edwinjosechittilappilly
Copy link
Copy Markdown
Collaborator

@erichare will this be conflicting with : #8233 ?

@erichare
Copy link
Copy Markdown
Collaborator Author

erichare commented Jun 2, 2025

@edwinjosechittilappilly i will have to update #8233 I’m sure, but if this looks okay I’m okay with merging it, because there’s an open question as to whether we for sure do want to remove the data frame output at all

@github-actions github-actions Bot added the bug Something isn't working label Jun 3, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35b65ad and 6351ff1.

📒 Files selected for processing (2)
  • src/backend/base/langflow/components/twelvelabs/video_file.py (3 hunks)
  • src/backend/tests/unit/components/helpers/test_batch_run_component.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/backend/tests/unit/components/helpers/test_batch_run_component.py (1)
src/backend/base/langflow/components/processing/batch_run.py (1)
  • BatchRunComponent (16-204)
🪛 Pylint (3.3.7)
src/backend/tests/unit/components/helpers/test_batch_run_component.py

[error] 4-4: Unable to import 'langflow.components.processing.batch_run'

(E0401)


[error] 4-4: No name 'components' in module 'langflow'

(E0611)

⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 7/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 10/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 5/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 9/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 8/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 3/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 6/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 2/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 4/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 1/10
  • GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (3)
src/backend/base/langflow/components/twelvelabs/video_file.py (3)

5-5: LGTM: Import addition is correct.

The addition of DataFrame to the imports is necessary for the new return type and is correctly implemented.


144-144: LGTM: Empty return statements correctly updated.

All empty return statements have been consistently updated from returning empty lists ([]) to returning empty DataFrame() instances, which aligns with the new return type annotation.

Also applies to: 152-152, 171-171, 174-174, 177-177


165-165:

Details

❓ Verification inconclusive

Verify DataFrame constructor usage.

The change from returning a list to DataFrame(data=[video_data]) needs verification to ensure the DataFrame constructor accepts the data parameter in this format.

Please run the following script to verify the DataFrame constructor usage:


🏁 Script executed:

#!/bin/bash
# Description: Verify DataFrame constructor accepts data parameter with list format
# Expected: Find DataFrame class definition and constructor parameters

ast-grep --pattern 'class DataFrame {
  $$$
  def __init__($$$) {
    $$$
  }
  $$$
}'

Length of output: 88


🏁 Script executed:

#!/bin/bash
# Inspect imports and usage of DataFrame in video_file.py
set -e

FILE="src/backend/base/langflow/components/twelvelabs/video_file.py"

echo "---- Imports related to DataFrame or pandas ----"
grep -nE "import.*(DataFrame|pandas)" -n "$FILE" || echo "No direct DataFrame/pandas import found"

echo
echo "---- Context around line 165 ----"
sed -n '150,180p' "$FILE"

Length of output: 1821


🏁 Script executed:

#!/bin/bash
set -e

# Locate DataFrame definition in schema
SCHEMA_FILE=$(grep -R "class DataFrame" -n src/backend/base/langflow/schema.py | head -n1 | cut -d: -f1)
if [[ -z "$SCHEMA_FILE" ]]; then
  echo "Error: DataFrame class not found in src/backend/base/langflow/schema.py"
  exit 1
fi

echo "DataFrame class found in: $SCHEMA_FILE"
echo
echo "---- Class definition and __init__ context ----"
CLASS_LINE=$(grep -n "class DataFrame" -n "$SCHEMA_FILE" | cut -d: -f1)
sed -n "$((CLASS_LINE-2)),$((CLASS_LINE+20))p" "$SCHEMA_FILE"

Length of output: 363


Verify external DataFrame constructor usage

The DataFrame class is imported from langflow.schema and isn’t defined locally, so we can’t confirm its signature here. Please manually verify that:

  • DataFrame.__init__ accepts a data parameter as a list of records (e.g. data=[video_data]).

Comment thread src/backend/base/langflow/components/twelvelabs/video_file.py
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/backend/tests/unit/components/processing/test_batch_run_component.py (1)

4-4: Import path updated to processing module
The import for BatchRunComponent has been updated to its new location under langflow.components.processing. This aligns the test with the refactored component structure.

Apply this diff to suppress Pylint false-positive import errors:

-from langflow.components.processing.batch_run import BatchRunComponent
+from langflow.components.processing.batch_run import BatchRunComponent  # pylint: disable=import-error,no-name-in-module
🧰 Tools
🪛 Pylint (3.3.7)

[error] 4-4: Unable to import 'langflow.components.processing.batch_run'

(E0401)


[error] 4-4: No name 'components' in module 'langflow'

(E0611)

src/backend/tests/unit/components/processing/test_structured_output_component.py (1)

8-8: Import path updated to processing module
The import for StructuredOutputComponent now correctly points to the processing package, matching the component’s new home.

To quiet Pylint’s unresolved import warnings, consider:

-from langflow.components.processing.structured_output import StructuredOutputComponent
+from langflow.components.processing.structured_output import StructuredOutputComponent  # pylint: disable=import-error,no-name-in-module
🧰 Tools
🪛 Pylint (3.3.7)

[error] 8-8: Unable to import 'langflow.components.processing.structured_output'

(E0401)


[error] 8-8: No name 'components' in module 'langflow'

(E0611)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6351ff1 and ac6dd20.

📒 Files selected for processing (2)
  • src/backend/tests/unit/components/processing/test_batch_run_component.py (1 hunks)
  • src/backend/tests/unit/components/processing/test_structured_output_component.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/backend/tests/unit/components/processing/test_batch_run_component.py (1)
src/backend/base/langflow/components/processing/batch_run.py (1)
  • BatchRunComponent (16-204)
src/backend/tests/unit/components/processing/test_structured_output_component.py (1)
src/backend/base/langflow/components/processing/structured_output.py (1)
  • StructuredOutputComponent (20-183)
🪛 Pylint (3.3.7)
src/backend/tests/unit/components/processing/test_batch_run_component.py

[error] 4-4: Unable to import 'langflow.components.processing.batch_run'

(E0401)


[error] 4-4: No name 'components' in module 'langflow'

(E0611)

src/backend/tests/unit/components/processing/test_structured_output_component.py

[error] 8-8: Unable to import 'langflow.components.processing.structured_output'

(E0401)


[error] 8-8: No name 'components' in module 'langflow'

(E0611)

⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 8/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 9/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 7/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 1/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 10/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 6/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 5/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 2/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 4/10
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 3/10
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Optimize new Python code in this PR

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
@erichare erichare added this pull request to the merge queue Jun 3, 2025
Merged via the queue into main with commit 9aaca68 Jun 3, 2025
35 checks passed
@erichare erichare deleted the fix-remove-save-file-output branch June 3, 2025 23:55
ogabrielluiz pushed a commit that referenced this pull request Jun 4, 2025
* fix: Refactor a few more components to proper folders

* Rename action for load files

* [autofix.ci] apply automated fixes

* Update tests for new naming

* Update video_file.py

* Update video_file.py

* Update video_file.py

* Update test_batch_run_component.py

* Move unit tests

* Update test_structured_output_component.py

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Yuqi Tang <yuqi.tang@datastax.com>
ogabrielluiz pushed a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
* fix: Refactor a few more components to proper folders

* Rename action for load files

* [autofix.ci] apply automated fixes

* Update tests for new naming

* Update video_file.py

* Update video_file.py

* Update video_file.py

* Update test_batch_run_component.py

* Move unit tests

* Update test_structured_output_component.py

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Yuqi Tang <yuqi.tang@datastax.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants