Closed oryx1729 closed 3 months ago
@oryx1729 would you please try using typing.List[str] i.e. the full class name. That should work, see https://github.com/deepset-ai/haystack/pull/8196 for more details. Let us know 🙏
Yeah here is an example that worked for me in the past @oryx1729
adapter = OutputAdapter.from_dict(
{
'type': 'haystack.components.converters.output_adapter.OutputAdapter',
'init_parameters':
{
'template': "\n{% set ns = namespace(doc_string='\n\n') %}\n{% for document in documents %}\n {% set ns.doc_string = ns.doc_string + '[' + loop.index|string + ']: ' + document.meta.name + '\n' %}\n{% endfor %}\n{% set answer = [replies[0] + ns.doc_string] %}\n{{ answer }}\n",
'output_type': 'typing.List[str]',
'custom_filters': {}
}
}
)
Ok thanks @sjrl - I added a unit test just to have this use case one covered @oryx1729
Added a unit test, closing.
Describe the bug YAML deserialization fails for
OutputAdapter
when usingList
in theoutput_type
parameter. Here's an example:Error message
Expected behavior A clear and concise description of what you expected to happen.
Additional context Add any other context about the problem here, like document types / preprocessing steps / settings of reader etc.
To Reproduce Steps to reproduce the behavior
FAQ Check
System: