Skip to content

Commit

Permalink
Add RuntimeError message
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrl committed Dec 17, 2024
1 parent 649a2dc commit 7da512e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions haystack/components/preprocessors/nltk_document_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ def run(self, documents: List[Document]) -> Dict[str, List[Document]]:
:raises TypeError: if the input is not a list of Documents.
:raises ValueError: if the content of a document is None.
"""
if self.sentence_splitter is None:
raise RuntimeError(
"The component NLTKDocumentSplitter wasn't warmed up. Run 'warm_up()' before calling 'run()'."
)

if not isinstance(documents, list) or (documents and not isinstance(documents[0], Document)):
raise TypeError("DocumentSplitter expects a List of Documents as input.")

Expand Down

0 comments on commit 7da512e

Please sign in to comment.