repeat.py
 1  # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
 2  #
 3  # SPDX-License-Identifier: Apache-2.0
 4  
 5  
 6  from haystack.core.component import component
 7  
 8  
 9  @component
10  class Repeat:
11      def __init__(self, outputs: list[str]) -> None:
12          self._outputs = outputs
13          component.set_output_types(self, **dict.fromkeys(outputs, int))
14  
15      def run(self, value: int):
16          """
17          :param value: the value to repeat.
18          """
19          return dict.fromkeys(self._outputs, value)