nvidia-haystack 1.3.0__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/CHANGELOG.md +18 -0
  2. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/PKG-INFO +1 -1
  3. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/rankers/nvidia/ranker.py +10 -8
  4. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_ranker.py +15 -8
  5. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/.gitignore +0 -0
  6. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/LICENSE.txt +0 -0
  7. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/README.md +0 -0
  8. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/examples/chat_generator_with_structured_outputs.py +0 -0
  9. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/pydoc/config_docusaurus.yml +0 -0
  10. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/pyproject.toml +0 -0
  11. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/embedders/nvidia/__init__.py +0 -0
  12. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/embedders/nvidia/document_embedder.py +0 -0
  13. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/embedders/nvidia/text_embedder.py +0 -0
  14. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/embedders/nvidia/truncate.py +0 -0
  15. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/embedders/py.typed +0 -0
  16. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/generators/nvidia/__init__.py +0 -0
  17. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/generators/nvidia/chat/__init__.py +0 -0
  18. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/generators/nvidia/chat/chat_generator.py +0 -0
  19. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/generators/nvidia/generator.py +0 -0
  20. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/generators/py.typed +0 -0
  21. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/rankers/nvidia/__init__.py +0 -0
  22. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/rankers/nvidia/truncate.py +0 -0
  23. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/components/rankers/py.typed +0 -0
  24. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/utils/nvidia/__init__.py +0 -0
  25. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/utils/nvidia/client.py +0 -0
  26. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/utils/nvidia/models.py +0 -0
  27. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/utils/nvidia/nim_backend.py +0 -0
  28. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/utils/nvidia/utils.py +0 -0
  29. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/src/haystack_integrations/utils/py.typed +0 -0
  30. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/__init__.py +0 -0
  31. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/conftest.py +0 -0
  32. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_base_url.py +0 -0
  33. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_document_embedder.py +0 -0
  34. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_embedding_truncate_mode.py +0 -0
  35. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_generator.py +0 -0
  36. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_nim_backend.py +0 -0
  37. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_nvidia_chat_generator.py +0 -0
  38. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_text_embedder.py +0 -0
  39. {nvidia_haystack-1.3.0 → nvidia_haystack-1.4.0}/tests/test_utils.py +0 -0
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [integrations/nvidia-v1.3.0] - 2026-08-04
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - Support Haystack 3.0's lazy OpenAI client initialization in OpenAI-inheriting generators (#3536)
8
+ - Fix new issues raised by ruff 0.16.0 (#3670)
9
+ - Fix Nvidia NimBackend type error (#3719)
10
+ - NvidiaRanker missing /ranking path for local NIM deployments (#3483)
11
+
12
+ ### 🧪 Testing
13
+
14
+ - Trust test modules under Haystack 3.0's deserialization allowlist (#3537)
15
+
16
+ ### 🧹 Chores
17
+
18
+ - Improve consistency of integrations folder structure (#3430)
19
+
20
+
3
21
  ## [integrations/nvidia-v1.2.0] - 2026-06-05
4
22
 
5
23
  ### 🧹 Chores
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nvidia-haystack
3
- Version: 1.3.0
3
+ Version: 1.4.0
4
4
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/nvidia#readme
5
5
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
6
6
  Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/nvidia
@@ -3,18 +3,15 @@
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
5
5
  import os
6
- import warnings
7
6
  from dataclasses import replace
8
7
  from typing import Any
9
8
 
10
- from haystack import Document, component, default_from_dict, default_to_dict, logging
9
+ from haystack import Document, component, default_from_dict, default_to_dict
11
10
  from haystack.utils import Secret, deserialize_secrets_inplace
12
11
 
13
12
  from haystack_integrations.components.rankers.nvidia.truncate import RankerTruncateMode
14
13
  from haystack_integrations.utils.nvidia import DEFAULT_API_URL, Client, NimBackend, is_hosted, url_validation
15
14
 
16
- logger = logging.getLogger(__name__)
17
-
18
15
 
19
16
  @component
20
17
  class NvidiaRanker:
@@ -84,6 +81,8 @@ class NvidiaRanker:
84
81
  :param timeout:
85
82
  Timeout for request calls, if not set it is inferred from the `NVIDIA_TIMEOUT` environment variable
86
83
  or set to 60 by default.
84
+
85
+ :raises ValueError: If `top_k` is not > 0.
87
86
  """
88
87
  if model is not None and not isinstance(model, str):
89
88
  msg = "Ranker expects the `model` parameter to be a string."
@@ -96,6 +95,9 @@ class NvidiaRanker:
96
95
  if not isinstance(top_k, int):
97
96
  msg = "Ranker expects the `top_k` parameter to be an integer."
98
97
  raise TypeError(msg)
98
+ if top_k <= 0:
99
+ msg = f"top_k must be > 0, but got {top_k}"
100
+ raise ValueError(msg)
99
101
 
100
102
  # todo: detect default in non-hosted case (when api_url is provided)
101
103
  self.truncate = truncate
@@ -202,6 +204,7 @@ class NvidiaRanker:
202
204
  :param top_k: The number of documents to return.
203
205
 
204
206
  :raises TypeError: If the arguments are of the wrong type.
207
+ :raises ValueError: If `top_k` is not > 0.
205
208
 
206
209
  :returns: A dictionary containing the ranked documents.
207
210
  """
@@ -224,11 +227,10 @@ class NvidiaRanker:
224
227
  if len(documents) == 0:
225
228
  return {"documents": []}
226
229
 
230
+ if top_k is not None and top_k <= 0:
231
+ msg = f"top_k must be > 0, but got {top_k}"
232
+ raise ValueError(msg)
227
233
  top_k = top_k if top_k is not None else self.top_k
228
- if top_k < 1:
229
- logger.warning("top_k should be at least 1, returning nothing")
230
- warnings.warn("top_k should be at least 1, returning nothing", stacklevel=2)
231
- return {"documents": []}
232
234
 
233
235
  assert self.backend is not None
234
236
 
@@ -221,20 +221,27 @@ class TestNvidiaRanker:
221
221
  assert len(response) == 2
222
222
  assert {response[0].content, response[1].content} == {documents[0].content, documents[1].content}
223
223
 
224
- def test_top_k_warn(self, monkeypatch) -> None:
224
+ @pytest.mark.parametrize("top_k", [0, -1])
225
+ def test_top_k_init_invalid(self, monkeypatch, top_k: int) -> None:
225
226
  monkeypatch.setenv("NVIDIA_API_KEY", "fake-api-key")
227
+ with pytest.raises(ValueError, match=rf"top_k must be > 0, but got {top_k}"):
228
+ NvidiaRanker(top_k=top_k)
226
229
 
227
- client = NvidiaRanker(top_k=0)
230
+ @pytest.mark.parametrize("top_k", [0, -1])
231
+ def test_top_k_run_invalid(self, monkeypatch, top_k: int) -> None:
232
+ monkeypatch.setenv("NVIDIA_API_KEY", "fake-api-key")
233
+ client = NvidiaRanker()
228
234
  client.warm_up()
229
- with pytest.warns(UserWarning) as record0:
230
- client.run("query", [Document(content="doc")])
231
- assert "top_k should be at least 1" in str(record0[0].message)
235
+ with pytest.raises(ValueError, match=rf"top_k must be > 0, but got {top_k}"):
236
+ client.run("query", [Document(content="doc")], top_k=top_k)
232
237
 
233
- client = NvidiaRanker(top_k=1)
238
+ def test_top_k_zero_at_run_does_not_fall_back_to_instance_top_k(self, monkeypatch) -> None:
239
+ # a runtime top_k=0 must raise, not silently fall back to the instance top_k
240
+ monkeypatch.setenv("NVIDIA_API_KEY", "fake-api-key")
241
+ client = NvidiaRanker(top_k=5)
234
242
  client.warm_up()
235
- with pytest.warns(UserWarning) as record1:
243
+ with pytest.raises(ValueError, match=r"top_k must be > 0, but got 0"):
236
244
  client.run("query", [Document(content="doc")], top_k=0)
237
- assert "top_k should be at least 1" in str(record1[0].message)
238
245
 
239
246
  def test_model_typeerror(self) -> None:
240
247
  with pytest.raises(TypeError) as e: