fix: handle missing FAISS index gracefully instead of crashing#318
Open
Mimi-pan wants to merge 3 commits intojenkinsci:mainfrom
Open
fix: handle missing FAISS index gracefully instead of crashing#318Mimi-pan wants to merge 3 commits intojenkinsci:mainfrom
Mimi-pan wants to merge 3 commits intojenkinsci:mainfrom
Conversation
Contributor
|
Could you please run the linter in your local before pushing it here? |
|
hey this is a good pr . |
Author
|
Glad to hear that it worked! Thank you for the confirmation and the feedback. |
Author
|
@berviantoleo Hi! I've fixed the pylint issues as requested. All CI checks are passing now. Could you please take another look? 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #312
On a fresh setup without running
make build-data, the FAISS index does not exist yet. The chatbot would crash with a 500 error instead of returning a helpful response.This PR adds a graceful fallback by checking whether the index file exists before attempting to load it, and returns a clear warning message when it is unavailable.
Files changed:
vectorstore_utils.py— added existence check before loading FAISS indexretriever_utils.py— return empty results when index or metadata is unavailabletest_vectorstore_utils.py— updated tests to reflect new behavior