Skip to content
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

fix: Improve path handling and type annotations in FaissVectorStoreComponent #6081

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Cristhianzl
Copy link
Member

This pull request includes several changes to the FaissVectorStoreComponent class in the src/backend/base/langflow/components/vectorstores/faiss.py file. These changes aim to improve the handling of file paths, enhance type annotations, and streamline the search functionality.

Improvements to file path handling:

  • Added a new method resolve_path to resolve paths relative to the Langflow root.
  • Updated the build_vector_store method to use the new resolve_path method and ensure the directory exists before saving the FAISS index. [1] [2]

Enhancements to type annotations:

  • Changed the return type of the search_documents method from list[Data] to List[Data] for consistency with other type annotations.

Streamlining search functionality:

  • Simplified the search_documents method by removing unnecessary logging and directly returning the search results.

#6072

…d file path handling

🐛 (faiss.py): fix issue with building vector store when persist_directory is not provided
🐛 (faiss.py): fix issue with loading FAISS index when index file does not exist
📝 (faiss.py): add type hints for search_documents method parameters and return value
📝 (faiss.py): remove unnecessary logging statements from search_documents method
@Cristhianzl Cristhianzl self-assigned this Feb 3, 2025
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 3, 2025
@github-actions github-actions bot added the bug Something isn't working label Feb 3, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Feb 3, 2025
…rectory more efficiently

🔧 (faiss.py): refactor search_documents method to handle persist_directory more efficiently
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Feb 3, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Feb 3, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant