Scopes
Last updated
Last updated
The term "scope" describes how data is organized hierarchically. At the top level is the global scope, which encompasses the entire intermidiate data (i.e. state of ). Nested within this global scope are inner scopes, corresponding to the values associated with specific keys in the dictionary.
Example of a state, where dictionary value is a global scope, and the keys "prompt", "messages", "images", "search_results" are inner scopes:
All components manipulate the global scope of input data, which refers to the complete state of . Additionally, and have the capability to manipulate inner scopes using and , respectively. These executors are created upon the use method call and retain the context of execution, which includes the following parameters:
get_key (Optional[str], optional): Specifies which key value of input_data will be utilized (i.e., the scope to be used).
set_key (Optional[str], optional): Determines which key will be used to set the result value. If set_key is set to None:
if the result is of type Dict[str, Any], it updates the root dict.
otherwise, it sets the result to the default_key. (i.e., the scope where the data is placed)
default_key (str, optional): Denotes the default key used for results that are not of type Dict. If the data is not a Dict, a new default scope is created or used.
replace (, optional): Specifies the strategy for replacing data within the executor. It defines how and when data should be placed in the scope. Refer to description .
See more: