nvidia-haystack 3.0.0__tar.gz → 3.0.2__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 (37) hide show
  1. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/CHANGELOG.md +14 -0
  2. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/PKG-INFO +1 -1
  3. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/rankers/nvidia/ranker.py +3 -5
  4. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/test_ranker.py +39 -1
  5. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/.gitignore +0 -0
  6. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/LICENSE.txt +0 -0
  7. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/README.md +0 -0
  8. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/examples/chat_generator_with_structured_outputs.py +0 -0
  9. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/pydoc/config_docusaurus.yml +0 -0
  10. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/pyproject.toml +0 -0
  11. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/embedders/nvidia/__init__.py +0 -0
  12. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/embedders/nvidia/document_embedder.py +0 -0
  13. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/embedders/nvidia/text_embedder.py +0 -0
  14. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/embedders/nvidia/truncate.py +0 -0
  15. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/embedders/py.typed +0 -0
  16. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/generators/nvidia/__init__.py +0 -0
  17. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/generators/nvidia/chat/__init__.py +0 -0
  18. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/generators/nvidia/chat/chat_generator.py +0 -0
  19. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/generators/py.typed +0 -0
  20. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/rankers/nvidia/__init__.py +0 -0
  21. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/rankers/nvidia/truncate.py +0 -0
  22. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/components/rankers/py.typed +0 -0
  23. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/utils/nvidia/__init__.py +0 -0
  24. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/utils/nvidia/client.py +0 -0
  25. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/utils/nvidia/models.py +0 -0
  26. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/utils/nvidia/nim_backend.py +0 -0
  27. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/utils/nvidia/utils.py +0 -0
  28. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/src/haystack_integrations/utils/py.typed +0 -0
  29. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/__init__.py +0 -0
  30. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/conftest.py +0 -0
  31. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/test_base_url.py +0 -0
  32. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/test_document_embedder.py +0 -0
  33. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/test_embedding_truncate_mode.py +0 -0
  34. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/test_nim_backend.py +0 -0
  35. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/test_nvidia_chat_generator.py +0 -0
  36. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/test_text_embedder.py +0 -0
  37. {nvidia_haystack-3.0.0 → nvidia_haystack-3.0.2}/tests/test_utils.py +0 -0
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [integrations/nvidia-v3.0.1] - 2026-11-17
4
+
5
+
6
+ ## [integrations/nvidia-v3.0.0] - 2026-10-16
7
+
8
+ ### 🚜 Refactor
9
+
10
+ - [**breaking**] Remove from_dict overrides that only call default_from_dict from 14 components (#4059)
11
+
12
+ ### 🧹 Chores
13
+
14
+ - [**breaking**] Drop Python 3.10 support (#4105)
15
+
16
+
3
17
  ## [integrations/nvidia-v2.0.0] - 2026-09-08
4
18
 
5
19
  ### 🚀 Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: nvidia-haystack
3
- Version: 3.0.0
3
+ Version: 3.0.2
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
@@ -75,7 +75,7 @@ class NvidiaRanker:
75
75
  A string to add at the beginning of each document before ranking. You can use it to prepend the document
76
76
  with an instruction, as required by embedding models like `bge`.
77
77
  :param meta_fields_to_embed:
78
- List of metadata fields to embed with the document.
78
+ List of metadata fields to embed with the document. Missing fields and `None` values are skipped.
79
79
  :param embedding_separator:
80
80
  Separator to concatenate metadata fields to the document.
81
81
  :param timeout:
@@ -134,7 +134,7 @@ class NvidiaRanker:
134
134
  self,
135
135
  model=self.model,
136
136
  top_k=self.top_k,
137
- truncate=self.truncate,
137
+ truncate=str(self.truncate) if self.truncate is not None else None,
138
138
  api_url=self.api_url,
139
139
  api_key=self.api_key.to_dict() if self.api_key else None,
140
140
  query_prefix=self.query_prefix,
@@ -178,9 +178,7 @@ class NvidiaRanker:
178
178
  document_texts = []
179
179
  for doc in documents:
180
180
  meta_values_to_embed = [
181
- str(doc.meta[key])
182
- for key in self.meta_fields_to_embed
183
- if key in doc.meta and doc.meta[key] # noqa: RUF019
181
+ str(doc.meta[key]) for key in self.meta_fields_to_embed if key in doc.meta and doc.meta[key] is not None
184
182
  ]
185
183
  text_to_embed = self.embedding_separator.join([*meta_values_to_embed, doc.content or ""])
186
184
  document_texts.append(self.document_prefix + text_to_embed)
@@ -8,7 +8,7 @@ from typing import Any
8
8
  from unittest.mock import patch
9
9
 
10
10
  import pytest
11
- from haystack import Document
11
+ from haystack import Document, Pipeline
12
12
  from haystack.core.serialization import component_from_dict
13
13
  from haystack.utils import Secret
14
14
 
@@ -63,6 +63,18 @@ class TestSerialization:
63
63
  },
64
64
  }
65
65
 
66
+ def test_to_dict_with_truncate(self) -> None:
67
+ client = NvidiaRanker(truncate="END")
68
+ data = client.to_dict()
69
+ assert data["init_parameters"]["truncate"] == "END"
70
+ assert type(data["init_parameters"]["truncate"]) is str
71
+
72
+ def test_pipeline_yaml_roundtrip_with_truncate(self) -> None:
73
+ pipeline = Pipeline()
74
+ pipeline.add_component("ranker", NvidiaRanker(truncate=RankerTruncateMode.END))
75
+ loaded = Pipeline.loads(pipeline.dumps())
76
+ assert loaded.get_component("ranker").truncate == RankerTruncateMode.END
77
+
66
78
  def test_from_dict(self) -> None:
67
79
  client = component_from_dict(
68
80
  NvidiaRanker,
@@ -132,6 +144,32 @@ class TestComponentLifecycle:
132
144
 
133
145
 
134
146
  class TestRun:
147
+ @pytest.mark.parametrize(
148
+ ("metadata", "expected_text"),
149
+ [
150
+ ({"value": 0}, "0 | document"),
151
+ ({"value": 0.0}, "0.0 | document"),
152
+ ({"value": False}, "False | document"),
153
+ ({"value": ""}, " | document"),
154
+ ({"value": "value"}, "value | document"),
155
+ ({"value": None}, "document"),
156
+ ({}, "document"),
157
+ ],
158
+ )
159
+ def test_metadata_in_ranking_request(self, requests_mock, metadata, expected_text):
160
+ requests_mock.post(re.compile(r".*ranking"), json={"rankings": [{"index": 0, "logit": 1.0}]})
161
+ ranker = NvidiaRanker(
162
+ model=_DEFAULT_MODEL,
163
+ api_key=Secret.from_token("fake-api-key"),
164
+ meta_fields_to_embed=["value"],
165
+ embedding_separator=" | ",
166
+ document_prefix="passage: ",
167
+ )
168
+
169
+ ranker.run(query="query", documents=[Document(content="document", meta=metadata)])
170
+
171
+ assert requests_mock.last_request.json()["passages"] == [{"text": f"passage: {expected_text}"}]
172
+
135
173
  @pytest.mark.parametrize(
136
174
  "truncate",
137
175
  [