Accumulation Node Compat:
The AccumulationNodeCompat is designed to facilitate the management of data accumulation within loops, particularly in scenarios involving prompt accumulation. This node provides a streamlined interface that allows you to either store new items into an accumulator or retrieve existing items from it. By offering a clean and efficient way to handle data accumulation, it supports the creation of complex workflows where data needs to be collected and processed iteratively. This node is particularly beneficial in environments where maintaining a history of prompts or other data is crucial, enabling you to manage and manipulate accumulated data with ease.
Accumulation Node Compat Input Parameters:
mode
The mode parameter determines the operation mode of the node, allowing you to choose between "store" and "get" modes. In "store" mode, new items can be added to the accumulator, while "get" mode allows for retrieving items from the accumulator. The default value is "store", providing flexibility in how data is managed within the node.
accumulator_id
The accumulator_id is a string identifier used to specify which accumulator to interact with. This allows for the management of multiple accumulators simultaneously, each identified by a unique ID. The default value is "prompts", which is useful for scenarios involving prompt accumulation.
item
The item parameter is used in "store" mode to specify the data item to be added to the accumulator. This parameter is optional and can be of any data type, allowing for versatile data accumulation.
reset
The reset parameter is a boolean that, when set to true, clears the current accumulator before adding new items. This is useful for starting fresh accumulations without residual data from previous operations. The default value is false.
index
The index parameter is used in "get" mode to specify the position of the item to retrieve from the accumulator. It is an integer with a default value of 0, and it must be a non-negative number, allowing for precise control over which item is accessed.
accumulator
The accumulator parameter is an optional input that provides an existing accumulation structure to be used in "get" mode. If not provided, the node will attempt to use the accumulator identified by accumulator_id.
Accumulation Node Compat Output Parameters:
item
The item output represents the data item that has been either stored or retrieved from the accumulator. In "store" mode, it reflects the item that was added, while in "get" mode, it represents the item retrieved based on the specified index.
accumulator
The accumulator output provides the current state of the accumulation structure after the operation. It includes all items stored in the accumulator, allowing for further processing or inspection of the accumulated data.
Accumulation Node Compat Usage Tips:
- Use the
resetparameter to clear the accumulator when starting a new accumulation cycle to avoid mixing old and new data. - Utilize different
accumulator_idvalues to manage multiple accumulators simultaneously, which is useful in complex workflows requiring separate data streams.
Accumulation Node Compat Common Errors and Solutions:
"Index out of range"
- Explanation: This error occurs when the specified
indexis outside the bounds of the current accumulator's item list. - Solution: Ensure that the
indexis within the valid range of the accumulator's items by checking the length of the list before attempting to retrieve an item.
"Accumulator not found"
- Explanation: This error happens when the specified
accumulator_iddoes not correspond to any existing accumulator in storage. - Solution: Verify that the correct
accumulator_idis being used and that the accumulator has been initialized before attempting to retrieve items.
