Skip to content

component implementation #6799

Discussion options

You must be logged in to vote

We didn't want to use inheritance too much in Haystack 2.x to avoid creating a huge inheritance tree like we had in Haystack 1.x.

There are some benefits that make the code easier to understand too.
As of now @component doesn't take any arguments but in the future it will, so we write something like this.

@component(greedy=True)
class MyComponent:
    ...

This makes it clear right away that is something related to the Haystack logic of the Component and/or Pipeline. Using inheritance you'd have to set that either in the class definition or in __init__, that might not made it clear to maintainers what is it about.

Same thing can be said for the @component.input_types() decorator and compo…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@maxjeblick
Comment options

Answer selected by maxjeblick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants