SuperComponent drops Variadic and GreedyVariadic socket semantics from wrapped pipelines
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #13992 @Cyber-Marty による — マージされずにクローズ
評価
この issue はまだ評価されていません。
説明
Describe the bug
Wrapping a pipeline whose exposed entry socket is Variadic[T] or GreedyVariadic[T] (for example DocumentJoiner, StringJoiner, or BranchJoiner) inside SuperComponent strips the variadic annotation from the outer SuperComponent input socket.
As a result:
- Connecting two or more upstream components to a
SuperComponent-wrappedStringJoinerorBranchJoinerraisesPipelineConnectErrorbecause the outer socket is exposed asstrinstead ofVariadic[str]orGreedyVariadic[str]. - Connecting two upstream
list[Document]producers to aSuperComponent-wrappedDocumentJoinerauto-promotes the outerlist[Document]socket withwrap_input_in_list=False, flattening incoming document lists before passing them toSuperComponent.run(). That causesDocumentJoiner(join_mode="merge", weights=[0.7, 0.3])to crash withzip() argument 2 is longer than argument 1, and silently corruptsjoin_mode="reciprocal_rank_fusion"scores (producing1.98387...instead of1.0). - Calling
sc.run(documents=[[d_a], [d_b]])directly double-wraps the input insideself.pipeline.run(), raisingPipelineRuntimeError: 'list' object has no attribute 'id'.
Error message
haystack.core.errors.PipelineRuntimeError: The following component failed to run:
Component name: 'joiner'
Component type: 'DocumentJoiner'
Error: zip() argument 2 is longer than argument 1
And on direct sc.run(documents=[[d_a], [d_b]]):
haystack.core.errors.PipelineRuntimeError: The following component failed to run:
Component name: 'joiner'
Component type: 'DocumentJoiner'
Error: 'list' object has no attribute 'id'
And on StringJoiner / BranchJoiner fan-in:
haystack.core.errors.PipelineConnectError: Component 'sc' cannot accept multiple inputs to 'texts'. It is already connected to component 'a', and it can only accept inputs from multiple senders if its type is list, Optional[list], or union of list types.
Expected behavior
- When all inner sockets mapped to a
SuperComponentinput share a declaredVariadic[T]orGreedyVariadic[T]contract, the exposedSuperComponentsocket preservesVariadic[T]orGreedyVariadic[T]. - Multi-sender outer pipeline runs and direct
SuperComponent.run()/run_async()calls forward variadic items to the inner pipeline without flattening or double-wrapping, matching directDocumentJoiner/StringJoiner/BranchJoinerbehavior.
Additional context
haystack/core/super_component/utils.py already includes _is_variadic_type and _unwrap_variadics, but _SuperComponent._resolve_input_types_from_mapping inspects self.pipeline.inputs(), which exposes InputSocket.type after InputSocket.__post_init__ has already stripped Variadic / GreedyVariadic into is_lazy_variadic / is_greedy flags.
To Reproduce
from haystack import Document, Pipeline, SuperComponent, component
from haystack.components.joiners import BranchJoiner, DocumentJoiner, StringJoiner
@component
class DocSource:
def __init__(self, docs: list[Document]) -> None:
self._docs = docs
@component.output_types(documents=list[Document])
def run(self) -> dict[str, list[Document]]:
return {"documents": self._docs}
d_a = Document(id="shared", content="doc", score=0.9)
d_b = Document(id="shared", content="doc", score=0.4)
inner = Pipeline()
inner.add_component("joiner", DocumentJoiner(join_mode="merge", weights=[0.7, 0.3]))
sc = SuperComponent(inner)
# 1. Outer multi-branch fan-in crashes DocumentJoiner merge
outer = Pipeline()
outer.add_component("s1", DocSource([d_a]))
outer.add_component("s2", DocSource([d_b]))
outer.add_component("sc", sc)
outer.connect("s1.documents", "sc.documents")
outer.connect("s2.documents", "sc.documents")
outer.run({}) # PipelineRuntimeError: zip() argument 2 is longer than argument 1
# 2. Direct SuperComponent call double-wraps [[d_a], [d_b]]
sc.run(documents=[[d_a], [d_b]]) # PipelineRuntimeError: 'list' object has no attribute 'id'
FAQ Check
- Have you had a look at our new FAQ page?
System:
- OS: Windows 11 (reproduced on Python 3.12)
- Haystack version:
main(979c6fd)
👋 Hello there! This issue will be handled internally and isn't open for external contributions. If you'd like to contribute, please take a look at issues labeled contributions welcome or good first issue. We'd really appreciate it!
- 主要言語
- Python
- スター
- 27.2k
- フォーク
- 3.5k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 254
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
deepset-ai/haystack のほかの issue
-
feat: `ByteStream.from_file_path` should keep the file path in `meta`対応中かも @pinjun99 が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
deepset-ai/haystack#14081 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
BlockingConfirmationStrategy ignores an empty argument replacement対応中かも @sjrl が 6 日前に担当しました。 オープンP1
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
deepset-ai/haystack#13863 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
CSVToDocument row mode fails on CR-separated CSV input対応中かも @julian-risch が 66 日前に担当しました。 オープンP3
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
deepset-ai/haystack#13022 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
CSVToDocument row mode drops a real extra_columns field on ragged rows再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンhandled internally P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
deepset-ai/haystack#12994 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
CSVDocumentCleaner deletes a row that says N/A, and both CSV components empty those cells対応中かも @michaelkillgta が 72 日前に担当しました。 オープンP3
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
deepset-ai/haystack#12784 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
deepset-ai/haystack の issue をすべて見る
似ている issue
-
Test: to_hijri() accepts datetime.datetime and uses only the date part対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンgood first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
omarelshamy25x/shamy-hijri#63 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
polish
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scores対応中かも @AshutoshSingh840 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
UKGovernmentBEIS/control-arena#992 ·
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
mvalentsev/awesome-free-ai-coding#70 ·
メンテナーはふだん 1 日以内に返信