Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

fix: align LLMSummarizer output_types key with actual return key - #496

Open
rekha0suthar wants to merge 1 commit into
deepset-ai:mainfrom
rekha0suthar:fix/llm-summarizer-output-type-mismatch
Open

fix: align LLMSummarizer output_types key with actual return key#496
rekha0suthar wants to merge 1 commit into
deepset-ai:mainfrom
rekha0suthar:fix/llm-summarizer-output-type-mismatch

Conversation

@rekha0suthar

Copy link
Copy Markdown

Related Issues

Fixes #490

Proposed Changes

LLMSummarizer.run() declared its output type as summary via @component.output_types(summary=list[Document]), but actually returned {"documents": documents}. This key mismatch means any pipeline connecting to llm_summarizer.summary would fail at runtime, because the declared output edge does not exist.

Changed the decorator to @component.output_types(documents=list[Document]) so the declared output key matches the actual return key "documents", consistent with:

  • The existing unit and integration tests (which already assert on result["documents"]).
  • The convention used by other document-processing components in Haystack (returning enriched documents under the documents key).

How to test

from unittest.mock import Mock
from haystack import Document
from haystack.dataclasses import ChatMessage
from haystack_experimental.components.summarizers.llm_summarizer import LLMSummarizer

mock_generator = Mock()
mock_generator.run = Mock(return_value={"replies": [ChatMessage.from_assistant("Short summary.")]})

summarizer = LLMSummarizer(chat_generator=mock_generator)
summarizer._document_splitter._is_warmed_up = True

result = summarizer.run(documents=[Document(content="A long text to summarize.")])
assert "documents" in result  # was KeyError before the fix

馃 Generated with Claude Code

LLMSummarizer declared @component.output_types(summary=...) but
returned {"documents": ...}, causing a key mismatch that breaks
pipeline connections using the declared output edge.

Align the declaration to match the actual return key: documents.
@rekha0suthar
rekha0suthar requested a review from a team as a code owner July 28, 2026 09:32
@rekha0suthar
rekha0suthar requested review from julian-risch and removed request for a team July 28, 2026 09:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mismatch between output edge and return key of LLMSummarizer

1 participant