Skip to content

Conversation

@mpangrazzi
Copy link
Contributor

When you have something like:

from haystack import Pipeline
from hayhooks import BasePipelineWrapper


class PipelineWrapper(BasePipelineWrapper):
    def setup(self):
        self.pipeline = Pipeline()

    def run_api(self, test_param: str):
        return f"Dummy result with {test_param}"

So no defined return type for run_api. Currently this is unhandled in Hayhooks (deploy fails since it cannot dynamically create a response model).

The idea is instead to return an error with this message: Pipeline wrapper is missing a return type for 'run_api' method.

Note that in FastAPI it's not mandatory to have a Pydantic model for response, but generally it's highly recommended and will improve DX and docs.

@mpangrazzi mpangrazzi requested a review from vblagoje August 19, 2025 08:32
Copy link
Member

@vblagoje vblagoje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mpangrazzi mpangrazzi merged commit 1d6e2b7 into main Aug 21, 2025
4 checks passed
@mpangrazzi mpangrazzi deleted the handle-missing-return-type branch August 21, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants