Skip to content

fix: NvidiaRanker missing /ranking path for local NIM deployments#3483

Open
SyedShahmeerAli12 wants to merge 1 commit into
deepset-ai:mainfrom
SyedShahmeerAli12:fix/nvidia-ranker-url-1457
Open

fix: NvidiaRanker missing /ranking path for local NIM deployments#3483
SyedShahmeerAli12 wants to merge 1 commit into
deepset-ai:mainfrom
SyedShahmeerAli12:fix/nvidia-ranker-url-1457

Conversation

@SyedShahmeerAli12

Copy link
Copy Markdown
Contributor

Summary

Closes #1457 - NvidiaRanker sends ranking requests to the wrong endpoint for self-hosted/local NIM deployments.

The bug:
NimBackend.rank() used self.api_url directly, while embed(), generate(), and models() all append their own endpoint suffix (/embeddings, /chat/completions, /models). Only rank() was missing its suffix.

This went unnoticed in the existing unit test because hosted ranking models get their api_url fully overridden by validate_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_url stays 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 /ranking when it did not, so both hosted models (unchanged behavior) and local/self-hosted NIM ranking deployments (the actual bug) hit the correct endpoint.

Tests:

  • Added test_rank_local_nim_appends_ranking_path exercising the non-hosted path that the original bug affected
  • Existing test_rank (hosted model with custom endpoint override) still passes unchanged
  • All 204 unit tests pass
  • mypy and ruff clean

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.
@SyedShahmeerAli12 SyedShahmeerAli12 requested a review from a team as a code owner June 22, 2026 12:19
@SyedShahmeerAli12 SyedShahmeerAli12 requested review from julian-risch and removed request for a team June 22, 2026 12:19
@github-actions

Copy link
Copy Markdown
Contributor

Heads-up for maintainers

This PR is from a fork and touches integrations whose integration tests require API keys.
Those tests are skipped in CI because fork PRs don't have access to repo secrets for security reasons.

Affected integrations:

  • nvidia

Please run the integration tests locally (hatch run test:integration inside each folder) before approving.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (nvidia)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/nvidia/src/haystack_integrations/utils/nvidia
  nim_backend.py
Project Total  

This report was generated by python-coverage-comment-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nvidia Ranker URL issue

1 participant