diff --git a/haystack/core/pipeline/async_pipeline.py b/haystack/core/pipeline/async_pipeline.py index 17cc6d6d0..bafa2c79b 100644 --- a/haystack/core/pipeline/async_pipeline.py +++ b/haystack/core/pipeline/async_pipeline.py @@ -198,7 +198,7 @@ class AsyncPipeline(PipelineBase): prepared_data = self._prepare_component_input_data(data) # raises ValueError if input is malformed in some way - self._validate_input(prepared_data) + self.validate_input(prepared_data) inputs_state = self._convert_to_internal_format(prepared_data) # For quick lookup of downstream receivers diff --git a/haystack/core/pipeline/base.py b/haystack/core/pipeline/base.py index a44cb5f72..078eb8513 100644 --- a/haystack/core/pipeline/base.py +++ b/haystack/core/pipeline/base.py @@ -899,7 +899,7 @@ class PipelineBase: parent_span=parent_span, ) - def _validate_input(self, data: Dict[str, Any]) -> None: + def validate_input(self, data: Dict[str, Any]) -> None: """ Validates pipeline input data. diff --git a/haystack/core/pipeline/pipeline.py b/haystack/core/pipeline/pipeline.py index 2b4cc29b4..3c3c34734 100644 --- a/haystack/core/pipeline/pipeline.py +++ b/haystack/core/pipeline/pipeline.py @@ -172,7 +172,7 @@ class Pipeline(PipelineBase): data = self._prepare_component_input_data(data) # Raise ValueError if input is malformed in some way - self._validate_input(data) + self.validate_input(data) if include_outputs_from is None: include_outputs_from = set() diff --git a/releasenotes/notes/make-validate-input-public-e547ef5b75069bd7.yaml b/releasenotes/notes/make-validate-input-public-e547ef5b75069bd7.yaml new file mode 100644 index 000000000..df27c852b --- /dev/null +++ b/releasenotes/notes/make-validate-input-public-e547ef5b75069bd7.yaml @@ -0,0 +1,6 @@ +--- +enhancements: + - | + Make the PipelineBase().validate_input method public so users can use it with the confidence that it won't receive breaking changes without warning. + This method is useful for checking that all required connections in a pipeline have a connection and is automatically called in the run method of Pipeline. + It is being exposed as public for users who would like to call this method before runtime to validate the pipeline.