-
Notifications
You must be signed in to change notification settings - Fork 5k
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
feat: Restructure Rerankers so both NVIDIA and Cohere work properly #5933
Open
brian-ogrady
wants to merge
9
commits into
langflow-ai:main
Choose a base branch
from
brian-ogrady:nvidia-reranker-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+94
−97
Conversation
This file contains 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
dosubot
bot
added
size:XS
This PR changes 0-9 lines, ignoring generated files.
bug
Something isn't working
labels
Jan 25, 2025
brian-ogrady
changed the title
Nvidia reranker fix
fix: Nvidia reranker remove nonexistent method
Jan 25, 2025
github-actions
bot
added
bug
Something isn't working
and removed
bug
Something isn't working
labels
Jan 25, 2025
…g Voyage AI reranker.
brian-ogrady
force-pushed
the
nvidia-reranker-fix
branch
from
January 27, 2025 05:22
5a66c86
to
2fe3d13
Compare
dosubot
bot
added
size:L
This PR changes 100-499 lines, ignoring generated files.
and removed
size:XS
This PR changes 0-9 lines, ignoring generated files.
labels
Jan 27, 2025
github-actions
bot
added
bug
Something isn't working
and removed
bug
Something isn't working
labels
Jan 27, 2025
CodSpeed Performance ReportMerging #5933 will not alter performanceComparing Summary
|
brian-ogrady
changed the title
fix: Nvidia reranker remove nonexistent method
feat: Restructure Rerankers and add VoyageAI Reranker Component
Jan 27, 2025
github-actions
bot
added
enhancement
New feature or request
and removed
bug
Something isn't working
enhancement
New feature or request
labels
Jan 27, 2025
brian-ogrady
force-pushed
the
nvidia-reranker-fix
branch
from
January 27, 2025 16:03
d939f0e
to
99cfd4b
Compare
github-actions
bot
added
enhancement
New feature or request
and removed
enhancement
New feature or request
labels
Jan 27, 2025
github-actions
bot
added
enhancement
New feature or request
and removed
enhancement
New feature or request
labels
Jan 28, 2025
github-actions
bot
added
enhancement
New feature or request
and removed
enhancement
New feature or request
labels
Jan 28, 2025
github-actions
bot
added
enhancement
New feature or request
and removed
enhancement
New feature or request
labels
Jan 28, 2025
github-actions
bot
added
enhancement
New feature or request
and removed
enhancement
New feature or request
labels
Jan 30, 2025
ogabrielluiz
approved these changes
Jan 31, 2025
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.
Hey @brian-ogrady
I added a DataFrame output. LGTM
github-actions
bot
added
enhancement
New feature or request
and removed
enhancement
New feature or request
labels
Jan 31, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
lgtm
This PR has been approved by a maintainer
size:L
This PR changes 100-499 lines, ignoring generated files.
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.
Motivation
This PR initially began as a small error that went unnoticed in the prior PR for the NVIDIA reranker component that only surfaces when using the default API url. Upon dropping the component into a flow it generates an error. This is due to a method name change
build_model
->build_reranker
. This PR resolves the issue detailed here and expands its scope to ensure the Cohere reranker component also functions properly and is no longer marked as legacy, detailed in this issue here.Further Context
The Cohere & NVIDIA rerankers were marked as legacy because we wanted to deprecate retrievers and both components had relied on the
ContextualCompressionRetriever
abstraction from LangChain. This particular abstraction is redundant in LangFlow because simply performs similarity search on a vector store and then reranks the resulting documents using the provided reranker (referred to as a compressor in LC documentation). Because we have the search results coming directly fromVectorStore
components we can instead pass the results directly into the reranker without this abstracted class.New Features
This PR adds a new component called the
LCCompressorComponent
(standing for LangChain Compressor Component) which is a base class for reranker components. Common attributes of the rerankers are abstracted away into this class, leaving thebuild_compressor
abstract method to be implemented by the child class. This requires sourcingBaseDocumentCompressor
fromlangchain_core.documents.compressors
but otherwise is a fairly lightweight class and is even an improvement because the previous implementation of rerankers were inaccurately subclassed fromLCVectorStoreComponent
.