Skip to content

fix: Vector store output can only be dataframe #8253

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Yukiyukiyeah
Copy link
Collaborator

@Yukiyukiyeah Yukiyukiyeah commented May 28, 2025

This pull request includes changes to improve method naming, update references to a renamed class, and reformat JSON for consistency and readability. The most important changes are grouped into three themes: method renaming, class reference updates, and JSON reformatting.

Method Renaming:

  • Renamed the as_dataframe method to vector_search_results in src/backend/base/langflow/base/vectorstores/model.py to better reflect its functionality. This change also updated the corresponding output method references. [1] [2] [3]

Class Reference Updates:

  • Updated references from Component to CustomComponent in src/backend/base/langflow/custom/directory_reader/directory_reader.py to align with the renamed class. [1] [2]

JSON Reformatting:

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label May 28, 2025
@Yukiyukiyeah Yukiyukiyeah requested review from Copilot, ogabrielluiz and rodrigosnader and removed request for Copilot and ogabrielluiz May 28, 2025 16:38
@dosubot dosubot bot added the bug Something isn't working label May 28, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels May 28, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR streamlines the vector store output interface by renaming the as_dataframe method to vector_search_results, updates class references to match a rename from Component to CustomComponent, and reformats starter-project JSON files for readability.

  • Renamed as_dataframe to vector_search_results in the base and local DB vectorstore components
  • Updated imports and instantiation from Component to CustomComponent in the directory reader
  • Reformatted multi-line JSON arrays in the starter project configuration

Reviewed Changes

Copilot reviewed 4 out of 8 changed files in this pull request and generated no comments.

File Description
src/backend/base/langflow/custom/directory_reader/directory_reader.py Import and instantiation updated from Component to CustomComponent
src/backend/base/langflow/components/vectorstores/local_db.py Changed Output method reference to vector_search_results
src/backend/base/langflow/base/vectorstores/model.py Renamed as_dataframe method and adjusted the outputs list
Files not reviewed (4)
  • src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json: Language not supported
Comments suppressed due to low confidence (4)

src/backend/base/langflow/base/vectorstores/model.py:82

  • The Search Results output entry was removed from this list, which drops the raw search_documents output. If consumers still need the unformatted list, reintroduce an Output for the search_documents method.
outputs = [        Output(display_name="DataFrame", name="dataframe", method="vector_search_results"),]

src/backend/base/langflow/components/vectorstores/local_db.py:101

  • [nitpick] The display_name remains “DataFrame” while the method is vector_search_results; consider renaming the display to “Vector Search Results” to avoid confusion.
Output(display_name="DataFrame", name="dataframe", method="vector_search_results"),

src/backend/base/langflow/base/vectorstores/model.py:175

  • Ensure existing tests are updated or new tests are added to cover the renamed vector_search_results method and verify it returns the expected DataFrame structure.
def vector_search_results(self) -> DataFrame:

src/backend/base/langflow/base/vectorstores/model.py:175

  • [nitpick] Add a docstring for vector_search_results to explain that it wraps search_documents in a DataFrame and note any important behavior or edge cases.
def vector_search_results(self) -> DataFrame:

@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels May 28, 2025
@@ -7,7 +7,7 @@
from aiofile import async_open
from loguru import logger

from langflow.custom import Component
from langflow.custom import CustomComponent
Copy link
Collaborator

Choose a reason for hiding this comment

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

May I know why we should change this in this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had an error when running the backend of cannot find _get_function_entrypoint_return_type so I changed this line, not sure if we should do so

@Yukiyukiyeah Yukiyukiyeah added the DO NOT MERGE Don't Merge this PR label May 28, 2025
@Yukiyukiyeah Yukiyukiyeah marked this pull request as draft May 28, 2025 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working DO NOT MERGE Don't Merge this PR size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants