class_docstr: See module's docstring.
  
  Args:
      class_: the class that Canals should use as a component.
      serializable: whether to check, at init time, if the component can be saved with
      `save_pipelines()`.
  
  Returns:
      A class that can be recognized as a component.
  
  Raises:
      ComponentError: if the class provided has no `run()` method or otherwise doesn't respect the component contract.
class_docstr_tok: ["See","module","'s","docstring",".","Args",":","class_",":","the","class","that","Canals","should","use","as","a","component",".","serializable",":","whether","to","check",",","at","init","time",",","if","the","component","can","be","saved","with","`","save_pipelines","(",")","`",".","Returns",":","A","class","that","can","be","recognized","as","a","component",".","Raises",":","ComponentError",":","if","the","class","provided","has","no","`","run","(",")","`","method","or","otherwise","does","n't","respect","the","component","contract","."]
docstr: Decorator factory that specifies the output types of a component.
  
  Use as:
  
  ```python
  @component
  class MyComponent:
      @component.output_types(output_1=int, output_2=str)
      def run(self, value: int):
          return {"output_1": 1, "output_2": "2"}
  ```
docstr_tok: ["Decorator","factory","that","specifies","the","output","types","of","a","component",".","Use","as",":","``","`","python","@","component","class","MyComponent",":","@","component.output_types","(","output_1=int",",","output_2=str",")","def","run","(","self",",","value",":","int",")",":","return","{","``","output_1","''",":","1",",","``","output_2","''",":","``","2","''","}","``","`"]
code: def output_types(self, **types):
      """
      Decorator factory that specifies the output types of a component.
  
      Use as:
  
      ```python
      @component
      class MyComponent:
          @component.output_types(output_1=int, output_2=str)
          def run(self, value: int):
              return {"output_1": 1, "output_2": "2"}
      ```
      """
  
      def output_types_decorator(run_method):
          """
          This happens at class creation time, and since we don't have the decorated
          class available here, we temporarily store the output types as an attribute of
          the decorated method. The ComponentMeta metaclass will use this data to create
          sockets at instance creation time.
          """
          setattr(
              run_method,
              "_output_types_cache",
              {
                  name: OutputSocket(name=name, type=type_)
                  for name, type_ in types.items()
              },
          )
          return run_method
  
      return output_types_decorator
  
imports: import logging
  import inspect
  from typing import Protocol, runtime_checkable, Any
  from types import new_class
  from copy import deepcopy
  from haystack.core.component.sockets import InputSocket, OutputSocket, _empty
  from haystack.core.errors import ComponentError
label_desc: Use image node_id 5 for calling the _Component obj's underlying member method code with example usage: obj.output_types() and returns: output_types_decorator, run_method