haystack-core-integrations
haystack-core-integrations copied to clipboard
Gemini integration does not work with `AnswerBuilder`
Describe the bug
I encountered the following error when connecting GoogleAIGeminiGenerator
with the AnswerBuilder
component.
haystack.core.errors.PipelineConnectError: Cannot connect 'llm.replies' with 'answer_builder.replies': their declared input and output types do not match.
'llm':
- replies: List[Union[str, Dict[str, str]]]
'answer_builder':
- replies: Union[List[str], List[ChatMessage]] (available)
To Reproduce
from haystack import Pipeline
from haystack.components.builders import AnswerBuilder
from haystack_integrations.components.generators.google_ai import GoogleAIGeminiGenerator
from haystack.utils import Secret
gemini = GoogleAIGeminiGenerator(model="gemini-pro", api_key=Secret.from_env_var("GEMINI-API-KEY") )
pipeline = Pipeline()
pipeline.add_component(name="llm", instance=gemini)
pipeline.add_component(name="answer_builder", instance=AnswerBuilder())
pipeline.connect("llm.replies", "answer_builder.replies")
res = pipeline.run(data={"llm": {"parts": "Hello"}, "answer_builder": {"query": "hello"}})
Describe your environment (please complete the following information):
- OS: [e.g. iOS] iOS
- Haystack version: v2.3.1
- Integration version: