Skip to content

Commit 223373e

Browse files
authored
fix: Document Classifiers - fix error messages (#8765)
* fix: Document Classifiers - fix docstrings + error messages * grammar * fix
1 parent 3119ae1 commit 223373e

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

haystack/components/classifiers/document_language_classifier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def run(self, documents: List[Document]):
8383
if not isinstance(documents, list) or documents and not isinstance(documents[0], Document):
8484
raise TypeError(
8585
"DocumentLanguageClassifier expects a list of Document as input. "
86-
"In case you want to classify a text, please use the TextLanguageClassifier."
86+
"In case you want to classify and route a text, please use the TextLanguageRouter."
8787
)
8888

8989
output: Dict[str, List[Document]] = {language: [] for language in self.languages}

haystack/components/classifiers/zero_shot_document_classifier.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ def run(self, documents: List[Document], batch_size: int = 1):
211211

212212
if not isinstance(documents, list) or documents and not isinstance(documents[0], Document):
213213
raise TypeError(
214-
"DocumentLanguageClassifier expects a list of documents as input. "
215-
"In case you want to classify a text, please use the TextLanguageClassifier."
214+
"TransformerZeroShotDocumentClassifier expects a list of documents as input. "
215+
"In case you want to classify and route a text, please use the TransformersZeroShotTextRouter."
216216
)
217217

218218
invalid_doc_ids = []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Fix error messages for Document Classifier components, that suggested using nonexistent components for text
5+
classification.

0 commit comments

Comments
 (0)