-
Notifications
You must be signed in to change notification settings - Fork 7k
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
base: main
Are you sure you want to change the base?
Conversation
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.
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
tovector_search_results
in the base and local DB vectorstore components - Updated imports and instantiation from
Component
toCustomComponent
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 anOutput
for thesearch_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 isvector_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 wrapssearch_documents
in a DataFrame and note any important behavior or edge cases.
def vector_search_results(self) -> DataFrame:
@@ -7,7 +7,7 @@ | |||
from aiofile import async_open | |||
from loguru import logger | |||
|
|||
from langflow.custom import Component | |||
from langflow.custom import CustomComponent |
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.
May I know why we should change this in this PR?
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.
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
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:
as_dataframe
method tovector_search_results
insrc/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:
Component
toCustomComponent
insrc/backend/base/langflow/custom/directory_reader/directory_reader.py
to align with the renamed class. [1] [2]JSON Reformatting:
Document Q&A.json
file insrc/backend/base/langflow/initial_setup/starter_projects
to use multi-line arrays foroutput_types
,inputTypes
, and other similar fields, improving readability and consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27]