class_docstr: Accumulates the value flowing through the connection into an internal attribute.
  The sum function can be customized.
  
  Example of how to deal with serialization when some of the parameters
  are not directly serializable.
class_docstr_tok: ["Accumulates","the","value","flowing","through","the","connection","into","an","internal","attribute",".","The","sum","function","can","be","customized",".","Example","of","how","to","deal","with","serialization","when","some","of","the","parameters","are","not","directly","serializable","."]
docstr: Accumulates the value flowing through the connection into an internal attribute.
  The sum function can be customized.
docstr_tok: ["Accumulates","the","value","flowing","through","the","connection","into","an","internal","attribute",".","The","sum","function","can","be","customized","."]
code: def run(self, value: int):
      """
      Accumulates the value flowing through the connection into an internal attribute.
      The sum function can be customized.
      """
      self.state = self.function(self.state, value)
      return {"value": self.state}
  
file_path: haystack/haystack/testing/sample_components/accumulate.py
imports: from typing import Callable, Optional, Dict, Any
  import sys
  import builtins
  from importlib import import_module
  from haystack.core.serialization import default_to_dict
  from haystack.core.component import component
  from haystack.core.errors import ComponentDeserializationError
label_desc: Use image node_id 4 for calling the Accumulate obj's underlying member method code with example usage: obj.run(value) and returns: dict