Skip to content

feat: quality of life improvement for pipeline building - #12427

Merged
sjrl merged 2 commits into
mainfrom
pipeline-connect-many-fluent
Aug 21, 2026
Merged

feat: quality of life improvement for pipeline building#12427
sjrl merged 2 commits into
mainfrom
pipeline-connect-many-fluent

Conversation

@sjrl

@sjrl sjrl commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Related Issues

  • fixes #issue-number

Proposed Changes:

Add Pipeline.connect_many() to connect multiple (sender, receiver) pairs in one call. Pipeline.add_component() and Pipeline.add_components() now return the pipeline, allowing pipeline-building methods to be chained.

Before

Pipeline construction requires separate calls for every component and connection:

pipeline = Pipeline()

pipeline.add_component("retriever", retriever)
pipeline.add_component("prompt_builder", prompt_builder)
pipeline.add_component("llm", llm)

pipeline.connect("retriever", "prompt_builder.documents")
pipeline.connect("prompt_builder", "llm")

After

Components and connections can be added in batches and chained fluently:

pipeline = (
    Pipeline()
    .add_components({"retriever": retriever, "prompt_builder": prompt_builder, "llm": llm})
    .connect_many([("retriever", "prompt_builder.documents"), ("prompt_builder", "llm")])
)

How did you test it?

New tests

Notes for the reviewer

The motivation was to find ways to streamline the code building experience for pipelines in Haystack and help reduce boiler plate by not needing to repeat the same function calls many times.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests and updated the docstrings.
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haystack-docs Ignored Ignored Preview Aug 21, 2026 12:51pm

Request Review

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/core/pipeline
  base.py
  pipeline.py
Project Total  

This report was generated by python-coverage-comment-action

@sjrl
sjrl marked this pull request as ready for review August 21, 2026 11:00
@sjrl
sjrl requested a review from a team as a code owner August 21, 2026 11:00
@sjrl
sjrl requested review from anakin87 and removed request for a team August 21, 2026 11:00
Comment thread haystack/core/pipeline/base.py Outdated
@sjrl
sjrl enabled auto-merge (squash) August 21, 2026 12:55
@sjrl
sjrl merged commit 491242e into main Aug 21, 2026
26 checks passed
@sjrl
sjrl deleted the pipeline-connect-many-fluent branch August 21, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants