SuperComponent drops Variadic and GreedyVariadic socket semantics from wrapped pipelines
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #13992 de @Cyber-Marty — cerrado sin fusionar
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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!
- Lenguaje dominante
- Python
- Estrellas
- 27.2k
- Forks
- 3.5k
- Merge medio
- 1 d 18 h
- PR fusionados (30 d)
- 254
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de deepset-ai/haystack
-
feat: `ByteStream.from_file_path` should keep the file path in `meta`Posiblemente ocupada @pinjun99 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
deepset-ai/haystack#14081 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
BlockingConfirmationStrategy ignores an empty argument replacementPosiblemente ocupada @sjrl la tomó hace 6 días. AbiertoP1
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
deepset-ai/haystack#13863 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
CSVToDocument row mode fails on CR-separated CSV inputPosiblemente ocupada @julian-risch la tomó hace 66 días. AbiertoP3
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
deepset-ai/haystack#13022 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
CSVToDocument row mode drops a real extra_columns field on ragged rowsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertohandled internally P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
deepset-ai/haystack#12994 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
CSVDocumentCleaner deletes a row that says N/A, and both CSV components empty those cellsPosiblemente ocupada @michaelkillgta la tomó hace 72 días. AbiertoP3
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
deepset-ai/haystack#12784 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de deepset-ai/haystack
Issues similares
-
Test: to_hijri() accepts datetime.datetime and uses only the date partPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertogood first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
omarelshamy25x/shamy-hijri#63 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
polish
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresPosiblemente ocupada @AshutoshSingh840 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
UKGovernmentBEIS/control-arena#992 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
mvalentsev/awesome-free-ai-coding#70 ·
Los mantenedores suelen responder en 1 día