Skip to content

Commit

Permalink
fix: Document Classifiers - fix error messages (#8765)
Browse files Browse the repository at this point in the history
* fix: Document Classifiers - fix docstrings + error messages

* grammar

* fix
  • Loading branch information
anakin87 authored Jan 24, 2025
1 parent 3119ae1 commit 223373e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def run(self, documents: List[Document]):
if not isinstance(documents, list) or documents and not isinstance(documents[0], Document):
raise TypeError(
"DocumentLanguageClassifier expects a list of Document as input. "
"In case you want to classify a text, please use the TextLanguageClassifier."
"In case you want to classify and route a text, please use the TextLanguageRouter."
)

output: Dict[str, List[Document]] = {language: [] for language in self.languages}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def run(self, documents: List[Document], batch_size: int = 1):

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

invalid_doc_ids = []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Fix error messages for Document Classifier components, that suggested using nonexistent components for text
classification.

0 comments on commit 223373e

Please sign in to comment.