-
Notifications
You must be signed in to change notification settings - Fork 138
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
Nvidia Ranker URL issue #1457
Comments
Hello @2-ulfhednar-2 thanks for opening this issue. I wasn't able to reproduce it with the latest version of the integration. Here is the code I used: from haystack_integrations.components.rankers.nvidia import NvidiaRanker
from haystack import Document
from haystack.utils import Secret
ranker = NvidiaRanker(
model="nvidia/nv-rerankqa-mistral-4b-v3",
api_key=Secret.from_env_var("NVIDIA_API_KEY"),
)
ranker.warm_up()
query = "What is the capital of Germany?"
documents = [
Document(content="Berlin is the capital of Germany."),
Document(content="The capital of Germany is Berlin."),
Document(content="Germany's capital is Berlin."),
]
result = ranker.run(query, documents, top_k=2)
print(result["documents"]) When I run this code after installing When I run this code after installing
|
The issue occurs with self-hosted models only and that's why my code examples above couldn't reproduce the issue. |
Describe the bug
The URL finalization for the NvidiaRanker in the NIM-Backend function rank is broken.
It doesnt fully create the link.
To Reproduce
Just run the example code provided in the ranker.py for nvidia
Describe your environment (please complete the following information):
To Fix:
Change lines 173/174 in the nim_backend.py to properly complete the URL
from:
def rank(self, query_text: str, document_texts: List[str]) -> List[Dict[str, Any]]:
url = self.api_url
To:
def rank(self, query_text: str, document_texts: List[str]) -> List[Dict[str, Any]]:
url = f"{self.api_url}/ranking"
right now the ranker.py takes the provided URL adds v1 to it and then passes it to the def rank. To properly access the endpoint usually /ranking is needed.
The text was updated successfully, but these errors were encountered: