fix: NvidiaRanker missing /ranking path for local NIM deployments#3483
Open
SyedShahmeerAli12 wants to merge 1 commit into
Open
fix: NvidiaRanker missing /ranking path for local NIM deployments#3483SyedShahmeerAli12 wants to merge 1 commit into
SyedShahmeerAli12 wants to merge 1 commit into
Conversation
Closes deepset-ai#1457 NimBackend.rank() used `self.api_url` directly while embed(), generate(), and models() all append their own endpoint suffix. For hosted ranking models this went unnoticed because validate_hosted_model() already overrides api_url with a model-specific endpoint that includes the full path (e.g. .../nv-rerankqa-mistral-4b-v3/reranking). For self-hosted or local NIM ranking containers, where no such override applies, requests were sent to the bare base URL instead of {api_url}/ranking. Track whether the hosted override already supplied a full ranking path and only append /ranking when it did not, so both hosted and local deployments hit the correct endpoint.
Contributor
|
Heads-up for maintainers This PR is from a fork and touches integrations whose integration tests require API keys. Affected integrations:
Please run the integration tests locally ( |
Contributor
Coverage report (nvidia)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
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.
Summary
Closes #1457 -
NvidiaRankersends ranking requests to the wrong endpoint for self-hosted/local NIM deployments.The bug:
NimBackend.rank()usedself.api_urldirectly, whileembed(),generate(), andmodels()all append their own endpoint suffix (/embeddings,/chat/completions,/models). Onlyrank()was missing its suffix.This went unnoticed in the existing unit test because hosted ranking models get their
api_urlfully overridden byvalidate_hosted_model()to a model-specific endpoint that already includes the complete path (e.g..../nv-rerankqa-mistral-4b-v3/reranking). For self-hosted or local NIM ranking containers - where no model-specific override applies -self.api_urlstays as the bare base URL (e.g.http://localhost:8000/v1), so requests were sent to the wrong endpoint instead of{api_url}/ranking.The fix:
Track whether the hosted override already supplied a full ranking path (
_has_custom_ranking_endpoint). Only append/rankingwhen it did not, so both hosted models (unchanged behavior) and local/self-hosted NIM ranking deployments (the actual bug) hit the correct endpoint.Tests:
test_rank_local_nim_appends_ranking_pathexercising the non-hosted path that the original bug affectedtest_rank(hosted model with custom endpoint override) still passes unchangedmypyandruffclean