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: Method that specifies the input types when 'kwargs' is passed to the run method.
  
  Use as:
  
  ```python
  @component
  class MyComponent:
  
      def __init__(self, value: int):
          component.set_input_types(value_1=str, value_2=str)
          ...
  
      @component.output_types(output_1=int, output_2=str)
      def run(self, **kwargs):
          return {"output_1": kwargs["value_1"], "output_2": ""}
  ```
  
  Note that if the `run()` method also specifies some parameters, those will take precedence.
  
  For example:
  
  ```python
  @component
  class MyComponent:
  
      def __init__(self, value: int):
          component.set_input_types(value_1=str, value_2=str)
          ...
  
      @component.output_types(output_1=int, output_2=str)
      def run(self, value_0: str, value_1: Optional[str] = None, **kwargs):
          return {"output_1": kwargs["value_1"], "output_2": ""}
  ```
  
  would add a mandatory `value_0` parameters, make the `value_1`
  parameter optional with a default None, and keep the `value_2`
  parameter mandatory as specified in `set_input_types`.
docstr_tok: ["Method","that","specifies","the","input","types","when","'kwargs","'","is","passed","to","the","run","method",".","Use","as",":","``","`","python","@","component","class","MyComponent",":","def","__init__","(","self",",","value",":","int",")",":","component.set_input_types","(","value_1=str",",","value_2=str",")","...","@","component.output_types","(","output_1=int",",","output_2=str",")","def","run","(","self",",","*","*","kwargs",")",":","return","{","``","output_1","''",":","kwargs","[","``","value_1","''","]",",","``","output_2","''",":","``","''","}","``","`","Note","that","if","the","`","run","(",")","`","method","also","specifies","some","parameters",",","those","will","take","precedence",".","For","example",":","``","`","python","@","component","class","MyComponent",":","def","__init__","(","self",",","value",":","int",")",":","component.set_input_types","(","value_1=str",",","value_2=str",")","...","@","component.output_types","(","output_1=int",",","output_2=str",")","def","run","(","self",",","value_0",":","str",",","value_1",":","Optional","[","str","]","=","None",",","*","*","kwargs",")",":","return","{","``","output_1","''",":","kwargs","[","``","value_1","''","]",",","``","output_2","''",":","``","''","}","``","`","would","add","a","mandatory","`","value_0","`","parameters",",","make","the","`","value_1","`","parameter","optional","with","a","default","None",",","and","keep","the","`","value_2","`","parameter","mandatory","as","specified","in","`","set_input_types","`","."]
code: def set_input_types(self, instance, **types):
      """
      Method that specifies the input types when 'kwargs' is passed to the run method.
  
      Use as:
  
      ```python
      @component
      class MyComponent:
  
          def __init__(self, value: int):
              component.set_input_types(value_1=str, value_2=str)
              ...
  
          @component.output_types(output_1=int, output_2=str)
          def run(self, **kwargs):
              return {"output_1": kwargs["value_1"], "output_2": ""}
      ```
  
      Note that if the `run()` method also specifies some parameters, those will take precedence.
  
      For example:
  
      ```python
      @component
      class MyComponent:
  
          def __init__(self, value: int):
              component.set_input_types(value_1=str, value_2=str)
              ...
  
          @component.output_types(output_1=int, output_2=str)
          def run(self, value_0: str, value_1: Optional[str] = None, **kwargs):
              return {"output_1": kwargs["value_1"], "output_2": ""}
      ```
  
      would add a mandatory `value_0` parameters, make the `value_1`
      parameter optional with a default None, and keep the `value_2`
      parameter mandatory as specified in `set_input_types`.
  
      """
      instance.__canals_input__ = {
          name: InputSocket(name=name, type=type_)
          for name, type_ in types.items()
      }
  
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 3 for calling the _Component obj's underlying member method code with example usage: obj.set_input_types(instance) without return types