Skip to content

Commit faab36e

Browse files
committed
Updates
1 parent 8c90f9d commit faab36e

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

integrations/nvidia/src/haystack_integrations/components/embedders/nvidia/document_embedder.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,12 @@ def run(self, documents: list[Document]) -> dict[str, Union[list[Document], dict
247247
A dictionary with the following keys and values:
248248
- `documents` - List of processed Documents with embeddings.
249249
- `meta` - Metadata on usage statistics, etc.
250-
:raises RuntimeError:
251-
If the component was not initialized.
252250
:raises TypeError:
253251
If the input is not a string.
254252
"""
255253
if not self._initialized:
256-
msg = "The embedding model has not been loaded. Please call warm_up() before running."
257-
raise RuntimeError(msg)
254+
self.warm_up()
255+
258256
elif not isinstance(documents, list) or (documents and not isinstance(documents[0], Document)):
259257
msg = (
260258
"NvidiaDocumentEmbedder expects a list of Documents as input."

integrations/nvidia/src/haystack_integrations/components/embedders/nvidia/text_embedder.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,14 @@ def run(self, text: str) -> dict[str, Union[list[float], dict[str, Any]]]:
197197
A dictionary with the following keys and values:
198198
- `embedding` - Embedding of the text.
199199
- `meta` - Metadata on usage statistics, etc.
200-
:raises RuntimeError:
201-
If the component was not initialized.
202200
:raises TypeError:
203201
If the input is not a string.
202+
:raises ValueError:
203+
If the input string is empty.
204204
"""
205205
if not self._initialized:
206-
msg = "The embedding model has not been loaded. Please call warm_up() before running."
207-
raise RuntimeError(msg)
206+
self.warm_up()
207+
208208
elif not isinstance(text, str):
209209
msg = (
210210
"NvidiaTextEmbedder expects a string as an input."

0 commit comments

Comments
 (0)