fix: Better error messages for OCR requirement (#3767) (#3900)

Add pip install requirement in the error message for missing depency.
This commit is contained in:
Balamurugan Periyasamy 2023-02-22 19:27:28 +05:30 committed by GitHub
parent 32b2abf9d5
commit 49ed21b82d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,7 +121,12 @@ class BaseComponent(ABC):
@classmethod
def get_subclass(cls, component_type: str) -> Type[BaseComponent]:
if component_type not in cls._subclasses.keys():
raise PipelineSchemaError(f"Haystack component with the name '{component_type}' not found.")
raise PipelineSchemaError(
f"Haystack component with the name '{component_type}' not found. "
"Check the class name of your component for spelling mistakes and make sure you installed "
"Haystack with the proper extras: https://docs.haystack.deepset.ai/docs/installation#custom-installation"
)
subclass = cls._subclasses[component_type]
return subclass