AI orchestration framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data. With advanced retrieval methods, it's best suited for building RAG, question answering, semantic search or conversational agent chatbots.
Currently it's possible to both decorate a Component's run method using @component.output_types() and call component.set_output_types() when initialising it.
component.set_output_types() overrides whatever has been set by @component.output_types().
This behaviour is confusing and should be prevented.
Expected behavior
An exception is raised.
Additional context
This is related to #8280
To Reproduce
This should raise an exception.
from typing import List
from haystack import component
class MockComponent:
def __init__(self):
component.set_output_types(self, value=List[int])
@component.output_types(value=int)
def run(self):
return {"value": 1}
Describe the bug
Currently it's possible to both decorate a Component's run method using
@component.output_types()
and callcomponent.set_output_types()
when initialising it.component.set_output_types()
overrides whatever has been set by@component.output_types()
.This behaviour is confusing and should be prevented.
Expected behavior
An exception is raised.
Additional context
This is related to #8280
To Reproduce
This should raise an exception.